From 267d8caa9c1145c40f61d9a72d3186ae74b88d8f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 28 Mar 2025 21:40:28 -0700 Subject: [PATCH 01/78] chore(deps): update all non-major dependencies (#1324) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- storage/framework/core/ai/package.json | 4 ++-- .../core/cloud/src/cloud/router-layer/nodejs/package.json | 2 +- storage/framework/core/docs/package.json | 2 +- storage/framework/core/types/package.json | 2 +- storage/framework/core/vite-config/package.json | 2 +- storage/framework/core/vite-plugin/package.json | 2 +- storage/framework/views/web/package.json | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/storage/framework/core/ai/package.json b/storage/framework/core/ai/package.json index ad13e34e5a..40ea75453a 100644 --- a/storage/framework/core/ai/package.json +++ b/storage/framework/core/ai/package.json @@ -42,8 +42,8 @@ "prepublishOnly": "bun run build" }, "devDependencies": { - "@aws-sdk/client-bedrock-runtime": "^3.777.0", - "@aws-sdk/credential-providers": "^3.777.0", + "@aws-sdk/client-bedrock-runtime": "^3.778.0", + "@aws-sdk/credential-providers": "^3.778.0", "@stacksjs/development": "workspace:*", "aws-sdk-client-mock": "^4.1.0" } diff --git a/storage/framework/core/cloud/src/cloud/router-layer/nodejs/package.json b/storage/framework/core/cloud/src/cloud/router-layer/nodejs/package.json index adf656e1b8..a167825be8 100644 --- a/storage/framework/core/cloud/src/cloud/router-layer/nodejs/package.json +++ b/storage/framework/core/cloud/src/cloud/router-layer/nodejs/package.json @@ -10,6 +10,6 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "dependencies": { - "@stacksjs/router": "^0.70.19" + "@stacksjs/router": "^0.70.21" } } diff --git a/storage/framework/core/docs/package.json b/storage/framework/core/docs/package.json index 703e828835..9c0b32172b 100644 --- a/storage/framework/core/docs/package.json +++ b/storage/framework/core/docs/package.json @@ -37,7 +37,7 @@ "@iconify-json/carbon": "^1.2.8", "@shikijs/vitepress-twoslash": "^3.2.1", "@vite-pwa/assets-generator": "^0.2.6", - "@vite-pwa/vitepress": "^0.5.3", + "@vite-pwa/vitepress": "^0.5.4", "unocss": "^66.0.0", "unplugin-icons": "^22.1.0", "unplugin-vue-components": "^28.4.1", diff --git a/storage/framework/core/types/package.json b/storage/framework/core/types/package.json index 328579a8e7..8d12c1e6c3 100644 --- a/storage/framework/core/types/package.json +++ b/storage/framework/core/types/package.json @@ -70,7 +70,7 @@ "vite": "^6.2.3", "vite-plugin-inspect": "^11.0.0", "vite-plugin-pwa": "^0.21.2", - "vite-ssg": "^26.0.0", + "vite-ssg": "^26.1.0", "vitepress": "1.6.3", "vue": "^3.5.13" } diff --git a/storage/framework/core/vite-config/package.json b/storage/framework/core/vite-config/package.json index ceb6720870..ad9cc140a5 100644 --- a/storage/framework/core/vite-config/package.json +++ b/storage/framework/core/vite-config/package.json @@ -96,7 +96,7 @@ "vite-plugin-local": "^0.5.0", "vite-plugin-pages": "^0.32.5", "vite-plugin-pwa": "^0.21.2", - "vite-ssg": "^26.0.0", + "vite-ssg": "^26.1.0", "vite-ssg-sitemap": "^0.8.1 " } } diff --git a/storage/framework/core/vite-plugin/package.json b/storage/framework/core/vite-plugin/package.json index 09ea065d4b..8abe765e0c 100644 --- a/storage/framework/core/vite-plugin/package.json +++ b/storage/framework/core/vite-plugin/package.json @@ -101,7 +101,7 @@ "vite-plugin-inspect": "^11.0.0", "vite-plugin-pages": "^0.32.5", "vite-plugin-pwa": "^0.21.2", - "vite-ssg": "^26.0.0", + "vite-ssg": "^26.1.0", "vite-ssg-sitemap": "^0.8.1" } } diff --git a/storage/framework/views/web/package.json b/storage/framework/views/web/package.json index 600de1d1ef..fd4bf1e447 100644 --- a/storage/framework/views/web/package.json +++ b/storage/framework/views/web/package.json @@ -48,7 +48,7 @@ "vite-plugin-pwa": "^0.21.2", "vite-plugin-vue-devtools": "^7.7.2", "vite-plugin-vue-layouts": "^0.11.0", - "vite-ssg": "^26.0.0", + "vite-ssg": "^26.1.0", "vite-ssg-sitemap": "^0.8.1", "vue-tsc": "^2.2.8" } From 397b4b00379c7b1643c023775022c57bab73d6eb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 28 Mar 2025 21:42:02 -0700 Subject: [PATCH 02/78] chore(deps): update dependency @stacksjs/router to ^0.70.22 (#1325) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .../core/cloud/src/cloud/router-layer/nodejs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/framework/core/cloud/src/cloud/router-layer/nodejs/package.json b/storage/framework/core/cloud/src/cloud/router-layer/nodejs/package.json index a167825be8..308b1989c3 100644 --- a/storage/framework/core/cloud/src/cloud/router-layer/nodejs/package.json +++ b/storage/framework/core/cloud/src/cloud/router-layer/nodejs/package.json @@ -10,6 +10,6 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "dependencies": { - "@stacksjs/router": "^0.70.21" + "@stacksjs/router": "^0.70.22" } } From 3a789c137d729939c7f24ddece4ec3364af2bdbf Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Sat, 29 Mar 2025 19:42:13 +0800 Subject: [PATCH 03/78] chore: wip --- .../core/commerce/src/restaurant/export.ts | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 storage/framework/core/commerce/src/restaurant/export.ts diff --git a/storage/framework/core/commerce/src/restaurant/export.ts b/storage/framework/core/commerce/src/restaurant/export.ts new file mode 100644 index 0000000000..4a73cc7f61 --- /dev/null +++ b/storage/framework/core/commerce/src/restaurant/export.ts @@ -0,0 +1,107 @@ +import type { WaitlistRestaurantJsonResponse } from '@stacksjs/orm' +import type { SpreadsheetWrapper } from 'ts-spreadsheets' +import { createSpreadsheet } from 'ts-spreadsheets' +import { fetchAll } from './fetch' + +/** + * Represents the structure of an exported restaurant waitlist entry + */ +export interface ExportedRestaurantWaitlist { + 'ID': number + 'Name': string + 'Phone': string + 'Party Size': number + 'Table Preference': string + 'Status': string + 'Quoted Wait Time': number + 'Actual Wait Time': number + 'Check In Time': string + 'Created At': string + 'Notes': string +} + +/** + * Export restaurant waitlist entries to a spreadsheet + * @param format The format of the spreadsheet (default is CSV) + * @returns Spreadsheet object ready for download or storage + */ +export async function exportRestaurantWaitlist(format: 'csv' | 'excel' = 'csv'): Promise { + // Fetch all restaurant waitlist entries + const waitlistEntries = await fetchAll() + + // Prepare data for spreadsheet + const spreadsheetData = prepareRestaurantWaitlistForExport(waitlistEntries) + + // Create and return spreadsheet + return createSpreadsheet(spreadsheetData, { type: format }) +} + +/** + * Prepare restaurant waitlist data for spreadsheet export + * @param waitlistEntries Array of restaurant waitlist entry objects + * @returns Spreadsheet data structure + */ +function prepareRestaurantWaitlistForExport(waitlistEntries: WaitlistRestaurantJsonResponse[]) { + // Define headings + const headings: (keyof ExportedRestaurantWaitlist)[] = [ + 'ID', + 'Name', + 'Phone', + 'Party Size', + 'Table Preference', + 'Status', + 'Quoted Wait Time', + 'Actual Wait Time', + 'Check In Time', + 'Created At', + 'Notes', + ] + + // Transform waitlist entries into export format + const data = waitlistEntries.map((entry) => { + return [ + entry.id, + entry.name, + entry.phone || 'N/A', + entry.party_size, + entry.table_preference, + entry.status, + entry.quoted_wait_time || 'N/A', + entry.actual_wait_time || 'N/A', + entry.check_in_time || 'N/A', + entry.created_at, + entry.notes || 'N/A', + ] + }) + + return { headings, data } +} + +/** + * Export restaurant waitlist entries and automatically download + * @param format The format of the spreadsheet (default is CSV) + * @param filename Optional filename for the download + * @returns Download response + */ +export async function downloadRestaurantWaitlist(format: 'csv' | 'excel' = 'csv', filename?: string): Promise { + const spreadsheet = await exportRestaurantWaitlist(format) + + // Use default filename if not provided + const defaultFilename = `restaurant_waitlist_export_${new Date().toISOString().split('T')[0]}.${format}` + return spreadsheet.download(filename || defaultFilename) +} + +/** + * Store restaurant waitlist export to disk + * @param format The format of the spreadsheet (default is CSV) + * @param path Optional path to store the file + * @returns Path where the file is stored + */ +export async function storeRestaurantWaitlistExport(format: 'csv' | 'excel' = 'csv', path?: string): Promise { + const spreadsheet = await exportRestaurantWaitlist(format) + + // Use default path and filename if not provided + const defaultPath = `restaurant_waitlist_export_${new Date().toISOString().split('T')[0]}.${format}` + + spreadsheet.store(path || defaultPath) +} From cdb8e23d6486c50d5e48e6326b49cad974e29f0f Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Sat, 29 Mar 2025 20:13:29 +0800 Subject: [PATCH 04/78] chore: wip --- .../actions/src/PrintLogDestroyOrmAction.ts | 20 + .../actions/src/PrintLogIndexOrmAction.ts | 13 + .../actions/src/PrintLogShowOrmAction.ts | 18 + .../actions/src/PrintLogStoreOrmAction.ts | 17 + .../actions/src/PrintLogUpdateOrmAction.ts | 21 + .../framework/core/types/src/model-names.ts | 2 +- .../framework/core/types/src/table-names.ts | 2 +- .../defaults/models/ecommerce/PrintLog.ts | 125 ++ storage/framework/orm/routes.ts | 10 + storage/framework/orm/src/index.ts | 2 + storage/framework/orm/src/models/PrintLog.ts | 1032 +++++++++++++++++ .../orm/src/models/WaitlistRestaurant.ts | 77 +- storage/framework/orm/src/types.ts | 2 + storage/framework/requests/PrintLogRequest.ts | 48 + .../requests/WaitlistRestaurantRequest.ts | 6 + storage/framework/server-auto-imports.json | 9 + storage/framework/types/attributes.ts | 9 +- storage/framework/types/events.ts | 4 + storage/framework/types/requests.d.ts | 36 +- .../framework/types/server-auto-imports.d.ts | 9 + 20 files changed, 1457 insertions(+), 5 deletions(-) create mode 100644 storage/framework/actions/src/PrintLogDestroyOrmAction.ts create mode 100644 storage/framework/actions/src/PrintLogIndexOrmAction.ts create mode 100644 storage/framework/actions/src/PrintLogShowOrmAction.ts create mode 100644 storage/framework/actions/src/PrintLogStoreOrmAction.ts create mode 100644 storage/framework/actions/src/PrintLogUpdateOrmAction.ts create mode 100644 storage/framework/defaults/models/ecommerce/PrintLog.ts create mode 100644 storage/framework/orm/src/models/PrintLog.ts create mode 100644 storage/framework/requests/PrintLogRequest.ts diff --git a/storage/framework/actions/src/PrintLogDestroyOrmAction.ts b/storage/framework/actions/src/PrintLogDestroyOrmAction.ts new file mode 100644 index 0000000000..6474d72e9a --- /dev/null +++ b/storage/framework/actions/src/PrintLogDestroyOrmAction.ts @@ -0,0 +1,20 @@ +import type { PrintLogRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { PrintLog } from '@stacksjs/orm' +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'PrintLog Destroy', + description: 'PrintLog Destroy ORM Action', + method: 'DELETE', + async handle(request: PrintLogRequestType) { + const id = request.getParam('id') + + const model = await PrintLog.findOrFail(Number(id)) + + model.delete() + + return response.json({ message: 'Model deleted!' }) + }, +}) diff --git a/storage/framework/actions/src/PrintLogIndexOrmAction.ts b/storage/framework/actions/src/PrintLogIndexOrmAction.ts new file mode 100644 index 0000000000..b1618b8251 --- /dev/null +++ b/storage/framework/actions/src/PrintLogIndexOrmAction.ts @@ -0,0 +1,13 @@ +import { Action } from '@stacksjs/actions' +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'PrintLog Index', + description: 'PrintLog Index ORM Action', + method: 'GET', + async handle() { + const results = PrintLog.all() + + return response.json(results) + }, +}) diff --git a/storage/framework/actions/src/PrintLogShowOrmAction.ts b/storage/framework/actions/src/PrintLogShowOrmAction.ts new file mode 100644 index 0000000000..8cf535d32e --- /dev/null +++ b/storage/framework/actions/src/PrintLogShowOrmAction.ts @@ -0,0 +1,18 @@ +import type { PrintLogRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { PrintLog } from '@stacksjs/orm' +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'PrintLog Show', + description: 'PrintLog Show ORM Action', + method: 'GET', + async handle(request: PrintLogRequestType) { + const id = request.getParam('id') + + const model = await PrintLog.findOrFail(Number(id)) + + return response.json(model) + }, +}) diff --git a/storage/framework/actions/src/PrintLogStoreOrmAction.ts b/storage/framework/actions/src/PrintLogStoreOrmAction.ts new file mode 100644 index 0000000000..5e0dfe1843 --- /dev/null +++ b/storage/framework/actions/src/PrintLogStoreOrmAction.ts @@ -0,0 +1,17 @@ +import type { PrintLogRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { PrintLog } from '@stacksjs/orm' +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'PrintLog Store', + description: 'PrintLog Store ORM Action', + method: 'POST', + async handle(request: PrintLogRequestType) { + await request.validate() + const model = await PrintLog.create(request.all()) + + return response.json(model) + }, +}) diff --git a/storage/framework/actions/src/PrintLogUpdateOrmAction.ts b/storage/framework/actions/src/PrintLogUpdateOrmAction.ts new file mode 100644 index 0000000000..4f6d8f1794 --- /dev/null +++ b/storage/framework/actions/src/PrintLogUpdateOrmAction.ts @@ -0,0 +1,21 @@ +import type { PrintLogRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { PrintLog } from '@stacksjs/orm' +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'PrintLog Update', + description: 'PrintLog Update ORM Action', + method: 'PATCH', + async handle(request: PrintLogRequestType) { + await request.validate() + + const id = request.getParam('id') + const model = await PrintLog.findOrFail(Number(id)) + + const result = model.update(request.all()) + + return response.json(result) + }, +}) diff --git a/storage/framework/core/types/src/model-names.ts b/storage/framework/core/types/src/model-names.ts index ce67e0a308..7df19c9f47 100644 --- a/storage/framework/core/types/src/model-names.ts +++ b/storage/framework/core/types/src/model-names.ts @@ -1 +1 @@ -export type ModelNames = 'Project' | 'SubscriberEmail' | 'AccessToken' | 'Team' | 'Subscriber' | 'Deployment' | 'Release' | 'User' | 'Post' | 'Category' | 'Payment' | 'Driver' | 'WaitlistProduct' | 'DigitalDelivery' | 'Manufacturer' | 'OrderItem' | 'ShippingZone' | 'Customer' | 'Product' | 'ProductVariant' | 'LicenseKey' | 'WaitlistRestaurant' | 'Review' | 'ProductUnit' | 'GiftCard' | 'Order' | 'Coupon' | 'TaxRate' | 'Transaction' | 'LoyaltyPoint' | 'ProductItem' | 'LoyaltyReward' | 'ShippingMethod' | 'ShippingRate' | 'DeliveryRoute' | 'FailedJob' | 'PaymentMethod' | 'PaymentTransaction' | 'Request' | 'Job' | 'Subscription' | 'PaymentProduct' | 'Error' +export type ModelNames = 'Project' | 'SubscriberEmail' | 'AccessToken' | 'Team' | 'Subscriber' | 'Deployment' | 'Release' | 'User' | 'Post' | 'Category' | 'Payment' | 'Driver' | 'WaitlistProduct' | 'DigitalDelivery' | 'Manufacturer' | 'OrderItem' | 'ShippingZone' | 'Customer' | 'Product' | 'ProductVariant' | 'LicenseKey' | 'WaitlistRestaurant' | 'Review' | 'ProductUnit' | 'GiftCard' | 'Order' | 'Coupon' | 'TaxRate' | 'PrintLog' | 'Transaction' | 'LoyaltyPoint' | 'ProductItem' | 'LoyaltyReward' | 'ShippingMethod' | 'ShippingRate' | 'DeliveryRoute' | 'FailedJob' | 'PaymentMethod' | 'PaymentTransaction' | 'Request' | 'Job' | 'Subscription' | 'PaymentProduct' | 'Error' diff --git a/storage/framework/core/types/src/table-names.ts b/storage/framework/core/types/src/table-names.ts index 69e067559c..d3f37d486c 100644 --- a/storage/framework/core/types/src/table-names.ts +++ b/storage/framework/core/types/src/table-names.ts @@ -1 +1 @@ -export type TableNames = 'projects' | 'subscriber_emails' | 'personal_access_tokens' | 'team_users' | 'teams' | 'subscribers' | 'deployments' | 'releases' | 'team_users' | 'users' | 'posts' | 'categories' | 'payments' | 'drivers' | 'waitlist_products' | 'digital_deliveries' | 'manufacturers' | 'order_items' | 'shipping_zones' | 'customers' | 'products' | 'product_variants' | 'license_keys' | 'waitlist_restaurants' | 'reviews' | 'product_units' | 'gift_cards' | 'orders' | 'coupons' | 'tax_rates' | 'transactions' | 'loyalty_points' | 'product_items' | 'loyalty_rewards' | 'shipping_methods' | 'shipping_rates' | 'delivery_routes' | 'failed_jobs' | 'payment_methods' | 'payment_transactions' | 'requests' | 'jobs' | 'subscriptions' | 'payment_products' | 'errors' +export type TableNames = 'projects' | 'subscriber_emails' | 'personal_access_tokens' | 'team_users' | 'teams' | 'subscribers' | 'deployments' | 'releases' | 'team_users' | 'users' | 'posts' | 'categories' | 'payments' | 'drivers' | 'waitlist_products' | 'digital_deliveries' | 'manufacturers' | 'order_items' | 'shipping_zones' | 'customers' | 'products' | 'product_variants' | 'license_keys' | 'waitlist_restaurants' | 'reviews' | 'product_units' | 'gift_cards' | 'orders' | 'coupons' | 'tax_rates' | 'print_logs' | 'transactions' | 'loyalty_points' | 'product_items' | 'loyalty_rewards' | 'shipping_methods' | 'shipping_rates' | 'delivery_routes' | 'failed_jobs' | 'payment_methods' | 'payment_transactions' | 'requests' | 'jobs' | 'subscriptions' | 'payment_products' | 'errors' diff --git a/storage/framework/defaults/models/ecommerce/PrintLog.ts b/storage/framework/defaults/models/ecommerce/PrintLog.ts new file mode 100644 index 0000000000..103b7804f5 --- /dev/null +++ b/storage/framework/defaults/models/ecommerce/PrintLog.ts @@ -0,0 +1,125 @@ +import type { Model } from '@stacksjs/types' +import { schema } from '@stacksjs/validation' + +export default { + name: 'PrintLog', + table: 'print_logs', + primaryKey: 'id', + autoIncrement: true, + + traits: { + useUuid: true, + useTimestamps: true, + useSearch: { + displayable: ['id', 'printer', 'document', 'timestamp', 'status', 'size', 'pages', 'duration'], + searchable: ['printer', 'document'], + sortable: ['timestamp', 'status', 'size', 'pages', 'duration'], + filterable: ['status'], + }, + + useSeeder: { + count: 5, + }, + + useApi: { + uri: 'print-logs', + routes: ['index', 'store', 'show', 'update', 'destroy'], + }, + + observe: true, + }, + + attributes: { + printer: { + required: true, + order: 1, + fillable: true, + validation: { + rule: schema.string().maxLength(100), + message: { + maxLength: 'Printer name must have a maximum of 100 characters', + }, + }, + factory: faker => faker.company.name(), + }, + + document: { + required: true, + order: 2, + fillable: true, + validation: { + rule: schema.string().maxLength(100), + message: { + maxLength: 'Document name must have a maximum of 100 characters', + }, + }, + factory: faker => faker.system.fileName(), + }, + + timestamp: { + required: true, + order: 3, + fillable: true, + validation: { + rule: schema.date(), + message: { + invalid: 'Invalid date format', + }, + }, + factory: faker => faker.date.recent(), + }, + + status: { + required: true, + order: 4, + fillable: true, + validation: { + rule: schema.enum(['success', 'failed', 'warning'] as const), + }, + factory: faker => faker.helpers.arrayElement(['success', 'failed', 'warning']), + }, + + size: { + required: false, + order: 5, + fillable: true, + validation: { + rule: schema.number().max(100), + message: { + max: 'Size must be less than or equal to 100', + }, + }, + factory: faker => faker.number.int({ min: 1, max: 100 }), + }, + + pages: { + required: false, + order: 6, + fillable: true, + validation: { + rule: schema.number().max(50), + message: { + max: 'Pages must be less than or equal to 50', + }, + }, + factory: faker => faker.number.int({ min: 1, max: 50 }), + }, + + duration: { + required: false, + order: 7, + fillable: true, + validation: { + rule: schema.number().max(50), + message: { + max: 'Duration must be less than or equal to 50', + }, + }, + factory: faker => faker.number.int({ min: 1, max: 50 }), + }, + }, + + dashboard: { + highlight: true, + }, +} satisfies Model diff --git a/storage/framework/orm/routes.ts b/storage/framework/orm/routes.ts index e762e0c600..9d243617dc 100644 --- a/storage/framework/orm/routes.ts +++ b/storage/framework/orm/routes.ts @@ -150,6 +150,16 @@ route.patch('tax-rates/{id}', 'TaxRateUpdateOrmAction') route.delete('tax-rates/{id}', 'TaxRateDestroyOrmAction') +route.get('print-logs', 'PrintLogIndexOrmAction') + +route.post('print-logs', 'PrintLogStoreOrmAction') + +route.get('print-logs/{id}', 'PrintLogShowOrmAction') + +route.patch('print-logs/{id}', 'PrintLogUpdateOrmAction') + +route.delete('print-logs/{id}', 'PrintLogDestroyOrmAction') + route.get('transactions', 'TransactionIndexOrmAction') route.post('transactions', 'TransactionStoreOrmAction') diff --git a/storage/framework/orm/src/index.ts b/storage/framework/orm/src/index.ts index 330aae8599..5dd80d5b17 100644 --- a/storage/framework/orm/src/index.ts +++ b/storage/framework/orm/src/index.ts @@ -44,6 +44,8 @@ export { type NewPaymentTransaction, default as PaymentTransaction, type Payment export { type NewPost, default as Post, type PostJsonResponse, type PostUpdate } from './models/Post' +export { type NewPrintLog, default as PrintLog, type PrintLogJsonResponse, type PrintLogUpdate } from './models/PrintLog' + export { type NewProduct, default as Product, type ProductJsonResponse, type ProductUpdate } from './models/Product' export { type NewProductItem, default as ProductItem, type ProductItemJsonResponse, type ProductItemUpdate } from './models/ProductItem' diff --git a/storage/framework/orm/src/models/PrintLog.ts b/storage/framework/orm/src/models/PrintLog.ts new file mode 100644 index 0000000000..f3541a1f56 --- /dev/null +++ b/storage/framework/orm/src/models/PrintLog.ts @@ -0,0 +1,1032 @@ +import type { Generated, Insertable, RawBuilder, Selectable, Updateable } from '@stacksjs/database' +import type { Operator } from '@stacksjs/orm' +import { randomUUIDv7 } from 'bun' +import { sql } from '@stacksjs/database' +import { HttpError } from '@stacksjs/error-handling' +import { dispatch } from '@stacksjs/events' +import { DB } from '@stacksjs/orm' +import { BaseOrm } from '../utils/base' + +export interface PrintLogsTable { + id: Generated + printer: string + document: string + timestamp: Date | string + status: string | string[] + size?: number + pages?: number + duration?: number + uuid?: string + + created_at?: string + + updated_at?: string + +} + +export interface PrintLogResponse { + data: PrintLogJsonResponse[] + paging: { + total_records: number + page: number + total_pages: number + } + next_cursor: number | null +} + +export interface PrintLogJsonResponse extends Omit, 'password'> { + [key: string]: any +} + +export type NewPrintLog = Insertable +export type PrintLogUpdate = Updateable + +export class PrintLogModel extends BaseOrm { + private readonly hidden: Array = [] + private readonly fillable: Array = ['printer', 'document', 'timestamp', 'status', 'size', 'pages', 'duration', 'uuid'] + private readonly guarded: Array = [] + protected attributes = {} as PrintLogJsonResponse + protected originalAttributes = {} as PrintLogJsonResponse + + protected selectFromQuery: any + protected updateFromQuery: any + protected deleteFromQuery: any + protected hasSelect: boolean + private customColumns: Record = {} + + /** + * This model inherits many query methods from BaseOrm: + * - pluck, chunk, whereExists, has, doesntHave, whereHas, whereDoesntHave + * - inRandomOrder, max, min, avg, paginate, get, and more + * + * See BaseOrm class for the full list of inherited methods. + */ + + constructor(printLog: PrintLogJsonResponse | undefined) { + super('print_logs') + if (printLog) { + this.attributes = { ...printLog } + this.originalAttributes = { ...printLog } + + Object.keys(printLog).forEach((key) => { + if (!(key in this)) { + this.customColumns[key] = (printLog as PrintLogJsonResponse)[key] + } + }) + } + + this.withRelations = [] + this.selectFromQuery = DB.instance.selectFrom('print_logs') + this.updateFromQuery = DB.instance.updateTable('print_logs') + this.deleteFromQuery = DB.instance.deleteFrom('print_logs') + this.hasSelect = false + this.hasSaved = false + } + + protected async loadRelations(models: PrintLogJsonResponse | PrintLogJsonResponse[]): Promise { + // Handle both single model and array of models + const modelArray = Array.isArray(models) ? models : [models] + if (!modelArray.length) + return + + const modelIds = modelArray.map(model => model.id) + + for (const relation of this.withRelations) { + const relatedRecords = await DB.instance + .selectFrom(relation) + .where('printLog_id', 'in', modelIds) + .selectAll() + .execute() + + if (Array.isArray(models)) { + models.map((model: PrintLogJsonResponse) => { + const records = relatedRecords.filter((record: { printLog_id: number }) => { + return record.printLog_id === model.id + }) + + model[relation] = records.length === 1 ? records[0] : records + return model + }) + } + else { + const records = relatedRecords.filter((record: { printLog_id: number }) => { + return record.printLog_id === models.id + }) + + models[relation] = records.length === 1 ? records[0] : records + } + } + } + + static with(relations: string[]): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyWith(relations) + } + + protected mapCustomGetters(models: PrintLogJsonResponse | PrintLogJsonResponse[]): void { + const data = models + + if (Array.isArray(data)) { + data.map((model: PrintLogJsonResponse) => { + const customGetter = { + default: () => { + }, + + } + + for (const [key, fn] of Object.entries(customGetter)) { + (model as any)[key] = fn() + } + + return model + }) + } + else { + const model = data + + const customGetter = { + default: () => { + }, + + } + + for (const [key, fn] of Object.entries(customGetter)) { + (model as any)[key] = fn() + } + } + } + + async mapCustomSetters(model: NewPrintLog | PrintLogUpdate): Promise { + const customSetter = { + default: () => { + }, + + } + + for (const [key, fn] of Object.entries(customSetter)) { + (model as any)[key] = await fn() + } + } + + get id(): number { + return this.attributes.id + } + + get uuid(): string | undefined { + return this.attributes.uuid + } + + get printer(): string { + return this.attributes.printer + } + + get document(): string { + return this.attributes.document + } + + get timestamp(): Date | string { + return this.attributes.timestamp + } + + get status(): string | string[] { + return this.attributes.status + } + + get size(): number | undefined { + return this.attributes.size + } + + get pages(): number | undefined { + return this.attributes.pages + } + + get duration(): number | undefined { + return this.attributes.duration + } + + get created_at(): string | undefined { + return this.attributes.created_at + } + + get updated_at(): string | undefined { + return this.attributes.updated_at + } + + set uuid(value: string) { + this.attributes.uuid = value + } + + set printer(value: string) { + this.attributes.printer = value + } + + set document(value: string) { + this.attributes.document = value + } + + set timestamp(value: Date | string) { + this.attributes.timestamp = value + } + + set status(value: string | string[]) { + this.attributes.status = value + } + + set size(value: number) { + this.attributes.size = value + } + + set pages(value: number) { + this.attributes.pages = value + } + + set duration(value: number) { + this.attributes.duration = value + } + + set updated_at(value: string) { + this.attributes.updated_at = value + } + + static select(params: (keyof PrintLogJsonResponse)[] | RawBuilder | string): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applySelect(params) + } + + // Method to find a PrintLog by ID + static async find(id: number): Promise { + const query = DB.instance.selectFrom('print_logs').where('id', '=', id).selectAll() + + const model = await query.executeTakeFirst() + + if (!model) + return undefined + + const instance = new PrintLogModel(undefined) + return instance.createInstance(model) + } + + static async first(): Promise { + const instance = new PrintLogModel(undefined) + + const model = await instance.applyFirst() + + const data = new PrintLogModel(model) + + return data + } + + static async last(): Promise { + const instance = new PrintLogModel(undefined) + + const model = await instance.applyLast() + + if (!model) + return undefined + + return new PrintLogModel(model) + } + + static async firstOrFail(): Promise { + const instance = new PrintLogModel(undefined) + + return await instance.applyFirstOrFail() + } + + static async all(): Promise { + const instance = new PrintLogModel(undefined) + + const models = await DB.instance.selectFrom('print_logs').selectAll().execute() + + instance.mapCustomGetters(models) + + const data = await Promise.all(models.map(async (model: PrintLogJsonResponse) => { + return new PrintLogModel(model) + })) + + return data + } + + static async findOrFail(id: number): Promise { + const instance = new PrintLogModel(undefined) + + return await instance.applyFindOrFail(id) + } + + static async findMany(ids: number[]): Promise { + const instance = new PrintLogModel(undefined) + + const models = await instance.applyFindMany(ids) + + return models.map((modelItem: PrintLogJsonResponse) => instance.parseResult(new PrintLogModel(modelItem))) + } + + static async latest(column: keyof PrintLogsTable = 'created_at'): Promise { + const instance = new PrintLogModel(undefined) + + const model = await instance.selectFromQuery + .selectAll() + .orderBy(column, 'desc') + .limit(1) + .executeTakeFirst() + + if (!model) + return undefined + + return new PrintLogModel(model) + } + + static async oldest(column: keyof PrintLogsTable = 'created_at'): Promise { + const instance = new PrintLogModel(undefined) + + const model = await instance.selectFromQuery + .selectAll() + .orderBy(column, 'asc') + .limit(1) + .executeTakeFirst() + + if (!model) + return undefined + + return new PrintLogModel(model) + } + + static skip(count: number): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applySkip(count) + } + + static take(count: number): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyTake(count) + } + + static where(column: keyof PrintLogsTable, ...args: [V] | [Operator, V]): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyWhere(column, ...args) + } + + static orWhere(...conditions: [string, any][]): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyOrWhere(...conditions) + } + + static whereNotIn(column: keyof PrintLogsTable, values: V[]): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyWhereNotIn(column, values) + } + + static whereBetween(column: keyof PrintLogsTable, range: [V, V]): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyWhereBetween(column, range) + } + + static whereRef(column: keyof PrintLogsTable, ...args: string[]): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyWhereRef(column, ...args) + } + + static when(condition: boolean, callback: (query: PrintLogModel) => PrintLogModel): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyWhen(condition, callback as any) + } + + static whereNull(column: keyof PrintLogsTable): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyWhereNull(column) + } + + static whereNotNull(column: keyof PrintLogsTable): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyWhereNotNull(column) + } + + static whereLike(column: keyof PrintLogsTable, value: string): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyWhereLike(column, value) + } + + static orderBy(column: keyof PrintLogsTable, order: 'asc' | 'desc'): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyOrderBy(column, order) + } + + static orderByAsc(column: keyof PrintLogsTable): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyOrderByAsc(column) + } + + static orderByDesc(column: keyof PrintLogsTable): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyOrderByDesc(column) + } + + static groupBy(column: keyof PrintLogsTable): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyGroupBy(column) + } + + static having(column: keyof PrintLogsTable, operator: Operator, value: V): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyHaving(column, operator, value) + } + + static inRandomOrder(): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyInRandomOrder() + } + + static whereColumn(first: keyof PrintLogsTable, operator: Operator, second: keyof PrintLogsTable): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyWhereColumn(first, operator, second) + } + + static async max(field: keyof PrintLogsTable): Promise { + const instance = new PrintLogModel(undefined) + + return await instance.applyMax(field) + } + + static async min(field: keyof PrintLogsTable): Promise { + const instance = new PrintLogModel(undefined) + + return await instance.applyMin(field) + } + + static async avg(field: keyof PrintLogsTable): Promise { + const instance = new PrintLogModel(undefined) + + return await instance.applyAvg(field) + } + + static async sum(field: keyof PrintLogsTable): Promise { + const instance = new PrintLogModel(undefined) + + return await instance.applySum(field) + } + + static async count(): Promise { + const instance = new PrintLogModel(undefined) + + return instance.applyCount() + } + + static async get(): Promise { + const instance = new PrintLogModel(undefined) + + const results = await instance.applyGet() + + return results.map((item: PrintLogJsonResponse) => instance.createInstance(item)) + } + + static async pluck(field: K): Promise { + const instance = new PrintLogModel(undefined) + + return await instance.applyPluck(field) + } + + static async chunk(size: number, callback: (models: PrintLogModel[]) => Promise): Promise { + const instance = new PrintLogModel(undefined) + + await instance.applyChunk(size, async (models) => { + const modelInstances = models.map((item: PrintLogJsonResponse) => instance.createInstance(item)) + await callback(modelInstances) + }) + } + + static async paginate(options: { limit?: number, offset?: number, page?: number } = { limit: 10, offset: 0, page: 1 }): Promise<{ + data: PrintLogModel[] + paging: { + total_records: number + page: number + total_pages: number + } + next_cursor: number | null + }> { + const instance = new PrintLogModel(undefined) + + const result = await instance.applyPaginate(options) + + return { + data: result.data.map((item: PrintLogJsonResponse) => instance.createInstance(item)), + paging: result.paging, + next_cursor: result.next_cursor, + } + } + + // Instance method for creating model instances + createInstance(data: PrintLogJsonResponse): PrintLogModel { + return new PrintLogModel(data) + } + + async applyCreate(newPrintLog: NewPrintLog): Promise { + const filteredValues = Object.fromEntries( + Object.entries(newPrintLog).filter(([key]) => + !this.guarded.includes(key) && this.fillable.includes(key), + ), + ) as NewPrintLog + + await this.mapCustomSetters(filteredValues) + + filteredValues.uuid = randomUUIDv7() + + const result = await DB.instance.insertInto('print_logs') + .values(filteredValues) + .executeTakeFirst() + + const model = await DB.instance.selectFrom('print_logs') + .where('id', '=', Number(result.insertId || result.numInsertedOrUpdatedRows)) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve created PrintLog') + } + + if (model) + dispatch('printLog:created', model) + return this.createInstance(model) + } + + async create(newPrintLog: NewPrintLog): Promise { + return await this.applyCreate(newPrintLog) + } + + static async create(newPrintLog: NewPrintLog): Promise { + const instance = new PrintLogModel(undefined) + return await instance.applyCreate(newPrintLog) + } + + static async firstOrCreate(search: Partial, values: NewPrintLog = {} as NewPrintLog): Promise { + // First try to find a record matching the search criteria + const instance = new PrintLogModel(undefined) + + // Apply all search conditions + for (const [key, value] of Object.entries(search)) { + instance.selectFromQuery = instance.selectFromQuery.where(key, '=', value) + } + + // Try to find the record + const existingRecord = await instance.applyFirst() + + if (existingRecord) { + return instance.createInstance(existingRecord) + } + + // If no record exists, create a new one with combined search criteria and values + const createData = { ...search, ...values } as NewPrintLog + return await PrintLogModel.create(createData) + } + + static async updateOrCreate(search: Partial, values: NewPrintLog = {} as NewPrintLog): Promise { + // First try to find a record matching the search criteria + const instance = new PrintLogModel(undefined) + + // Apply all search conditions + for (const [key, value] of Object.entries(search)) { + instance.selectFromQuery = instance.selectFromQuery.where(key, '=', value) + } + + // Try to find the record + const existingRecord = await instance.applyFirst() + + if (existingRecord) { + // If record exists, update it with the new values + const model = instance.createInstance(existingRecord) + const updatedModel = await model.update(values as PrintLogUpdate) + + // Return the updated model instance + if (updatedModel) { + return updatedModel + } + + // If update didn't return a model, fetch it again to ensure we have latest data + const refreshedModel = await instance.applyFirst() + return instance.createInstance(refreshedModel!) + } + + // If no record exists, create a new one with combined search criteria and values + const createData = { ...search, ...values } as NewPrintLog + return await PrintLogModel.create(createData) + } + + async update(newPrintLog: PrintLogUpdate): Promise { + const filteredValues = Object.fromEntries( + Object.entries(newPrintLog).filter(([key]) => + !this.guarded.includes(key) && this.fillable.includes(key), + ), + ) as PrintLogUpdate + + await this.mapCustomSetters(filteredValues) + + filteredValues.updated_at = new Date().toISOString() + + await DB.instance.updateTable('print_logs') + .set(filteredValues) + .where('id', '=', this.id) + .executeTakeFirst() + + if (this.id) { + // Get the updated data + const model = await DB.instance.selectFrom('print_logs') + .where('id', '=', this.id) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve updated PrintLog') + } + + if (model) + dispatch('printLog:updated', model) + return this.createInstance(model) + } + + this.hasSaved = true + + return undefined + } + + async forceUpdate(newPrintLog: PrintLogUpdate): Promise { + await DB.instance.updateTable('print_logs') + .set(newPrintLog) + .where('id', '=', this.id) + .executeTakeFirst() + + if (this.id) { + // Get the updated data + const model = await DB.instance.selectFrom('print_logs') + .where('id', '=', this.id) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve updated PrintLog') + } + + if (this) + dispatch('printLog:updated', model) + return this.createInstance(model) + } + + return undefined + } + + async save(): Promise { + // If the model has an ID, update it; otherwise, create a new record + if (this.id) { + // Update existing record + await DB.instance.updateTable('print_logs') + .set(this.attributes as PrintLogUpdate) + .where('id', '=', this.id) + .executeTakeFirst() + + // Get the updated data + const model = await DB.instance.selectFrom('print_logs') + .where('id', '=', this.id) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve updated PrintLog') + } + + if (this) + dispatch('printLog:updated', model) + return this.createInstance(model) + } + else { + // Create new record + const result = await DB.instance.insertInto('print_logs') + .values(this.attributes as NewPrintLog) + .executeTakeFirst() + + // Get the created data + const model = await DB.instance.selectFrom('print_logs') + .where('id', '=', Number(result.insertId || result.numInsertedOrUpdatedRows)) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve created PrintLog') + } + + if (this) + dispatch('printLog:created', model) + return this.createInstance(model) + } + } + + static async createMany(newPrintLog: NewPrintLog[]): Promise { + const instance = new PrintLogModel(undefined) + + const valuesFiltered = newPrintLog.map((newPrintLog: NewPrintLog) => { + const filteredValues = Object.fromEntries( + Object.entries(newPrintLog).filter(([key]) => + !instance.guarded.includes(key) && instance.fillable.includes(key), + ), + ) as NewPrintLog + + filteredValues.uuid = randomUUIDv7() + + return filteredValues + }) + + await DB.instance.insertInto('print_logs') + .values(valuesFiltered) + .executeTakeFirst() + } + + static async forceCreate(newPrintLog: NewPrintLog): Promise { + const result = await DB.instance.insertInto('print_logs') + .values(newPrintLog) + .executeTakeFirst() + + const instance = new PrintLogModel(undefined) + const model = await DB.instance.selectFrom('print_logs') + .where('id', '=', Number(result.insertId || result.numInsertedOrUpdatedRows)) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve created PrintLog') + } + + if (model) + dispatch('printLog:created', model) + + return instance.createInstance(model) + } + + // Method to remove a PrintLog + async delete(): Promise { + if (this.id === undefined) + this.deleteFromQuery.execute() + const model = await this.find(Number(this.id)) + + if (model) + dispatch('printLog:deleted', model) + + const deleted = await DB.instance.deleteFrom('print_logs') + .where('id', '=', this.id) + .execute() + + return deleted.numDeletedRows + } + + static async remove(id: number): Promise { + const instance = new PrintLogModel(undefined) + + const model = await instance.find(Number(id)) + + if (model) + dispatch('printLog:deleted', model) + + return await DB.instance.deleteFrom('print_logs') + .where('id', '=', id) + .execute() + } + + static wherePrinter(value: string): PrintLogModel { + const instance = new PrintLogModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('printer', '=', value) + + return instance + } + + static whereDocument(value: string): PrintLogModel { + const instance = new PrintLogModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('document', '=', value) + + return instance + } + + static whereTimestamp(value: string): PrintLogModel { + const instance = new PrintLogModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('timestamp', '=', value) + + return instance + } + + static whereStatus(value: string): PrintLogModel { + const instance = new PrintLogModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('status', '=', value) + + return instance + } + + static whereSize(value: string): PrintLogModel { + const instance = new PrintLogModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('size', '=', value) + + return instance + } + + static wherePages(value: string): PrintLogModel { + const instance = new PrintLogModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('pages', '=', value) + + return instance + } + + static whereDuration(value: string): PrintLogModel { + const instance = new PrintLogModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('duration', '=', value) + + return instance + } + + static whereIn(column: keyof PrintLogsTable, values: V[]): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyWhereIn(column, values) + } + + toSearchableObject(): Partial { + return { + id: this.id, + printer: this.printer, + document: this.document, + timestamp: this.timestamp, + status: this.status, + size: this.size, + pages: this.pages, + duration: this.duration, + } + } + + static distinct(column: keyof PrintLogJsonResponse): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyDistinct(column) + } + + static join(table: string, firstCol: string, secondCol: string): PrintLogModel { + const instance = new PrintLogModel(undefined) + + return instance.applyJoin(table, firstCol, secondCol) + } + + toJSON(): PrintLogJsonResponse { + const output = { + + uuid: this.uuid, + + id: this.id, + printer: this.printer, + document: this.document, + timestamp: this.timestamp, + status: this.status, + size: this.size, + pages: this.pages, + duration: this.duration, + + created_at: this.created_at, + + updated_at: this.updated_at, + + ...this.customColumns, + } + + return output + } + + parseResult(model: PrintLogModel): PrintLogModel { + for (const hiddenAttribute of this.hidden) { + delete model[hiddenAttribute as keyof PrintLogModel] + } + + return model + } + + // Add a protected applyFind implementation + protected async applyFind(id: number): Promise { + const model = await DB.instance.selectFrom(this.tableName) + .where('id', '=', id) + .selectAll() + .executeTakeFirst() + + if (!model) + return undefined + + this.mapCustomGetters(model) + + await this.loadRelations(model) + + // Return a proper instance using the factory method + return this.createInstance(model) + } +} + +export async function find(id: number): Promise { + const query = DB.instance.selectFrom('print_logs').where('id', '=', id).selectAll() + + const model = await query.executeTakeFirst() + + if (!model) + return undefined + + const instance = new PrintLogModel(undefined) + return instance.createInstance(model) +} + +export async function count(): Promise { + const results = await PrintLogModel.count() + + return results +} + +export async function create(newPrintLog: NewPrintLog): Promise { + const instance = new PrintLogModel(undefined) + return await instance.applyCreate(newPrintLog) +} + +export async function rawQuery(rawQuery: string): Promise { + return await sql`${rawQuery}`.execute(DB.instance) +} + +export async function remove(id: number): Promise { + await DB.instance.deleteFrom('print_logs') + .where('id', '=', id) + .execute() +} + +export async function wherePrinter(value: string): Promise { + const query = DB.instance.selectFrom('print_logs').where('printer', '=', value) + const results: PrintLogJsonResponse = await query.execute() + + return results.map((modelItem: PrintLogJsonResponse) => new PrintLogModel(modelItem)) +} + +export async function whereDocument(value: string): Promise { + const query = DB.instance.selectFrom('print_logs').where('document', '=', value) + const results: PrintLogJsonResponse = await query.execute() + + return results.map((modelItem: PrintLogJsonResponse) => new PrintLogModel(modelItem)) +} + +export async function whereTimestamp(value: Date | string): Promise { + const query = DB.instance.selectFrom('print_logs').where('timestamp', '=', value) + const results: PrintLogJsonResponse = await query.execute() + + return results.map((modelItem: PrintLogJsonResponse) => new PrintLogModel(modelItem)) +} + +export async function whereStatus(value: string | string[]): Promise { + const query = DB.instance.selectFrom('print_logs').where('status', '=', value) + const results: PrintLogJsonResponse = await query.execute() + + return results.map((modelItem: PrintLogJsonResponse) => new PrintLogModel(modelItem)) +} + +export async function whereSize(value: number): Promise { + const query = DB.instance.selectFrom('print_logs').where('size', '=', value) + const results: PrintLogJsonResponse = await query.execute() + + return results.map((modelItem: PrintLogJsonResponse) => new PrintLogModel(modelItem)) +} + +export async function wherePages(value: number): Promise { + const query = DB.instance.selectFrom('print_logs').where('pages', '=', value) + const results: PrintLogJsonResponse = await query.execute() + + return results.map((modelItem: PrintLogJsonResponse) => new PrintLogModel(modelItem)) +} + +export async function whereDuration(value: number): Promise { + const query = DB.instance.selectFrom('print_logs').where('duration', '=', value) + const results: PrintLogJsonResponse = await query.execute() + + return results.map((modelItem: PrintLogJsonResponse) => new PrintLogModel(modelItem)) +} + +export const PrintLog = PrintLogModel + +export default PrintLog diff --git a/storage/framework/orm/src/models/WaitlistRestaurant.ts b/storage/framework/orm/src/models/WaitlistRestaurant.ts index 6e32cb53ed..7d39089126 100644 --- a/storage/framework/orm/src/models/WaitlistRestaurant.ts +++ b/storage/framework/orm/src/models/WaitlistRestaurant.ts @@ -22,6 +22,9 @@ export interface WaitlistRestaurantsTable { quoted_wait_time: number actual_wait_time?: number queue_position?: number + seated_at?: Date | string + no_show_at?: Date | string + cancelled_at?: Date | string uuid?: string created_at?: string @@ -49,7 +52,7 @@ export type WaitlistRestaurantUpdate = Updateable export class WaitlistRestaurantModel extends BaseOrm { private readonly hidden: Array = [] - private readonly fillable: Array = ['name', 'email', 'phone', 'party_size', 'check_in_time', 'table_preference', 'status', 'quoted_wait_time', 'actual_wait_time', 'queue_position', 'uuid', 'customer_id'] + private readonly fillable: Array = ['name', 'email', 'phone', 'party_size', 'check_in_time', 'table_preference', 'status', 'quoted_wait_time', 'actual_wait_time', 'queue_position', 'seated_at', 'no_show_at', 'cancelled_at', 'uuid', 'customer_id'] private readonly guarded: Array = [] protected attributes = {} as WaitlistRestaurantJsonResponse protected originalAttributes = {} as WaitlistRestaurantJsonResponse @@ -231,6 +234,18 @@ export class WaitlistRestaurantModel extends BaseOrm + message: Record +} + +interface CustomAttributes { + [key: string]: ValidationField +} +interface RequestDataPrintLog { + id: number + printer: string + document: string + timestamp: date + status: string[] + size: number + pages: number + duration: number + created_at?: Date + updated_at?: Date +} +export class PrintLogRequest extends Request implements PrintLogRequestType { + public id = 1 + public printer = '' + public document = '' + public timestamp = '' + public status = [] + public size = 0 + public pages = 0 + public duration = 0 + public created_at = new Date() + public updated_at = new Date() + public uuid = '' + public async validate(attributes?: CustomAttributes): Promise { + if (attributes === undefined || attributes === null) { + await validateField('PrintLog', this.all()) + } + else { + await customValidate(attributes, this.all()) + } + } +} + +export const printLogRequest = new PrintLogRequest() diff --git a/storage/framework/requests/WaitlistRestaurantRequest.ts b/storage/framework/requests/WaitlistRestaurantRequest.ts index b408edf3db..bac630281a 100644 --- a/storage/framework/requests/WaitlistRestaurantRequest.ts +++ b/storage/framework/requests/WaitlistRestaurantRequest.ts @@ -23,6 +23,9 @@ interface RequestDataWaitlistRestaurant { quoted_wait_time: number actual_wait_time: number queue_position: number + seated_at: date + no_show_at: date + cancelled_at: date customer_id: number created_at?: Date updated_at?: Date @@ -39,6 +42,9 @@ export class WaitlistRestaurantRequest extends Request void + get: (key: string, defaultValue?: T) => T + all: () => RequestDataPrintLog + id: number + printer: string + document: string + timestamp: date + status: string[] + size: number + pages: number + duration: number + created_at?: Date + updated_at?: Date +} + interface RequestDataTransaction { id: number amount: number @@ -1264,4 +1298,4 @@ export interface ErrorRequestType extends Request { updated_at?: Date } -export type ModelRequest = ProjectRequestType | SubscriberEmailRequestType | AccessTokenRequestType | TeamRequestType | SubscriberRequestType | DeploymentRequestType | ReleaseRequestType | UserRequestType | PostRequestType | CategoryRequestType | PaymentRequestType | DriverRequestType | WaitlistProductRequestType | DigitalDeliveryRequestType | ManufacturerRequestType | OrderItemRequestType | ShippingZoneRequestType | CustomerRequestType | ProductRequestType | ProductVariantRequestType | LicenseKeyRequestType | WaitlistRestaurantRequestType | ReviewRequestType | ProductUnitRequestType | GiftCardRequestType | OrderRequestType | CouponRequestType | TaxRateRequestType | TransactionRequestType | LoyaltyPointRequestType | ProductItemRequestType | LoyaltyRewardRequestType | ShippingMethodRequestType | ShippingRateRequestType | DeliveryRouteRequestType | FailedJobRequestType | PaymentMethodRequestType | PaymentTransactionRequestType | RequestRequestType | JobRequestType | SubscriptionRequestType | PaymentProductRequestType | ErrorRequestType +export type ModelRequest = ProjectRequestType | SubscriberEmailRequestType | AccessTokenRequestType | TeamRequestType | SubscriberRequestType | DeploymentRequestType | ReleaseRequestType | UserRequestType | PostRequestType | CategoryRequestType | PaymentRequestType | DriverRequestType | WaitlistProductRequestType | DigitalDeliveryRequestType | ManufacturerRequestType | OrderItemRequestType | ShippingZoneRequestType | CustomerRequestType | ProductRequestType | ProductVariantRequestType | LicenseKeyRequestType | WaitlistRestaurantRequestType | ReviewRequestType | ProductUnitRequestType | GiftCardRequestType | OrderRequestType | CouponRequestType | TaxRateRequestType | PrintLogRequestType | TransactionRequestType | LoyaltyPointRequestType | ProductItemRequestType | LoyaltyRewardRequestType | ShippingMethodRequestType | ShippingRateRequestType | DeliveryRouteRequestType | FailedJobRequestType | PaymentMethodRequestType | PaymentTransactionRequestType | RequestRequestType | JobRequestType | SubscriptionRequestType | PaymentProductRequestType | ErrorRequestType diff --git a/storage/framework/types/server-auto-imports.d.ts b/storage/framework/types/server-auto-imports.d.ts index 17488d2f7b..57f0f6504b 100644 --- a/storage/framework/types/server-auto-imports.d.ts +++ b/storage/framework/types/server-auto-imports.d.ts @@ -135,6 +135,7 @@ declare global { const NewPaymentProduct: typeof import('./../orm/src/models')['NewPaymentProduct'] const NewPaymentTransaction: typeof import('./../orm/src/models')['NewPaymentTransaction'] const NewPost: typeof import('./../orm/src/models')['NewPost'] + const NewPrintLog: typeof import('./../orm/src/models')['NewPrintLog'] const NewProduct: typeof import('./../orm/src/models')['NewProduct'] const NewProductItem: typeof import('./../orm/src/models')['NewProductItem'] const NewProductUnit: typeof import('./../orm/src/models')['NewProductUnit'] @@ -205,6 +206,13 @@ declare global { const PostResponse: typeof import('./../orm/src/models')['PostResponse'] const PostUpdate: typeof import('./../orm/src/models')['PostUpdate'] const PostsTable: typeof import('./../orm/src/models')['PostsTable'] + const PrintLog: typeof import('./../orm/src/models')['PrintLog'] + const PrintLogJsonResponse: typeof import('./../orm/src/models')['PrintLogJsonResponse'] + const PrintLogModel: typeof import('./../orm/src/models')['PrintLogModel'] + const PrintLogRequest: typeof import('./../requests')['PrintLogRequest'] + const PrintLogResponse: typeof import('./../orm/src/models')['PrintLogResponse'] + const PrintLogUpdate: typeof import('./../orm/src/models')['PrintLogUpdate'] + const PrintLogsTable: typeof import('./../orm/src/models')['PrintLogsTable'] const Product: typeof import('./../orm/src/models')['Product'] const ProductItem: typeof import('./../orm/src/models')['ProductItem'] const ProductItemJsonResponse: typeof import('./../orm/src/models')['ProductItemJsonResponse'] @@ -368,6 +376,7 @@ declare global { const paymentRequest: typeof import('./../requests')['paymentRequest'] const paymentTransactionRequest: typeof import('./../requests')['paymentTransactionRequest'] const postRequest: typeof import('./../requests')['postRequest'] + const printLogRequest: typeof import('./../requests')['printLogRequest'] const productItemRequest: typeof import('./../requests')['productItemRequest'] const productRequest: typeof import('./../requests')['productRequest'] const productUnitRequest: typeof import('./../requests')['productUnitRequest'] From 3e7a16cd7ea5965b8c1866f7cd817e38cc0a1bc0 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Sat, 29 Mar 2025 20:31:33 +0800 Subject: [PATCH 05/78] chore: wip --- .../core/commerce/src/prints/destroy.ts | 54 +++++++++ .../core/commerce/src/prints/fetch.ts | 20 ++++ .../core/commerce/src/prints/store.ts | 106 ++++++++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 storage/framework/core/commerce/src/prints/destroy.ts create mode 100644 storage/framework/core/commerce/src/prints/fetch.ts create mode 100644 storage/framework/core/commerce/src/prints/store.ts diff --git a/storage/framework/core/commerce/src/prints/destroy.ts b/storage/framework/core/commerce/src/prints/destroy.ts new file mode 100644 index 0000000000..51ae46150e --- /dev/null +++ b/storage/framework/core/commerce/src/prints/destroy.ts @@ -0,0 +1,54 @@ +import { db } from '@stacksjs/database' + +/** + * Delete a print log by ID + * + * @param id The ID of the print log to delete + * @returns True if the print log was deleted, false otherwise + */ +export async function destroy(id: number): Promise { + try { + const result = await db + .deleteFrom('print_logs') + .where('id', '=', id) + .executeTakeFirst() + + return Number(result.numDeletedRows) > 0 + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to delete print log: ${error.message}`) + } + + throw error + } +} + +/** + * Delete multiple print logs by ID + * + * @param ids Array of print log IDs to delete + * @returns Number of print logs deleted + */ +export async function bulkDestroy(ids: number[]): Promise { + if (!ids.length) + return 0 + + try { + // Perform the delete operation + const result = await db + .deleteFrom('print_logs') + .where('id', 'in', ids) + .executeTakeFirst() + + // Return the number of deleted rows + return Number(result.numDeletedRows) + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to delete print logs: ${error.message}`) + } + + throw error + } +} diff --git a/storage/framework/core/commerce/src/prints/fetch.ts b/storage/framework/core/commerce/src/prints/fetch.ts new file mode 100644 index 0000000000..ee83fa99d7 --- /dev/null +++ b/storage/framework/core/commerce/src/prints/fetch.ts @@ -0,0 +1,20 @@ +import type { PrintLogJsonResponse } from '@stacksjs/orm' +import { db } from '@stacksjs/database' + +/** + * Fetch a print log by ID + */ +export async function fetchById(id: number): Promise { + return await db + .selectFrom('print_logs') + .where('id', '=', id) + .selectAll() + .executeTakeFirst() +} + +/** + * Fetch all print logs + */ +export async function fetchAll(): Promise { + return await db.selectFrom('print_logs').selectAll().execute() +} diff --git a/storage/framework/core/commerce/src/prints/store.ts b/storage/framework/core/commerce/src/prints/store.ts new file mode 100644 index 0000000000..d16ec1f0f4 --- /dev/null +++ b/storage/framework/core/commerce/src/prints/store.ts @@ -0,0 +1,106 @@ +import type { NewPrintLog, PrintLogJsonResponse, PrintLogRequestType } from '@stacksjs/orm' +import { randomUUIDv7 } from 'bun' +import { db } from '@stacksjs/database' + +/** + * Create a new print log + * + * @param request Print log data to store + * @returns The newly created print log record + */ +export async function store(request: PrintLogRequestType): Promise { + // Validate the request data + await request.validate() + + try { + // Prepare print log data + const printData: NewPrintLog = { + printer: request.get('printer'), + document: request.get('document'), + timestamp: request.get('timestamp'), + status: request.get('status'), + size: request.get('size'), + pages: request.get('pages'), + duration: request.get('duration'), + } + + printData.uuid = randomUUIDv7() + + // Insert the print log + const result = await db + .insertInto('print_logs') + .values(printData) + .executeTakeFirst() + + const printId = Number(result.insertId) || Number(result.numInsertedOrUpdatedRows) + + // Retrieve the newly created print log + const printLog = await db + .selectFrom('print_logs') + .where('id', '=', printId) + .selectAll() + .executeTakeFirst() + + return printLog + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to create print log: ${error.message}`) + } + + throw error + } +} + +/** + * Create multiple print logs at once + * + * @param requests Array of print log data to store + * @returns Number of print logs created + */ +export async function bulkStore(requests: PrintLogRequestType[]): Promise { + if (!requests.length) + return 0 + + let createdCount = 0 + + try { + // Process each print log + await db.transaction().execute(async (trx) => { + for (const request of requests) { + // Validate request data + request.validate() + + // Prepare print log data + const printData: NewPrintLog = { + printer: request.get('printer'), + document: request.get('document'), + timestamp: request.get('timestamp'), + status: request.get('status'), + size: request.get('size'), + pages: request.get('pages'), + duration: request.get('duration'), + } + + printData.uuid = randomUUIDv7() + + // Insert the print log + await trx + .insertInto('print_logs') + .values(printData) + .execute() + + createdCount++ + } + }) + + return createdCount + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to create print logs in bulk: ${error.message}`) + } + + throw error + } +} From 17c2b686ce1948d4c75a2be3770570c2a56a1e5b Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Sat, 29 Mar 2025 20:35:10 +0800 Subject: [PATCH 06/78] chore: wip --- .../core/commerce/src/prints/index.ts | 24 +++ .../core/commerce/src/prints/update.ts | 162 ++++++++++++++++++ 2 files changed, 186 insertions(+) create mode 100644 storage/framework/core/commerce/src/prints/index.ts create mode 100644 storage/framework/core/commerce/src/prints/update.ts diff --git a/storage/framework/core/commerce/src/prints/index.ts b/storage/framework/core/commerce/src/prints/index.ts new file mode 100644 index 0000000000..1be50c88e9 --- /dev/null +++ b/storage/framework/core/commerce/src/prints/index.ts @@ -0,0 +1,24 @@ +// Functions from destroy.ts +export { + bulkDestroy, + destroy, +} from './destroy' + +// Functions from fetch.ts +export { + fetchAll, + fetchById, +} from './fetch' + +// Functions from store.ts +export { + bulkStore, + store, +} from './store' + +// Functions from update.ts +export { + update, + updateStatus, + updatePrintJob, +} from './update' diff --git a/storage/framework/core/commerce/src/prints/update.ts b/storage/framework/core/commerce/src/prints/update.ts new file mode 100644 index 0000000000..ac1d0b42a1 --- /dev/null +++ b/storage/framework/core/commerce/src/prints/update.ts @@ -0,0 +1,162 @@ +import type { PrintLogJsonResponse, PrintLogRequestType } from '@stacksjs/orm' +import { db } from '@stacksjs/database' +import { formatDate } from '@stacksjs/orm' +import { fetchById } from './fetch' + +/** + * Update a print log by ID + * + * @param id The ID of the print log to update + * @param request The updated print log data + * @returns The updated print log record + */ +export async function update(id: number, request: PrintLogRequestType): Promise { + // Validate the request data + await request.validate() + + // Check if print log exists + const existingLog = await fetchById(id) + + if (!existingLog) { + throw new Error(`Print log with ID ${id} not found`) + } + + // Create update data object using request fields + const updateData = { + printer: request.get('printer'), + document: request.get('document'), + timestamp: request.get('timestamp'), + status: request.get('status'), + size: request.get('size'), + pages: request.get('pages'), + duration: request.get('duration'), + updated_at: formatDate(new Date()), + } + + // If no fields to update, just return the existing print log + if (Object.keys(updateData).length === 0) { + return existingLog + } + + try { + // Update the print log + await db + .updateTable('print_logs') + .set(updateData) + .where('id', '=', id) + .execute() + + // Fetch and return the updated print log + return await fetchById(id) + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to update print log: ${error.message}`) + } + + throw error + } +} + +/** + * Update a print log's status + * + * @param id The ID of the print log + * @param status The new status + * @returns The updated print log with the new status + */ +export async function updateStatus( + id: number, + status: 'success' | 'failed' | 'warning', +): Promise { + // Check if print log exists + const printLog = await fetchById(id) + + if (!printLog) { + throw new Error(`Print log with ID ${id} not found`) + } + + try { + // Update the print log status + await db + .updateTable('print_logs') + .set({ + status, + updated_at: formatDate(new Date()), + }) + .where('id', '=', id) + .execute() + + // Fetch the updated print log + return await fetchById(id) + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to update print log status: ${error.message}`) + } + + throw error + } +} + +/** + * Update print job information + * + * @param id The ID of the print log + * @param size Optional new size value + * @param pages Optional new pages value + * @param duration Optional new duration value + * @returns The updated print log + */ +export async function updatePrintJob( + id: number, + size?: number, + pages?: number, + duration?: number, +): Promise { + // Check if print log exists + const printLog = await fetchById(id) + + if (!printLog) { + throw new Error(`Print log with ID ${id} not found`) + } + + // Create update data with only provided fields + const updateData: Record = { + updated_at: formatDate(new Date()), + } + + if (size !== undefined) { + updateData.size = size + } + if (pages !== undefined) { + updateData.pages = pages + } + if (duration !== undefined) { + updateData.duration = duration + } + + // If no fields to update, just return the existing print log + if (Object.keys(updateData).length === 1) { // Only updated_at was set + return printLog + } + + try { + // Update the print log + await db + .updateTable('print_logs') + .set(updateData) + .where('id', '=', id) + .execute() + + // Fetch the updated print log + return await fetchById(id) + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to update print job information: ${error.message}`) + } + + throw error + } +} From 5396253f82aca10bdd83109e15ef486656a194a4 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Sat, 29 Mar 2025 20:38:56 +0800 Subject: [PATCH 07/78] chore: wip --- .../core/commerce/src/tests/prints.test.ts | 368 ++++++++++++++++++ 1 file changed, 368 insertions(+) create mode 100644 storage/framework/core/commerce/src/tests/prints.test.ts diff --git a/storage/framework/core/commerce/src/tests/prints.test.ts b/storage/framework/core/commerce/src/tests/prints.test.ts new file mode 100644 index 0000000000..4f26a492ef --- /dev/null +++ b/storage/framework/core/commerce/src/tests/prints.test.ts @@ -0,0 +1,368 @@ +import type { PrintLogJsonResponse } from '@stacksjs/orm' +import { beforeEach, describe, expect, it } from 'bun:test' +import { formatDate } from '@stacksjs/orm' +import { refreshDatabase } from '@stacksjs/testing' +import { bulkDestroy, destroy } from '../prints/destroy' +import { fetchAll, fetchById } from '../prints/fetch' +import { bulkStore, store } from '../prints/store' +import { update, updatePrintJob, updateStatus } from '../prints/update' + +// Create a request-like object for testing +class TestRequest { + private data: Record = {} + + constructor(data: Record) { + this.data = data + } + + validate() { + return Promise.resolve() + } + + get(key: string): T { + return this.data[key] as T + } +} + +beforeEach(async () => { + await refreshDatabase() +}) + +describe('Print Log Module', () => { + describe('store', () => { + it('should create a new print log in the database', async () => { + const requestData = { + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: formatDate(new Date()), + status: 'success', + size: 1024, + pages: 5, + duration: 30, + } + + const request = new TestRequest(requestData) + const printLog = await store(request as any) + + expect(printLog).toBeDefined() + expect(printLog?.printer).toBe('HP LaserJet') + expect(printLog?.document).toBe('invoice.pdf') + expect(printLog?.status).toBe('success') + expect(printLog?.size).toBe(1024) + expect(printLog?.pages).toBe(5) + expect(printLog?.duration).toBe(30) + expect(printLog?.uuid).toBeDefined() + + // Save the ID for further testing + const printId = printLog?.id !== undefined ? Number(printLog.id) : undefined + + // Verify we can fetch the print log we just created + if (printId) { + const fetchedPrint = await fetchById(printId) + expect(fetchedPrint).toBeDefined() + expect(fetchedPrint?.id).toBe(printId) + } + }) + + it('should create a print log with minimal required fields', async () => { + const minimalRequestData = { + printer: 'Epson Printer', + document: 'report.pdf', + timestamp: formatDate(new Date()), + status: 'success', + } + + const request = new TestRequest(minimalRequestData) + const printLog = await store(request as any) + + expect(printLog).toBeDefined() + expect(printLog?.printer).toBe('Epson Printer') + expect(printLog?.document).toBe('report.pdf') + expect(printLog?.status).toBe('success') + expect(printLog?.size).toBeUndefined() + expect(printLog?.pages).toBeUndefined() + expect(printLog?.duration).toBeUndefined() + expect(printLog?.uuid).toBeDefined() + }) + + it('should create multiple print logs with bulk store', async () => { + const requests = [ + new TestRequest({ + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: formatDate(new Date()), + status: 'success', + size: 1024, + pages: 5, + duration: 30, + }), + new TestRequest({ + printer: 'Epson Printer', + document: 'report.pdf', + timestamp: formatDate(new Date()), + status: 'warning', + size: 2048, + pages: 10, + duration: 45, + }), + new TestRequest({ + printer: 'Canon Printer', + document: 'document.pdf', + timestamp: formatDate(new Date()), + status: 'failed', + size: 512, + pages: 2, + duration: 15, + }), + ] + + const count = await bulkStore(requests as any) + expect(count).toBe(3) + + // Verify print logs can be fetched + const allPrintLogs = await fetchAll() + expect(allPrintLogs.length).toBeGreaterThanOrEqual(3) + }) + + it('should return 0 when trying to bulk store an empty array', async () => { + const count = await bulkStore([]) + expect(count).toBe(0) + }) + }) + + describe('update', () => { + it('should update an existing print log', async () => { + // First create a print log to update + const requestData = { + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: formatDate(new Date()), + status: 'success', + size: 1024, + pages: 5, + duration: 30, + } + + // Create the print log + const createRequest = new TestRequest(requestData) + const printLog = await store(createRequest as any) + const printId = printLog?.id !== undefined ? Number(printLog.id) : undefined + + // Make sure we have a valid print ID before proceeding + expect(printId).toBeDefined() + if (!printId) { + throw new Error('Failed to create test print log') + } + + // Update the print log with new data + const updateData = { + printer: 'HP LaserJet Pro', + document: 'updated_invoice.pdf', + timestamp: formatDate(new Date()), + status: 'warning', + size: 2048, + pages: 10, + duration: 45, + } + + const updateRequest = new TestRequest(updateData) + const updatedPrint = await update(printId, updateRequest as any) + + // Verify the update was successful + expect(updatedPrint).toBeDefined() + expect(updatedPrint?.id).toBe(printId) + expect(updatedPrint?.printer).toBe('HP LaserJet Pro') + expect(updatedPrint?.document).toBe('updated_invoice.pdf') + expect(updatedPrint?.status).toBe('warning') + expect(updatedPrint?.size).toBe(2048) + expect(updatedPrint?.pages).toBe(10) + expect(updatedPrint?.duration).toBe(45) + }) + + it('should update a print log\'s status', async () => { + // Create a print log + const requestData = { + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: formatDate(new Date()), + status: 'success', + size: 1024, + pages: 5, + duration: 30, + } + + const request = new TestRequest(requestData) + const printLog = await store(request as any) + const printId = printLog?.id !== undefined ? Number(printLog.id) : undefined + + // Make sure we have a valid print ID before proceeding + expect(printId).toBeDefined() + if (!printId) { + throw new Error('Failed to create test print log') + } + + // Update status to warning + const updatedPrint = await updateStatus(printId, 'warning') + expect(updatedPrint).toBeDefined() + expect(updatedPrint?.status).toBe('warning') + + // Update status to failed + const failedPrint = await updateStatus(printId, 'failed') + expect(failedPrint).toBeDefined() + expect(failedPrint?.status).toBe('failed') + }) + + it('should update print job information', async () => { + // Create a print log + const requestData = { + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: formatDate(new Date()), + status: 'success', + size: 1024, + pages: 5, + duration: 30, + } + + const request = new TestRequest(requestData) + const printLog = await store(request as any) + const printId = printLog?.id !== undefined ? Number(printLog.id) : undefined + + expect(printId).toBeDefined() + if (!printId) { + throw new Error('Failed to create test print log') + } + + // Update print job information + const updatedPrint = await updatePrintJob(printId, 2048, 10, 45) + + expect(updatedPrint).toBeDefined() + expect(updatedPrint?.size).toBe(2048) + expect(updatedPrint?.pages).toBe(10) + expect(updatedPrint?.duration).toBe(45) + }) + }) + + describe('destroy', () => { + it('should delete a print log from the database', async () => { + // First create a print log to delete + const requestData = { + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: formatDate(new Date()), + status: 'success', + size: 1024, + pages: 5, + duration: 30, + } + + // Create the print log + const request = new TestRequest(requestData) + const printLog = await store(request as any) + const printId = printLog?.id !== undefined ? Number(printLog.id) : undefined + + // Make sure we have a valid print ID before proceeding + expect(printId).toBeDefined() + if (!printId) { + throw new Error('Failed to create test print log') + } + + // Verify the print log exists + let fetchedPrint = await fetchById(printId) + expect(fetchedPrint).toBeDefined() + + // Delete the print log + const deleted = await destroy(printId) + expect(deleted).toBe(true) + + // Verify the print log no longer exists + fetchedPrint = await fetchById(printId) + expect(fetchedPrint).toBeUndefined() + }) + + it('should return 0 when trying to delete an empty array of print logs', async () => { + // Try to delete with an empty array + const deletedCount = await bulkDestroy([]) + expect(deletedCount).toBe(0) + }) + }) + + describe('fetch', () => { + it('should fetch all print logs', async () => { + // Create test print logs + const requests = [ + new TestRequest({ + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: formatDate(new Date()), + status: 'success', + size: 1024, + pages: 5, + duration: 30, + }), + new TestRequest({ + printer: 'Epson Printer', + document: 'report.pdf', + timestamp: formatDate(new Date()), + status: 'warning', + size: 2048, + pages: 10, + duration: 45, + }), + new TestRequest({ + printer: 'Canon Printer', + document: 'document.pdf', + timestamp: formatDate(new Date()), + status: 'failed', + size: 512, + pages: 2, + duration: 15, + }), + ] + + // Create the print logs + await bulkStore(requests as any) + + // Fetch all print logs + const allPrintLogs = await fetchAll() + expect(allPrintLogs).toBeDefined() + expect(allPrintLogs.length).toBe(3) + expect(allPrintLogs.map((p: PrintLogJsonResponse) => p.printer)).toContain('HP LaserJet') + expect(allPrintLogs.map((p: PrintLogJsonResponse) => p.printer)).toContain('Epson Printer') + expect(allPrintLogs.map((p: PrintLogJsonResponse) => p.printer)).toContain('Canon Printer') + }) + + it('should fetch a print log by ID', async () => { + // Create a print log + const requestData = { + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: formatDate(new Date()), + status: 'success', + size: 1024, + pages: 5, + duration: 30, + } + + const request = new TestRequest(requestData) + const printLog = await store(request as any) + const printId = printLog?.id !== undefined ? Number(printLog.id) : undefined + + expect(printId).toBeDefined() + if (!printId) { + throw new Error('Failed to create test print log') + } + + // Fetch the print log by ID + const fetchedPrint = await fetchById(printId) + expect(fetchedPrint).toBeDefined() + expect(fetchedPrint?.id).toBe(printId) + expect(fetchedPrint?.printer).toBe('HP LaserJet') + expect(fetchedPrint?.document).toBe('invoice.pdf') + expect(fetchedPrint?.status).toBe('success') + expect(fetchedPrint?.size).toBe(1024) + expect(fetchedPrint?.pages).toBe(5) + expect(fetchedPrint?.duration).toBe(30) + }) + }) +}) From 884e71e9ab8d4c7b182b2d35fb4faf293a0e1aa5 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Sat, 29 Mar 2025 20:43:11 +0800 Subject: [PATCH 08/78] chore: wip --- ...=> 1743252162158-create-projects-table.ts} | 0 ...2162183-create-subscriber_emails-table.ts} | 0 ...04-create-personal_access_tokens-table.ts} | 0 ... 1743252162207-create-team_users-table.ts} | 0 ...ts => 1743252162225-create-teams-table.ts} | 0 ...1743252162245-create-subscribers-table.ts} | 0 ...1743252162264-create-deployments-table.ts} | 0 ...=> 1743252162283-create-releases-table.ts} | 0 ...=> 1743252162301-create-passkeys-table.ts} | 0 ...ts => 1743252162302-create-users-table.ts} | 0 ...ts => 1743252162321-create-posts-table.ts} | 0 ... 1743252162341-create-categories-table.ts} | 0 ...=> 1743252162360-create-payments-table.ts} | 0 ... => 1743252162380-create-drivers-table.ts} | 0 ...2162399-create-waitlist_products-table.ts} | 0 ...162419-create-digital_deliveries-table.ts} | 0 ...43252162438-create-manufacturers-table.ts} | 0 ...1743252162458-create-order_items-table.ts} | 0 ...3252162476-create-shipping_zones-table.ts} | 0 ...> 1743252162494-create-customers-table.ts} | 0 ...=> 1743252162512-create-products-table.ts} | 0 ...52162531-create-product_variants-table.ts} | 0 ...743252162550-create-license_keys-table.ts} | 0 ...2571-create-waitlist_restaurants-table.ts} | 3 + ... => 1743252162591-create-reviews-table.ts} | 0 ...43252162610-create-product_units-table.ts} | 0 ... 1743252162629-create-gift_cards-table.ts} | 0 ...s => 1743252162649-create-orders-table.ts} | 0 ... => 1743252162668-create-coupons-table.ts} | 0 ...> 1743252162688-create-tax_rates-table.ts} | 0 .../1743252162707-create-print_logs-table.ts | 19 +++ ...743252162726-create-transactions-table.ts} | 0 ...3252162746-create-loyalty_points-table.ts} | 0 ...43252162765-create-product_items-table.ts} | 0 ...252162784-create-loyalty_rewards-table.ts} | 0 ...52162815-create-shipping_methods-table.ts} | 0 ...3252162834-create-shipping_rates-table.ts} | 0 ...252162854-create-delivery_routes-table.ts} | 0 ...1743252162874-create-failed_jobs-table.ts} | 0 ...252162895-create-payment_methods-table.ts} | 0 ...2913-create-payment_transactions-table.ts} | 0 ...=> 1743252162932-create-requests-table.ts} | 0 ....ts => 1743252162951-create-jobs-table.ts} | 0 ...43252162970-create-subscriptions-table.ts} | 0 ...52162989-create-payment_products-table.ts} | 0 ...s => 1743252163008-create-errors-table.ts} | 0 .../core/commerce/src/prints/index.ts | 2 +- storage/framework/models/PrintLog.ts | 125 ++++++++++++++++++ .../framework/models/WaitlistRestaurant.ts | 31 ++++- 49 files changed, 177 insertions(+), 3 deletions(-) rename database/migrations/{1743145792112-create-projects-table.ts => 1743252162158-create-projects-table.ts} (100%) rename database/migrations/{1743145792135-create-subscriber_emails-table.ts => 1743252162183-create-subscriber_emails-table.ts} (100%) rename database/migrations/{1743145792156-create-personal_access_tokens-table.ts => 1743252162204-create-personal_access_tokens-table.ts} (100%) rename database/migrations/{1743145792159-create-team_users-table.ts => 1743252162207-create-team_users-table.ts} (100%) rename database/migrations/{1743145792176-create-teams-table.ts => 1743252162225-create-teams-table.ts} (100%) rename database/migrations/{1743145792196-create-subscribers-table.ts => 1743252162245-create-subscribers-table.ts} (100%) rename database/migrations/{1743145792216-create-deployments-table.ts => 1743252162264-create-deployments-table.ts} (100%) rename database/migrations/{1743145792235-create-releases-table.ts => 1743252162283-create-releases-table.ts} (100%) rename database/migrations/{1743145792253-create-passkeys-table.ts => 1743252162301-create-passkeys-table.ts} (100%) rename database/migrations/{1743145792253-create-users-table.ts => 1743252162302-create-users-table.ts} (100%) rename database/migrations/{1743145792273-create-posts-table.ts => 1743252162321-create-posts-table.ts} (100%) rename database/migrations/{1743145792291-create-categories-table.ts => 1743252162341-create-categories-table.ts} (100%) rename database/migrations/{1743145792310-create-payments-table.ts => 1743252162360-create-payments-table.ts} (100%) rename database/migrations/{1743145792329-create-drivers-table.ts => 1743252162380-create-drivers-table.ts} (100%) rename database/migrations/{1743145792348-create-waitlist_products-table.ts => 1743252162399-create-waitlist_products-table.ts} (100%) rename database/migrations/{1743145792367-create-digital_deliveries-table.ts => 1743252162419-create-digital_deliveries-table.ts} (100%) rename database/migrations/{1743145792386-create-manufacturers-table.ts => 1743252162438-create-manufacturers-table.ts} (100%) rename database/migrations/{1743145792406-create-order_items-table.ts => 1743252162458-create-order_items-table.ts} (100%) rename database/migrations/{1743145792425-create-shipping_zones-table.ts => 1743252162476-create-shipping_zones-table.ts} (100%) rename database/migrations/{1743145792443-create-customers-table.ts => 1743252162494-create-customers-table.ts} (100%) rename database/migrations/{1743145792461-create-products-table.ts => 1743252162512-create-products-table.ts} (100%) rename database/migrations/{1743145792482-create-product_variants-table.ts => 1743252162531-create-product_variants-table.ts} (100%) rename database/migrations/{1743145792501-create-license_keys-table.ts => 1743252162550-create-license_keys-table.ts} (100%) rename database/migrations/{1743145792521-create-waitlist_restaurants-table.ts => 1743252162571-create-waitlist_restaurants-table.ts} (90%) rename database/migrations/{1743145792541-create-reviews-table.ts => 1743252162591-create-reviews-table.ts} (100%) rename database/migrations/{1743145792560-create-product_units-table.ts => 1743252162610-create-product_units-table.ts} (100%) rename database/migrations/{1743145792580-create-gift_cards-table.ts => 1743252162629-create-gift_cards-table.ts} (100%) rename database/migrations/{1743145792599-create-orders-table.ts => 1743252162649-create-orders-table.ts} (100%) rename database/migrations/{1743145792619-create-coupons-table.ts => 1743252162668-create-coupons-table.ts} (100%) rename database/migrations/{1743145792637-create-tax_rates-table.ts => 1743252162688-create-tax_rates-table.ts} (100%) create mode 100644 database/migrations/1743252162707-create-print_logs-table.ts rename database/migrations/{1743145792655-create-transactions-table.ts => 1743252162726-create-transactions-table.ts} (100%) rename database/migrations/{1743145792675-create-loyalty_points-table.ts => 1743252162746-create-loyalty_points-table.ts} (100%) rename database/migrations/{1743145792694-create-product_items-table.ts => 1743252162765-create-product_items-table.ts} (100%) rename database/migrations/{1743145792715-create-loyalty_rewards-table.ts => 1743252162784-create-loyalty_rewards-table.ts} (100%) rename database/migrations/{1743145792735-create-shipping_methods-table.ts => 1743252162815-create-shipping_methods-table.ts} (100%) rename database/migrations/{1743145792755-create-shipping_rates-table.ts => 1743252162834-create-shipping_rates-table.ts} (100%) rename database/migrations/{1743145792774-create-delivery_routes-table.ts => 1743252162854-create-delivery_routes-table.ts} (100%) rename database/migrations/{1743145792793-create-failed_jobs-table.ts => 1743252162874-create-failed_jobs-table.ts} (100%) rename database/migrations/{1743145792812-create-payment_methods-table.ts => 1743252162895-create-payment_methods-table.ts} (100%) rename database/migrations/{1743145792830-create-payment_transactions-table.ts => 1743252162913-create-payment_transactions-table.ts} (100%) rename database/migrations/{1743145792849-create-requests-table.ts => 1743252162932-create-requests-table.ts} (100%) rename database/migrations/{1743145792869-create-jobs-table.ts => 1743252162951-create-jobs-table.ts} (100%) rename database/migrations/{1743145792888-create-subscriptions-table.ts => 1743252162970-create-subscriptions-table.ts} (100%) rename database/migrations/{1743145792908-create-payment_products-table.ts => 1743252162989-create-payment_products-table.ts} (100%) rename database/migrations/{1743145792926-create-errors-table.ts => 1743252163008-create-errors-table.ts} (100%) create mode 100644 storage/framework/models/PrintLog.ts diff --git a/database/migrations/1743145792112-create-projects-table.ts b/database/migrations/1743252162158-create-projects-table.ts similarity index 100% rename from database/migrations/1743145792112-create-projects-table.ts rename to database/migrations/1743252162158-create-projects-table.ts diff --git a/database/migrations/1743145792135-create-subscriber_emails-table.ts b/database/migrations/1743252162183-create-subscriber_emails-table.ts similarity index 100% rename from database/migrations/1743145792135-create-subscriber_emails-table.ts rename to database/migrations/1743252162183-create-subscriber_emails-table.ts diff --git a/database/migrations/1743145792156-create-personal_access_tokens-table.ts b/database/migrations/1743252162204-create-personal_access_tokens-table.ts similarity index 100% rename from database/migrations/1743145792156-create-personal_access_tokens-table.ts rename to database/migrations/1743252162204-create-personal_access_tokens-table.ts diff --git a/database/migrations/1743145792159-create-team_users-table.ts b/database/migrations/1743252162207-create-team_users-table.ts similarity index 100% rename from database/migrations/1743145792159-create-team_users-table.ts rename to database/migrations/1743252162207-create-team_users-table.ts diff --git a/database/migrations/1743145792176-create-teams-table.ts b/database/migrations/1743252162225-create-teams-table.ts similarity index 100% rename from database/migrations/1743145792176-create-teams-table.ts rename to database/migrations/1743252162225-create-teams-table.ts diff --git a/database/migrations/1743145792196-create-subscribers-table.ts b/database/migrations/1743252162245-create-subscribers-table.ts similarity index 100% rename from database/migrations/1743145792196-create-subscribers-table.ts rename to database/migrations/1743252162245-create-subscribers-table.ts diff --git a/database/migrations/1743145792216-create-deployments-table.ts b/database/migrations/1743252162264-create-deployments-table.ts similarity index 100% rename from database/migrations/1743145792216-create-deployments-table.ts rename to database/migrations/1743252162264-create-deployments-table.ts diff --git a/database/migrations/1743145792235-create-releases-table.ts b/database/migrations/1743252162283-create-releases-table.ts similarity index 100% rename from database/migrations/1743145792235-create-releases-table.ts rename to database/migrations/1743252162283-create-releases-table.ts diff --git a/database/migrations/1743145792253-create-passkeys-table.ts b/database/migrations/1743252162301-create-passkeys-table.ts similarity index 100% rename from database/migrations/1743145792253-create-passkeys-table.ts rename to database/migrations/1743252162301-create-passkeys-table.ts diff --git a/database/migrations/1743145792253-create-users-table.ts b/database/migrations/1743252162302-create-users-table.ts similarity index 100% rename from database/migrations/1743145792253-create-users-table.ts rename to database/migrations/1743252162302-create-users-table.ts diff --git a/database/migrations/1743145792273-create-posts-table.ts b/database/migrations/1743252162321-create-posts-table.ts similarity index 100% rename from database/migrations/1743145792273-create-posts-table.ts rename to database/migrations/1743252162321-create-posts-table.ts diff --git a/database/migrations/1743145792291-create-categories-table.ts b/database/migrations/1743252162341-create-categories-table.ts similarity index 100% rename from database/migrations/1743145792291-create-categories-table.ts rename to database/migrations/1743252162341-create-categories-table.ts diff --git a/database/migrations/1743145792310-create-payments-table.ts b/database/migrations/1743252162360-create-payments-table.ts similarity index 100% rename from database/migrations/1743145792310-create-payments-table.ts rename to database/migrations/1743252162360-create-payments-table.ts diff --git a/database/migrations/1743145792329-create-drivers-table.ts b/database/migrations/1743252162380-create-drivers-table.ts similarity index 100% rename from database/migrations/1743145792329-create-drivers-table.ts rename to database/migrations/1743252162380-create-drivers-table.ts diff --git a/database/migrations/1743145792348-create-waitlist_products-table.ts b/database/migrations/1743252162399-create-waitlist_products-table.ts similarity index 100% rename from database/migrations/1743145792348-create-waitlist_products-table.ts rename to database/migrations/1743252162399-create-waitlist_products-table.ts diff --git a/database/migrations/1743145792367-create-digital_deliveries-table.ts b/database/migrations/1743252162419-create-digital_deliveries-table.ts similarity index 100% rename from database/migrations/1743145792367-create-digital_deliveries-table.ts rename to database/migrations/1743252162419-create-digital_deliveries-table.ts diff --git a/database/migrations/1743145792386-create-manufacturers-table.ts b/database/migrations/1743252162438-create-manufacturers-table.ts similarity index 100% rename from database/migrations/1743145792386-create-manufacturers-table.ts rename to database/migrations/1743252162438-create-manufacturers-table.ts diff --git a/database/migrations/1743145792406-create-order_items-table.ts b/database/migrations/1743252162458-create-order_items-table.ts similarity index 100% rename from database/migrations/1743145792406-create-order_items-table.ts rename to database/migrations/1743252162458-create-order_items-table.ts diff --git a/database/migrations/1743145792425-create-shipping_zones-table.ts b/database/migrations/1743252162476-create-shipping_zones-table.ts similarity index 100% rename from database/migrations/1743145792425-create-shipping_zones-table.ts rename to database/migrations/1743252162476-create-shipping_zones-table.ts diff --git a/database/migrations/1743145792443-create-customers-table.ts b/database/migrations/1743252162494-create-customers-table.ts similarity index 100% rename from database/migrations/1743145792443-create-customers-table.ts rename to database/migrations/1743252162494-create-customers-table.ts diff --git a/database/migrations/1743145792461-create-products-table.ts b/database/migrations/1743252162512-create-products-table.ts similarity index 100% rename from database/migrations/1743145792461-create-products-table.ts rename to database/migrations/1743252162512-create-products-table.ts diff --git a/database/migrations/1743145792482-create-product_variants-table.ts b/database/migrations/1743252162531-create-product_variants-table.ts similarity index 100% rename from database/migrations/1743145792482-create-product_variants-table.ts rename to database/migrations/1743252162531-create-product_variants-table.ts diff --git a/database/migrations/1743145792501-create-license_keys-table.ts b/database/migrations/1743252162550-create-license_keys-table.ts similarity index 100% rename from database/migrations/1743145792501-create-license_keys-table.ts rename to database/migrations/1743252162550-create-license_keys-table.ts diff --git a/database/migrations/1743145792521-create-waitlist_restaurants-table.ts b/database/migrations/1743252162571-create-waitlist_restaurants-table.ts similarity index 90% rename from database/migrations/1743145792521-create-waitlist_restaurants-table.ts rename to database/migrations/1743252162571-create-waitlist_restaurants-table.ts index 388d88020f..60406d873f 100644 --- a/database/migrations/1743145792521-create-waitlist_restaurants-table.ts +++ b/database/migrations/1743252162571-create-waitlist_restaurants-table.ts @@ -16,6 +16,9 @@ export async function up(db: Database) { .addColumn('quoted_wait_time', 'numeric', col => col.notNull()) .addColumn('actual_wait_time', 'numeric') .addColumn('queue_position', 'numeric') + .addColumn('seated_at', 'text') + .addColumn('no_show_at', 'text') + .addColumn('cancelled_at', 'text') .addColumn('customer_id', 'integer', col => col.references('customers.id').onDelete('cascade')) .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) diff --git a/database/migrations/1743145792541-create-reviews-table.ts b/database/migrations/1743252162591-create-reviews-table.ts similarity index 100% rename from database/migrations/1743145792541-create-reviews-table.ts rename to database/migrations/1743252162591-create-reviews-table.ts diff --git a/database/migrations/1743145792560-create-product_units-table.ts b/database/migrations/1743252162610-create-product_units-table.ts similarity index 100% rename from database/migrations/1743145792560-create-product_units-table.ts rename to database/migrations/1743252162610-create-product_units-table.ts diff --git a/database/migrations/1743145792580-create-gift_cards-table.ts b/database/migrations/1743252162629-create-gift_cards-table.ts similarity index 100% rename from database/migrations/1743145792580-create-gift_cards-table.ts rename to database/migrations/1743252162629-create-gift_cards-table.ts diff --git a/database/migrations/1743145792599-create-orders-table.ts b/database/migrations/1743252162649-create-orders-table.ts similarity index 100% rename from database/migrations/1743145792599-create-orders-table.ts rename to database/migrations/1743252162649-create-orders-table.ts diff --git a/database/migrations/1743145792619-create-coupons-table.ts b/database/migrations/1743252162668-create-coupons-table.ts similarity index 100% rename from database/migrations/1743145792619-create-coupons-table.ts rename to database/migrations/1743252162668-create-coupons-table.ts diff --git a/database/migrations/1743145792637-create-tax_rates-table.ts b/database/migrations/1743252162688-create-tax_rates-table.ts similarity index 100% rename from database/migrations/1743145792637-create-tax_rates-table.ts rename to database/migrations/1743252162688-create-tax_rates-table.ts diff --git a/database/migrations/1743252162707-create-print_logs-table.ts b/database/migrations/1743252162707-create-print_logs-table.ts new file mode 100644 index 0000000000..3ff373b0a0 --- /dev/null +++ b/database/migrations/1743252162707-create-print_logs-table.ts @@ -0,0 +1,19 @@ +import type { Database } from '@stacksjs/database' +import { sql } from '@stacksjs/database' + +export async function up(db: Database) { + await db.schema + .createTable('print_logs') + .addColumn('id', 'integer', col => col.primaryKey().autoIncrement()) + .addColumn('uuid', 'text') + .addColumn('printer', 'text', col => col.notNull()) + .addColumn('document', 'text', col => col.notNull()) + .addColumn('timestamp', 'text', col => col.notNull()) + .addColumn('status', 'text', col => col.notNull()) + .addColumn('size', 'numeric') + .addColumn('pages', 'numeric') + .addColumn('duration', 'numeric') + .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) + .addColumn('updated_at', 'timestamp') + .execute() +} diff --git a/database/migrations/1743145792655-create-transactions-table.ts b/database/migrations/1743252162726-create-transactions-table.ts similarity index 100% rename from database/migrations/1743145792655-create-transactions-table.ts rename to database/migrations/1743252162726-create-transactions-table.ts diff --git a/database/migrations/1743145792675-create-loyalty_points-table.ts b/database/migrations/1743252162746-create-loyalty_points-table.ts similarity index 100% rename from database/migrations/1743145792675-create-loyalty_points-table.ts rename to database/migrations/1743252162746-create-loyalty_points-table.ts diff --git a/database/migrations/1743145792694-create-product_items-table.ts b/database/migrations/1743252162765-create-product_items-table.ts similarity index 100% rename from database/migrations/1743145792694-create-product_items-table.ts rename to database/migrations/1743252162765-create-product_items-table.ts diff --git a/database/migrations/1743145792715-create-loyalty_rewards-table.ts b/database/migrations/1743252162784-create-loyalty_rewards-table.ts similarity index 100% rename from database/migrations/1743145792715-create-loyalty_rewards-table.ts rename to database/migrations/1743252162784-create-loyalty_rewards-table.ts diff --git a/database/migrations/1743145792735-create-shipping_methods-table.ts b/database/migrations/1743252162815-create-shipping_methods-table.ts similarity index 100% rename from database/migrations/1743145792735-create-shipping_methods-table.ts rename to database/migrations/1743252162815-create-shipping_methods-table.ts diff --git a/database/migrations/1743145792755-create-shipping_rates-table.ts b/database/migrations/1743252162834-create-shipping_rates-table.ts similarity index 100% rename from database/migrations/1743145792755-create-shipping_rates-table.ts rename to database/migrations/1743252162834-create-shipping_rates-table.ts diff --git a/database/migrations/1743145792774-create-delivery_routes-table.ts b/database/migrations/1743252162854-create-delivery_routes-table.ts similarity index 100% rename from database/migrations/1743145792774-create-delivery_routes-table.ts rename to database/migrations/1743252162854-create-delivery_routes-table.ts diff --git a/database/migrations/1743145792793-create-failed_jobs-table.ts b/database/migrations/1743252162874-create-failed_jobs-table.ts similarity index 100% rename from database/migrations/1743145792793-create-failed_jobs-table.ts rename to database/migrations/1743252162874-create-failed_jobs-table.ts diff --git a/database/migrations/1743145792812-create-payment_methods-table.ts b/database/migrations/1743252162895-create-payment_methods-table.ts similarity index 100% rename from database/migrations/1743145792812-create-payment_methods-table.ts rename to database/migrations/1743252162895-create-payment_methods-table.ts diff --git a/database/migrations/1743145792830-create-payment_transactions-table.ts b/database/migrations/1743252162913-create-payment_transactions-table.ts similarity index 100% rename from database/migrations/1743145792830-create-payment_transactions-table.ts rename to database/migrations/1743252162913-create-payment_transactions-table.ts diff --git a/database/migrations/1743145792849-create-requests-table.ts b/database/migrations/1743252162932-create-requests-table.ts similarity index 100% rename from database/migrations/1743145792849-create-requests-table.ts rename to database/migrations/1743252162932-create-requests-table.ts diff --git a/database/migrations/1743145792869-create-jobs-table.ts b/database/migrations/1743252162951-create-jobs-table.ts similarity index 100% rename from database/migrations/1743145792869-create-jobs-table.ts rename to database/migrations/1743252162951-create-jobs-table.ts diff --git a/database/migrations/1743145792888-create-subscriptions-table.ts b/database/migrations/1743252162970-create-subscriptions-table.ts similarity index 100% rename from database/migrations/1743145792888-create-subscriptions-table.ts rename to database/migrations/1743252162970-create-subscriptions-table.ts diff --git a/database/migrations/1743145792908-create-payment_products-table.ts b/database/migrations/1743252162989-create-payment_products-table.ts similarity index 100% rename from database/migrations/1743145792908-create-payment_products-table.ts rename to database/migrations/1743252162989-create-payment_products-table.ts diff --git a/database/migrations/1743145792926-create-errors-table.ts b/database/migrations/1743252163008-create-errors-table.ts similarity index 100% rename from database/migrations/1743145792926-create-errors-table.ts rename to database/migrations/1743252163008-create-errors-table.ts diff --git a/storage/framework/core/commerce/src/prints/index.ts b/storage/framework/core/commerce/src/prints/index.ts index 1be50c88e9..d91189951f 100644 --- a/storage/framework/core/commerce/src/prints/index.ts +++ b/storage/framework/core/commerce/src/prints/index.ts @@ -19,6 +19,6 @@ export { // Functions from update.ts export { update, - updateStatus, updatePrintJob, + updateStatus, } from './update' diff --git a/storage/framework/models/PrintLog.ts b/storage/framework/models/PrintLog.ts new file mode 100644 index 0000000000..103b7804f5 --- /dev/null +++ b/storage/framework/models/PrintLog.ts @@ -0,0 +1,125 @@ +import type { Model } from '@stacksjs/types' +import { schema } from '@stacksjs/validation' + +export default { + name: 'PrintLog', + table: 'print_logs', + primaryKey: 'id', + autoIncrement: true, + + traits: { + useUuid: true, + useTimestamps: true, + useSearch: { + displayable: ['id', 'printer', 'document', 'timestamp', 'status', 'size', 'pages', 'duration'], + searchable: ['printer', 'document'], + sortable: ['timestamp', 'status', 'size', 'pages', 'duration'], + filterable: ['status'], + }, + + useSeeder: { + count: 5, + }, + + useApi: { + uri: 'print-logs', + routes: ['index', 'store', 'show', 'update', 'destroy'], + }, + + observe: true, + }, + + attributes: { + printer: { + required: true, + order: 1, + fillable: true, + validation: { + rule: schema.string().maxLength(100), + message: { + maxLength: 'Printer name must have a maximum of 100 characters', + }, + }, + factory: faker => faker.company.name(), + }, + + document: { + required: true, + order: 2, + fillable: true, + validation: { + rule: schema.string().maxLength(100), + message: { + maxLength: 'Document name must have a maximum of 100 characters', + }, + }, + factory: faker => faker.system.fileName(), + }, + + timestamp: { + required: true, + order: 3, + fillable: true, + validation: { + rule: schema.date(), + message: { + invalid: 'Invalid date format', + }, + }, + factory: faker => faker.date.recent(), + }, + + status: { + required: true, + order: 4, + fillable: true, + validation: { + rule: schema.enum(['success', 'failed', 'warning'] as const), + }, + factory: faker => faker.helpers.arrayElement(['success', 'failed', 'warning']), + }, + + size: { + required: false, + order: 5, + fillable: true, + validation: { + rule: schema.number().max(100), + message: { + max: 'Size must be less than or equal to 100', + }, + }, + factory: faker => faker.number.int({ min: 1, max: 100 }), + }, + + pages: { + required: false, + order: 6, + fillable: true, + validation: { + rule: schema.number().max(50), + message: { + max: 'Pages must be less than or equal to 50', + }, + }, + factory: faker => faker.number.int({ min: 1, max: 50 }), + }, + + duration: { + required: false, + order: 7, + fillable: true, + validation: { + rule: schema.number().max(50), + message: { + max: 'Duration must be less than or equal to 50', + }, + }, + factory: faker => faker.number.int({ min: 1, max: 50 }), + }, + }, + + dashboard: { + highlight: true, + }, +} satisfies Model diff --git a/storage/framework/models/WaitlistRestaurant.ts b/storage/framework/models/WaitlistRestaurant.ts index 1fd5b54aa8..91eb15a924 100644 --- a/storage/framework/models/WaitlistRestaurant.ts +++ b/storage/framework/models/WaitlistRestaurant.ts @@ -108,9 +108,9 @@ export default { order: 7, fillable: true, validation: { - rule: schema.enum(['waiting', 'seated'] as const), + rule: schema.enum(['waiting', 'seated', 'cancelled', 'no_show'] as const), }, - factory: faker => faker.helpers.arrayElement(['waiting', 'seated']), + factory: faker => faker.helpers.arrayElement(['waiting', 'seated', 'cancelled', 'no_show']), }, quoted_wait_time: { @@ -151,6 +151,33 @@ export default { }, factory: faker => faker.helpers.maybe(() => faker.number.int({ min: 1, max: 50 }), { probability: 0.7 }), }, + seated_at: { + required: false, + order: 11, + fillable: true, + validation: { + rule: schema.date(), + }, + factory: faker => faker.helpers.maybe(() => faker.date.past().toISOString(), { probability: 0.7 }), + }, + no_show_at: { + required: false, + order: 12, + fillable: true, + validation: { + rule: schema.date(), + }, + factory: faker => faker.helpers.maybe(() => faker.date.past().toISOString(), { probability: 0.7 }), + }, + cancelled_at: { + required: false, + order: 13, + fillable: true, + validation: { + rule: schema.date(), + }, + factory: faker => faker.helpers.maybe(() => faker.date.past().toISOString(), { probability: 0.7 }), + }, }, dashboard: { From 840ddb8f7ddc9622684f4c8cf42d81c01cba1755 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Sat, 29 Mar 2025 21:20:36 +0800 Subject: [PATCH 09/78] chore: wip --- storage/framework/core/commerce/src/tests/prints.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/storage/framework/core/commerce/src/tests/prints.test.ts b/storage/framework/core/commerce/src/tests/prints.test.ts index 4f26a492ef..10f55af2fd 100644 --- a/storage/framework/core/commerce/src/tests/prints.test.ts +++ b/storage/framework/core/commerce/src/tests/prints.test.ts @@ -79,9 +79,9 @@ describe('Print Log Module', () => { expect(printLog?.printer).toBe('Epson Printer') expect(printLog?.document).toBe('report.pdf') expect(printLog?.status).toBe('success') - expect(printLog?.size).toBeUndefined() - expect(printLog?.pages).toBeUndefined() - expect(printLog?.duration).toBeUndefined() + expect(printLog?.size).toBeNull() + expect(printLog?.pages).toBeNull() + expect(printLog?.duration).toBeNull() expect(printLog?.uuid).toBeDefined() }) From 092ae34f797c09eab45aa4f53b89ed77993944bc Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Sat, 29 Mar 2025 21:45:04 +0800 Subject: [PATCH 10/78] chore: wip --- ...=> 1743254856988-create-projects-table.ts} | 0 ...4857011-create-subscriber_emails-table.ts} | 0 ...32-create-personal_access_tokens-table.ts} | 0 ... 1743254857034-create-team_users-table.ts} | 0 ...ts => 1743254857053-create-teams-table.ts} | 0 ...1743254857073-create-subscribers-table.ts} | 0 ...1743254857093-create-deployments-table.ts} | 0 ...=> 1743254857113-create-releases-table.ts} | 0 ...=> 1743254857133-create-passkeys-table.ts} | 0 ...ts => 1743254857133-create-users-table.ts} | 0 ...ts => 1743254857153-create-posts-table.ts} | 0 ... 1743254857176-create-categories-table.ts} | 0 ...=> 1743254857196-create-payments-table.ts} | 0 ... => 1743254857215-create-drivers-table.ts} | 0 ...4857234-create-waitlist_products-table.ts} | 0 ...857254-create-digital_deliveries-table.ts} | 0 ...43254857274-create-manufacturers-table.ts} | 0 ...1743254857294-create-order_items-table.ts} | 0 ...3254857313-create-shipping_zones-table.ts} | 0 ...> 1743254857331-create-customers-table.ts} | 0 ...=> 1743254857348-create-products-table.ts} | 0 ...54857368-create-product_variants-table.ts} | 0 ...743254857387-create-license_keys-table.ts} | 0 ...7407-create-waitlist_restaurants-table.ts} | 0 ... => 1743254857428-create-reviews-table.ts} | 0 ...43254857447-create-product_units-table.ts} | 0 ... 1743254857466-create-gift_cards-table.ts} | 0 ...s => 1743254857486-create-orders-table.ts} | 0 ... => 1743254857506-create-coupons-table.ts} | 0 ...> 1743254857525-create-tax_rates-table.ts} | 0 ... 1743254857544-create-print_logs-table.ts} | 2 +- ...743254857563-create-transactions-table.ts} | 0 ...3254857584-create-loyalty_points-table.ts} | 0 ...43254857604-create-product_items-table.ts} | 0 ...254857628-create-loyalty_rewards-table.ts} | 0 ...54857648-create-shipping_methods-table.ts} | 0 ...3254857669-create-shipping_rates-table.ts} | 0 ...254857688-create-delivery_routes-table.ts} | 0 ...1743254857707-create-failed_jobs-table.ts} | 0 ...254857725-create-payment_methods-table.ts} | 0 ...7744-create-payment_transactions-table.ts} | 0 ...=> 1743254857762-create-requests-table.ts} | 0 ....ts => 1743254857782-create-jobs-table.ts} | 0 ...43254857801-create-subscriptions-table.ts} | 0 ...54857821-create-payment_products-table.ts} | 0 ...s => 1743254857840-create-errors-table.ts} | 0 .../core/commerce/src/prints/fetch.ts | 45 +++++ .../core/commerce/src/prints/store.ts | 14 +- .../core/commerce/src/prints/update.ts | 8 +- .../core/commerce/src/tests/prints.test.ts | 165 ++++++++++++++++-- .../defaults/models/ecommerce/PrintLog.ts | 2 +- storage/framework/models/PrintLog.ts | 2 +- storage/framework/orm/src/models/PrintLog.ts | 8 +- storage/framework/requests/PrintLogRequest.ts | 4 +- storage/framework/types/attributes.ts | 2 +- storage/framework/types/requests.d.ts | 4 +- 56 files changed, 218 insertions(+), 38 deletions(-) rename database/migrations/{1743252162158-create-projects-table.ts => 1743254856988-create-projects-table.ts} (100%) rename database/migrations/{1743252162183-create-subscriber_emails-table.ts => 1743254857011-create-subscriber_emails-table.ts} (100%) rename database/migrations/{1743252162204-create-personal_access_tokens-table.ts => 1743254857032-create-personal_access_tokens-table.ts} (100%) rename database/migrations/{1743252162207-create-team_users-table.ts => 1743254857034-create-team_users-table.ts} (100%) rename database/migrations/{1743252162225-create-teams-table.ts => 1743254857053-create-teams-table.ts} (100%) rename database/migrations/{1743252162245-create-subscribers-table.ts => 1743254857073-create-subscribers-table.ts} (100%) rename database/migrations/{1743252162264-create-deployments-table.ts => 1743254857093-create-deployments-table.ts} (100%) rename database/migrations/{1743252162283-create-releases-table.ts => 1743254857113-create-releases-table.ts} (100%) rename database/migrations/{1743252162301-create-passkeys-table.ts => 1743254857133-create-passkeys-table.ts} (100%) rename database/migrations/{1743252162302-create-users-table.ts => 1743254857133-create-users-table.ts} (100%) rename database/migrations/{1743252162321-create-posts-table.ts => 1743254857153-create-posts-table.ts} (100%) rename database/migrations/{1743252162341-create-categories-table.ts => 1743254857176-create-categories-table.ts} (100%) rename database/migrations/{1743252162360-create-payments-table.ts => 1743254857196-create-payments-table.ts} (100%) rename database/migrations/{1743252162380-create-drivers-table.ts => 1743254857215-create-drivers-table.ts} (100%) rename database/migrations/{1743252162399-create-waitlist_products-table.ts => 1743254857234-create-waitlist_products-table.ts} (100%) rename database/migrations/{1743252162419-create-digital_deliveries-table.ts => 1743254857254-create-digital_deliveries-table.ts} (100%) rename database/migrations/{1743252162438-create-manufacturers-table.ts => 1743254857274-create-manufacturers-table.ts} (100%) rename database/migrations/{1743252162458-create-order_items-table.ts => 1743254857294-create-order_items-table.ts} (100%) rename database/migrations/{1743252162476-create-shipping_zones-table.ts => 1743254857313-create-shipping_zones-table.ts} (100%) rename database/migrations/{1743252162494-create-customers-table.ts => 1743254857331-create-customers-table.ts} (100%) rename database/migrations/{1743252162512-create-products-table.ts => 1743254857348-create-products-table.ts} (100%) rename database/migrations/{1743252162531-create-product_variants-table.ts => 1743254857368-create-product_variants-table.ts} (100%) rename database/migrations/{1743252162550-create-license_keys-table.ts => 1743254857387-create-license_keys-table.ts} (100%) rename database/migrations/{1743252162571-create-waitlist_restaurants-table.ts => 1743254857407-create-waitlist_restaurants-table.ts} (100%) rename database/migrations/{1743252162591-create-reviews-table.ts => 1743254857428-create-reviews-table.ts} (100%) rename database/migrations/{1743252162610-create-product_units-table.ts => 1743254857447-create-product_units-table.ts} (100%) rename database/migrations/{1743252162629-create-gift_cards-table.ts => 1743254857466-create-gift_cards-table.ts} (100%) rename database/migrations/{1743252162649-create-orders-table.ts => 1743254857486-create-orders-table.ts} (100%) rename database/migrations/{1743252162668-create-coupons-table.ts => 1743254857506-create-coupons-table.ts} (100%) rename database/migrations/{1743252162688-create-tax_rates-table.ts => 1743254857525-create-tax_rates-table.ts} (100%) rename database/migrations/{1743252162707-create-print_logs-table.ts => 1743254857544-create-print_logs-table.ts} (92%) rename database/migrations/{1743252162726-create-transactions-table.ts => 1743254857563-create-transactions-table.ts} (100%) rename database/migrations/{1743252162746-create-loyalty_points-table.ts => 1743254857584-create-loyalty_points-table.ts} (100%) rename database/migrations/{1743252162765-create-product_items-table.ts => 1743254857604-create-product_items-table.ts} (100%) rename database/migrations/{1743252162784-create-loyalty_rewards-table.ts => 1743254857628-create-loyalty_rewards-table.ts} (100%) rename database/migrations/{1743252162815-create-shipping_methods-table.ts => 1743254857648-create-shipping_methods-table.ts} (100%) rename database/migrations/{1743252162834-create-shipping_rates-table.ts => 1743254857669-create-shipping_rates-table.ts} (100%) rename database/migrations/{1743252162854-create-delivery_routes-table.ts => 1743254857688-create-delivery_routes-table.ts} (100%) rename database/migrations/{1743252162874-create-failed_jobs-table.ts => 1743254857707-create-failed_jobs-table.ts} (100%) rename database/migrations/{1743252162895-create-payment_methods-table.ts => 1743254857725-create-payment_methods-table.ts} (100%) rename database/migrations/{1743252162913-create-payment_transactions-table.ts => 1743254857744-create-payment_transactions-table.ts} (100%) rename database/migrations/{1743252162932-create-requests-table.ts => 1743254857762-create-requests-table.ts} (100%) rename database/migrations/{1743252162951-create-jobs-table.ts => 1743254857782-create-jobs-table.ts} (100%) rename database/migrations/{1743252162970-create-subscriptions-table.ts => 1743254857801-create-subscriptions-table.ts} (100%) rename database/migrations/{1743252162989-create-payment_products-table.ts => 1743254857821-create-payment_products-table.ts} (100%) rename database/migrations/{1743252163008-create-errors-table.ts => 1743254857840-create-errors-table.ts} (100%) diff --git a/database/migrations/1743252162158-create-projects-table.ts b/database/migrations/1743254856988-create-projects-table.ts similarity index 100% rename from database/migrations/1743252162158-create-projects-table.ts rename to database/migrations/1743254856988-create-projects-table.ts diff --git a/database/migrations/1743252162183-create-subscriber_emails-table.ts b/database/migrations/1743254857011-create-subscriber_emails-table.ts similarity index 100% rename from database/migrations/1743252162183-create-subscriber_emails-table.ts rename to database/migrations/1743254857011-create-subscriber_emails-table.ts diff --git a/database/migrations/1743252162204-create-personal_access_tokens-table.ts b/database/migrations/1743254857032-create-personal_access_tokens-table.ts similarity index 100% rename from database/migrations/1743252162204-create-personal_access_tokens-table.ts rename to database/migrations/1743254857032-create-personal_access_tokens-table.ts diff --git a/database/migrations/1743252162207-create-team_users-table.ts b/database/migrations/1743254857034-create-team_users-table.ts similarity index 100% rename from database/migrations/1743252162207-create-team_users-table.ts rename to database/migrations/1743254857034-create-team_users-table.ts diff --git a/database/migrations/1743252162225-create-teams-table.ts b/database/migrations/1743254857053-create-teams-table.ts similarity index 100% rename from database/migrations/1743252162225-create-teams-table.ts rename to database/migrations/1743254857053-create-teams-table.ts diff --git a/database/migrations/1743252162245-create-subscribers-table.ts b/database/migrations/1743254857073-create-subscribers-table.ts similarity index 100% rename from database/migrations/1743252162245-create-subscribers-table.ts rename to database/migrations/1743254857073-create-subscribers-table.ts diff --git a/database/migrations/1743252162264-create-deployments-table.ts b/database/migrations/1743254857093-create-deployments-table.ts similarity index 100% rename from database/migrations/1743252162264-create-deployments-table.ts rename to database/migrations/1743254857093-create-deployments-table.ts diff --git a/database/migrations/1743252162283-create-releases-table.ts b/database/migrations/1743254857113-create-releases-table.ts similarity index 100% rename from database/migrations/1743252162283-create-releases-table.ts rename to database/migrations/1743254857113-create-releases-table.ts diff --git a/database/migrations/1743252162301-create-passkeys-table.ts b/database/migrations/1743254857133-create-passkeys-table.ts similarity index 100% rename from database/migrations/1743252162301-create-passkeys-table.ts rename to database/migrations/1743254857133-create-passkeys-table.ts diff --git a/database/migrations/1743252162302-create-users-table.ts b/database/migrations/1743254857133-create-users-table.ts similarity index 100% rename from database/migrations/1743252162302-create-users-table.ts rename to database/migrations/1743254857133-create-users-table.ts diff --git a/database/migrations/1743252162321-create-posts-table.ts b/database/migrations/1743254857153-create-posts-table.ts similarity index 100% rename from database/migrations/1743252162321-create-posts-table.ts rename to database/migrations/1743254857153-create-posts-table.ts diff --git a/database/migrations/1743252162341-create-categories-table.ts b/database/migrations/1743254857176-create-categories-table.ts similarity index 100% rename from database/migrations/1743252162341-create-categories-table.ts rename to database/migrations/1743254857176-create-categories-table.ts diff --git a/database/migrations/1743252162360-create-payments-table.ts b/database/migrations/1743254857196-create-payments-table.ts similarity index 100% rename from database/migrations/1743252162360-create-payments-table.ts rename to database/migrations/1743254857196-create-payments-table.ts diff --git a/database/migrations/1743252162380-create-drivers-table.ts b/database/migrations/1743254857215-create-drivers-table.ts similarity index 100% rename from database/migrations/1743252162380-create-drivers-table.ts rename to database/migrations/1743254857215-create-drivers-table.ts diff --git a/database/migrations/1743252162399-create-waitlist_products-table.ts b/database/migrations/1743254857234-create-waitlist_products-table.ts similarity index 100% rename from database/migrations/1743252162399-create-waitlist_products-table.ts rename to database/migrations/1743254857234-create-waitlist_products-table.ts diff --git a/database/migrations/1743252162419-create-digital_deliveries-table.ts b/database/migrations/1743254857254-create-digital_deliveries-table.ts similarity index 100% rename from database/migrations/1743252162419-create-digital_deliveries-table.ts rename to database/migrations/1743254857254-create-digital_deliveries-table.ts diff --git a/database/migrations/1743252162438-create-manufacturers-table.ts b/database/migrations/1743254857274-create-manufacturers-table.ts similarity index 100% rename from database/migrations/1743252162438-create-manufacturers-table.ts rename to database/migrations/1743254857274-create-manufacturers-table.ts diff --git a/database/migrations/1743252162458-create-order_items-table.ts b/database/migrations/1743254857294-create-order_items-table.ts similarity index 100% rename from database/migrations/1743252162458-create-order_items-table.ts rename to database/migrations/1743254857294-create-order_items-table.ts diff --git a/database/migrations/1743252162476-create-shipping_zones-table.ts b/database/migrations/1743254857313-create-shipping_zones-table.ts similarity index 100% rename from database/migrations/1743252162476-create-shipping_zones-table.ts rename to database/migrations/1743254857313-create-shipping_zones-table.ts diff --git a/database/migrations/1743252162494-create-customers-table.ts b/database/migrations/1743254857331-create-customers-table.ts similarity index 100% rename from database/migrations/1743252162494-create-customers-table.ts rename to database/migrations/1743254857331-create-customers-table.ts diff --git a/database/migrations/1743252162512-create-products-table.ts b/database/migrations/1743254857348-create-products-table.ts similarity index 100% rename from database/migrations/1743252162512-create-products-table.ts rename to database/migrations/1743254857348-create-products-table.ts diff --git a/database/migrations/1743252162531-create-product_variants-table.ts b/database/migrations/1743254857368-create-product_variants-table.ts similarity index 100% rename from database/migrations/1743252162531-create-product_variants-table.ts rename to database/migrations/1743254857368-create-product_variants-table.ts diff --git a/database/migrations/1743252162550-create-license_keys-table.ts b/database/migrations/1743254857387-create-license_keys-table.ts similarity index 100% rename from database/migrations/1743252162550-create-license_keys-table.ts rename to database/migrations/1743254857387-create-license_keys-table.ts diff --git a/database/migrations/1743252162571-create-waitlist_restaurants-table.ts b/database/migrations/1743254857407-create-waitlist_restaurants-table.ts similarity index 100% rename from database/migrations/1743252162571-create-waitlist_restaurants-table.ts rename to database/migrations/1743254857407-create-waitlist_restaurants-table.ts diff --git a/database/migrations/1743252162591-create-reviews-table.ts b/database/migrations/1743254857428-create-reviews-table.ts similarity index 100% rename from database/migrations/1743252162591-create-reviews-table.ts rename to database/migrations/1743254857428-create-reviews-table.ts diff --git a/database/migrations/1743252162610-create-product_units-table.ts b/database/migrations/1743254857447-create-product_units-table.ts similarity index 100% rename from database/migrations/1743252162610-create-product_units-table.ts rename to database/migrations/1743254857447-create-product_units-table.ts diff --git a/database/migrations/1743252162629-create-gift_cards-table.ts b/database/migrations/1743254857466-create-gift_cards-table.ts similarity index 100% rename from database/migrations/1743252162629-create-gift_cards-table.ts rename to database/migrations/1743254857466-create-gift_cards-table.ts diff --git a/database/migrations/1743252162649-create-orders-table.ts b/database/migrations/1743254857486-create-orders-table.ts similarity index 100% rename from database/migrations/1743252162649-create-orders-table.ts rename to database/migrations/1743254857486-create-orders-table.ts diff --git a/database/migrations/1743252162668-create-coupons-table.ts b/database/migrations/1743254857506-create-coupons-table.ts similarity index 100% rename from database/migrations/1743252162668-create-coupons-table.ts rename to database/migrations/1743254857506-create-coupons-table.ts diff --git a/database/migrations/1743252162688-create-tax_rates-table.ts b/database/migrations/1743254857525-create-tax_rates-table.ts similarity index 100% rename from database/migrations/1743252162688-create-tax_rates-table.ts rename to database/migrations/1743254857525-create-tax_rates-table.ts diff --git a/database/migrations/1743252162707-create-print_logs-table.ts b/database/migrations/1743254857544-create-print_logs-table.ts similarity index 92% rename from database/migrations/1743252162707-create-print_logs-table.ts rename to database/migrations/1743254857544-create-print_logs-table.ts index 3ff373b0a0..cbb29f4818 100644 --- a/database/migrations/1743252162707-create-print_logs-table.ts +++ b/database/migrations/1743254857544-create-print_logs-table.ts @@ -8,7 +8,7 @@ export async function up(db: Database) { .addColumn('uuid', 'text') .addColumn('printer', 'text', col => col.notNull()) .addColumn('document', 'text', col => col.notNull()) - .addColumn('timestamp', 'text', col => col.notNull()) + .addColumn('timestamp', 'numeric', col => col.notNull()) .addColumn('status', 'text', col => col.notNull()) .addColumn('size', 'numeric') .addColumn('pages', 'numeric') diff --git a/database/migrations/1743252162726-create-transactions-table.ts b/database/migrations/1743254857563-create-transactions-table.ts similarity index 100% rename from database/migrations/1743252162726-create-transactions-table.ts rename to database/migrations/1743254857563-create-transactions-table.ts diff --git a/database/migrations/1743252162746-create-loyalty_points-table.ts b/database/migrations/1743254857584-create-loyalty_points-table.ts similarity index 100% rename from database/migrations/1743252162746-create-loyalty_points-table.ts rename to database/migrations/1743254857584-create-loyalty_points-table.ts diff --git a/database/migrations/1743252162765-create-product_items-table.ts b/database/migrations/1743254857604-create-product_items-table.ts similarity index 100% rename from database/migrations/1743252162765-create-product_items-table.ts rename to database/migrations/1743254857604-create-product_items-table.ts diff --git a/database/migrations/1743252162784-create-loyalty_rewards-table.ts b/database/migrations/1743254857628-create-loyalty_rewards-table.ts similarity index 100% rename from database/migrations/1743252162784-create-loyalty_rewards-table.ts rename to database/migrations/1743254857628-create-loyalty_rewards-table.ts diff --git a/database/migrations/1743252162815-create-shipping_methods-table.ts b/database/migrations/1743254857648-create-shipping_methods-table.ts similarity index 100% rename from database/migrations/1743252162815-create-shipping_methods-table.ts rename to database/migrations/1743254857648-create-shipping_methods-table.ts diff --git a/database/migrations/1743252162834-create-shipping_rates-table.ts b/database/migrations/1743254857669-create-shipping_rates-table.ts similarity index 100% rename from database/migrations/1743252162834-create-shipping_rates-table.ts rename to database/migrations/1743254857669-create-shipping_rates-table.ts diff --git a/database/migrations/1743252162854-create-delivery_routes-table.ts b/database/migrations/1743254857688-create-delivery_routes-table.ts similarity index 100% rename from database/migrations/1743252162854-create-delivery_routes-table.ts rename to database/migrations/1743254857688-create-delivery_routes-table.ts diff --git a/database/migrations/1743252162874-create-failed_jobs-table.ts b/database/migrations/1743254857707-create-failed_jobs-table.ts similarity index 100% rename from database/migrations/1743252162874-create-failed_jobs-table.ts rename to database/migrations/1743254857707-create-failed_jobs-table.ts diff --git a/database/migrations/1743252162895-create-payment_methods-table.ts b/database/migrations/1743254857725-create-payment_methods-table.ts similarity index 100% rename from database/migrations/1743252162895-create-payment_methods-table.ts rename to database/migrations/1743254857725-create-payment_methods-table.ts diff --git a/database/migrations/1743252162913-create-payment_transactions-table.ts b/database/migrations/1743254857744-create-payment_transactions-table.ts similarity index 100% rename from database/migrations/1743252162913-create-payment_transactions-table.ts rename to database/migrations/1743254857744-create-payment_transactions-table.ts diff --git a/database/migrations/1743252162932-create-requests-table.ts b/database/migrations/1743254857762-create-requests-table.ts similarity index 100% rename from database/migrations/1743252162932-create-requests-table.ts rename to database/migrations/1743254857762-create-requests-table.ts diff --git a/database/migrations/1743252162951-create-jobs-table.ts b/database/migrations/1743254857782-create-jobs-table.ts similarity index 100% rename from database/migrations/1743252162951-create-jobs-table.ts rename to database/migrations/1743254857782-create-jobs-table.ts diff --git a/database/migrations/1743252162970-create-subscriptions-table.ts b/database/migrations/1743254857801-create-subscriptions-table.ts similarity index 100% rename from database/migrations/1743252162970-create-subscriptions-table.ts rename to database/migrations/1743254857801-create-subscriptions-table.ts diff --git a/database/migrations/1743252162989-create-payment_products-table.ts b/database/migrations/1743254857821-create-payment_products-table.ts similarity index 100% rename from database/migrations/1743252162989-create-payment_products-table.ts rename to database/migrations/1743254857821-create-payment_products-table.ts diff --git a/database/migrations/1743252163008-create-errors-table.ts b/database/migrations/1743254857840-create-errors-table.ts similarity index 100% rename from database/migrations/1743252163008-create-errors-table.ts rename to database/migrations/1743254857840-create-errors-table.ts diff --git a/storage/framework/core/commerce/src/prints/fetch.ts b/storage/framework/core/commerce/src/prints/fetch.ts index ee83fa99d7..9cdefa54ce 100644 --- a/storage/framework/core/commerce/src/prints/fetch.ts +++ b/storage/framework/core/commerce/src/prints/fetch.ts @@ -18,3 +18,48 @@ export async function fetchById(id: number): Promise { return await db.selectFrom('print_logs').selectAll().execute() } + +/** + * Fetch print job statistics by status within a date range + * + * @param startDate Start date for the range + * @param endDate End date for the range + * @returns Object containing counts for each status and total + */ +export async function fetchPrintJobStats( + startDate: number, + endDate: number, +): Promise<{ + total: number + success: number + failed: number + warning: number + averageSize: number + averagePages: number + averageDuration: number + }> { + const stats = await db + .selectFrom('print_logs') + .where('timestamp', '>=', startDate) + .where('timestamp', '<=', endDate) + .select([ + db.fn.count('id').as('total'), + db.fn.count('id').filterWhere('status', '=', 'success').as('success'), + db.fn.count('id').filterWhere('status', '=', 'failed').as('failed'), + db.fn.count('id').filterWhere('status', '=', 'warning').as('warning'), + db.fn.avg('size').as('averageSize'), + db.fn.avg('pages').as('averagePages'), + db.fn.avg('duration').as('averageDuration'), + ]) + .executeTakeFirst() + + return { + total: stats?.total || 0, + success: stats?.success || 0, + failed: stats?.failed || 0, + warning: stats?.warning || 0, + averageSize: Math.round(stats?.averageSize || 0), + averagePages: Math.round(stats?.averagePages || 0), + averageDuration: Math.round(stats?.averageDuration || 0), + } +} diff --git a/storage/framework/core/commerce/src/prints/store.ts b/storage/framework/core/commerce/src/prints/store.ts index d16ec1f0f4..649b809542 100644 --- a/storage/framework/core/commerce/src/prints/store.ts +++ b/storage/framework/core/commerce/src/prints/store.ts @@ -17,10 +17,10 @@ export async function store(request: PrintLogRequestType): Promise('timestamp'), status: request.get('status'), - size: request.get('size'), - pages: request.get('pages'), + size: request.get('size'), + pages: request.get('pages'), duration: request.get('duration'), } @@ -75,11 +75,11 @@ export async function bulkStore(requests: PrintLogRequestType[]): Promise('timestamp'), status: request.get('status'), - size: request.get('size'), - pages: request.get('pages'), - duration: request.get('duration'), + size: request.get('size'), + pages: request.get('pages'), + duration: request.get('duration'), } printData.uuid = randomUUIDv7() diff --git a/storage/framework/core/commerce/src/prints/update.ts b/storage/framework/core/commerce/src/prints/update.ts index ac1d0b42a1..583ca19e6d 100644 --- a/storage/framework/core/commerce/src/prints/update.ts +++ b/storage/framework/core/commerce/src/prints/update.ts @@ -25,11 +25,11 @@ export async function update(id: number, request: PrintLogRequestType): Promise< const updateData = { printer: request.get('printer'), document: request.get('document'), - timestamp: request.get('timestamp'), + timestamp: request.get('timestamp'), status: request.get('status'), - size: request.get('size'), - pages: request.get('pages'), - duration: request.get('duration'), + size: request.get('size'), + pages: request.get('pages'), + duration: request.get('duration'), updated_at: formatDate(new Date()), } diff --git a/storage/framework/core/commerce/src/tests/prints.test.ts b/storage/framework/core/commerce/src/tests/prints.test.ts index 10f55af2fd..4f09b5b8a1 100644 --- a/storage/framework/core/commerce/src/tests/prints.test.ts +++ b/storage/framework/core/commerce/src/tests/prints.test.ts @@ -3,7 +3,7 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { formatDate } from '@stacksjs/orm' import { refreshDatabase } from '@stacksjs/testing' import { bulkDestroy, destroy } from '../prints/destroy' -import { fetchAll, fetchById } from '../prints/fetch' +import { fetchAll, fetchById, fetchPrintJobStats } from '../prints/fetch' import { bulkStore, store } from '../prints/store' import { update, updatePrintJob, updateStatus } from '../prints/update' @@ -34,7 +34,7 @@ describe('Print Log Module', () => { const requestData = { printer: 'HP LaserJet', document: 'invoice.pdf', - timestamp: formatDate(new Date()), + timestamp: Date.now(), status: 'success', size: 1024, pages: 5, @@ -68,7 +68,7 @@ describe('Print Log Module', () => { const minimalRequestData = { printer: 'Epson Printer', document: 'report.pdf', - timestamp: formatDate(new Date()), + timestamp: Date.now(), status: 'success', } @@ -90,7 +90,7 @@ describe('Print Log Module', () => { new TestRequest({ printer: 'HP LaserJet', document: 'invoice.pdf', - timestamp: formatDate(new Date()), + timestamp: Date.now(), status: 'success', size: 1024, pages: 5, @@ -99,7 +99,7 @@ describe('Print Log Module', () => { new TestRequest({ printer: 'Epson Printer', document: 'report.pdf', - timestamp: formatDate(new Date()), + timestamp: Date.now(), status: 'warning', size: 2048, pages: 10, @@ -108,7 +108,7 @@ describe('Print Log Module', () => { new TestRequest({ printer: 'Canon Printer', document: 'document.pdf', - timestamp: formatDate(new Date()), + timestamp: Date.now(), status: 'failed', size: 512, pages: 2, @@ -136,7 +136,7 @@ describe('Print Log Module', () => { const requestData = { printer: 'HP LaserJet', document: 'invoice.pdf', - timestamp: formatDate(new Date()), + timestamp: Date.now(), status: 'success', size: 1024, pages: 5, @@ -158,7 +158,7 @@ describe('Print Log Module', () => { const updateData = { printer: 'HP LaserJet Pro', document: 'updated_invoice.pdf', - timestamp: formatDate(new Date()), + timestamp: Date.now(), status: 'warning', size: 2048, pages: 10, @@ -184,7 +184,7 @@ describe('Print Log Module', () => { const requestData = { printer: 'HP LaserJet', document: 'invoice.pdf', - timestamp: formatDate(new Date()), + timestamp: Date.now(), status: 'success', size: 1024, pages: 5, @@ -217,7 +217,7 @@ describe('Print Log Module', () => { const requestData = { printer: 'HP LaserJet', document: 'invoice.pdf', - timestamp: formatDate(new Date()), + timestamp: Date.now(), status: 'success', size: 1024, pages: 5, @@ -249,7 +249,7 @@ describe('Print Log Module', () => { const requestData = { printer: 'HP LaserJet', document: 'invoice.pdf', - timestamp: formatDate(new Date()), + timestamp: Date.now(), status: 'success', size: 1024, pages: 5, @@ -294,7 +294,7 @@ describe('Print Log Module', () => { new TestRequest({ printer: 'HP LaserJet', document: 'invoice.pdf', - timestamp: formatDate(new Date()), + timestamp: Date.now(), status: 'success', size: 1024, pages: 5, @@ -303,7 +303,7 @@ describe('Print Log Module', () => { new TestRequest({ printer: 'Epson Printer', document: 'report.pdf', - timestamp: formatDate(new Date()), + timestamp: Date.now(), status: 'warning', size: 2048, pages: 10, @@ -312,7 +312,7 @@ describe('Print Log Module', () => { new TestRequest({ printer: 'Canon Printer', document: 'document.pdf', - timestamp: formatDate(new Date()), + timestamp: Date.now(), status: 'failed', size: 512, pages: 2, @@ -337,7 +337,7 @@ describe('Print Log Module', () => { const requestData = { printer: 'HP LaserJet', document: 'invoice.pdf', - timestamp: formatDate(new Date()), + timestamp: Date.now(), status: 'success', size: 1024, pages: 5, @@ -364,5 +364,140 @@ describe('Print Log Module', () => { expect(fetchedPrint?.pages).toBe(5) expect(fetchedPrint?.duration).toBe(30) }) + + it('should fetch print job statistics within a date range', async () => { + // Create test dates using today + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + // Create test print logs with different statuses and metrics + const requests = [ + new TestRequest({ + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: startDate, + status: 'success', + size: 1024, + pages: 5, + duration: 30, + }), + new TestRequest({ + printer: 'Epson Printer', + document: 'report.pdf', + timestamp: startDate, + status: 'success', + size: 2048, + pages: 10, + duration: 45, + }), + new TestRequest({ + printer: 'Canon Printer', + document: 'document.pdf', + timestamp: startDate, + status: 'warning', + size: 512, + pages: 2, + duration: 15, + }), + new TestRequest({ + printer: 'Brother Printer', + document: 'error.pdf', + timestamp: startDate, + status: 'failed', + size: 256, + pages: 1, + duration: 5, + }), + ] + + // Create the print logs + await bulkStore(requests as any) + + // Fetch statistics + const stats = await fetchPrintJobStats(startDate, endDate) + + // Verify the statistics + expect(stats).toBeDefined() + expect(stats.total).toBe(4) + expect(stats.success).toBe(2) + expect(stats.warning).toBe(1) + expect(stats.failed).toBe(1) + + // Verify averages (rounded) + expect(stats.averageSize).toBe(960) // (1024 + 2048 + 512 + 256) / 4 + expect(stats.averagePages).toBe(5) // (5 + 10 + 2 + 1) / 4 + expect(stats.averageDuration).toBe(24) // (30 + 45 + 15 + 5) / 4 + }) + + it('should return zero statistics when no print logs exist in date range', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + const stats = await fetchPrintJobStats(startDate, endDate) + + expect(stats).toBeDefined() + expect(stats.total).toBe(0) + expect(stats.success).toBe(0) + expect(stats.warning).toBe(0) + expect(stats.failed).toBe(0) + expect(stats.averageSize).toBe(0) + expect(stats.averagePages).toBe(0) + expect(stats.averageDuration).toBe(0) + }) + + it('should only count print logs within the specified date range', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + // Create print logs with different dates + const requests = [ + new TestRequest({ + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: startDate, + status: 'success', + size: 1024, + pages: 5, + duration: 30, + }), + new TestRequest({ + printer: 'Epson Printer', + document: 'report.pdf', + timestamp: startDate - 86400000, // Yesterday + status: 'success', + size: 2048, + pages: 10, + duration: 45, + }), + new TestRequest({ + printer: 'Canon Printer', + document: 'document.pdf', + timestamp: endDate + 1, // Tomorrow + status: 'warning', + size: 512, + pages: 2, + duration: 15, + }), + ] + + // Create the print logs + await bulkStore(requests as any) + + // Fetch statistics + const stats = await fetchPrintJobStats(startDate, endDate) + + // Verify only today's print log is counted + expect(stats).toBeDefined() + expect(stats.total).toBe(1) + expect(stats.success).toBe(1) + expect(stats.warning).toBe(0) + expect(stats.failed).toBe(0) + expect(stats.averageSize).toBe(1024) + expect(stats.averagePages).toBe(5) + expect(stats.averageDuration).toBe(30) + }) }) }) diff --git a/storage/framework/defaults/models/ecommerce/PrintLog.ts b/storage/framework/defaults/models/ecommerce/PrintLog.ts index 103b7804f5..6c2b90123e 100644 --- a/storage/framework/defaults/models/ecommerce/PrintLog.ts +++ b/storage/framework/defaults/models/ecommerce/PrintLog.ts @@ -61,7 +61,7 @@ export default { order: 3, fillable: true, validation: { - rule: schema.date(), + rule: schema.number(), message: { invalid: 'Invalid date format', }, diff --git a/storage/framework/models/PrintLog.ts b/storage/framework/models/PrintLog.ts index 103b7804f5..6c2b90123e 100644 --- a/storage/framework/models/PrintLog.ts +++ b/storage/framework/models/PrintLog.ts @@ -61,7 +61,7 @@ export default { order: 3, fillable: true, validation: { - rule: schema.date(), + rule: schema.number(), message: { invalid: 'Invalid date format', }, diff --git a/storage/framework/orm/src/models/PrintLog.ts b/storage/framework/orm/src/models/PrintLog.ts index f3541a1f56..44aa3c98ca 100644 --- a/storage/framework/orm/src/models/PrintLog.ts +++ b/storage/framework/orm/src/models/PrintLog.ts @@ -11,7 +11,7 @@ export interface PrintLogsTable { id: Generated printer: string document: string - timestamp: Date | string + timestamp: number status: string | string[] size?: number pages?: number @@ -185,7 +185,7 @@ export class PrintLogModel extends BaseOrm { return results.map((modelItem: PrintLogJsonResponse) => new PrintLogModel(modelItem)) } -export async function whereTimestamp(value: Date | string): Promise { +export async function whereTimestamp(value: number): Promise { const query = DB.instance.selectFrom('print_logs').where('timestamp', '=', value) const results: PrintLogJsonResponse = await query.execute() diff --git a/storage/framework/requests/PrintLogRequest.ts b/storage/framework/requests/PrintLogRequest.ts index aef51f20db..c93e19d1e1 100644 --- a/storage/framework/requests/PrintLogRequest.ts +++ b/storage/framework/requests/PrintLogRequest.ts @@ -15,7 +15,7 @@ interface RequestDataPrintLog { id: number printer: string document: string - timestamp: date + timestamp: number status: string[] size: number pages: number @@ -27,7 +27,7 @@ export class PrintLogRequest extends Request implements Pri public id = 1 public printer = '' public document = '' - public timestamp = '' + public timestamp = 0 public status = [] public size = 0 public pages = 0 diff --git a/storage/framework/types/attributes.ts b/storage/framework/types/attributes.ts index a8dcc789e7..f6d956a842 100644 --- a/storage/framework/types/attributes.ts +++ b/storage/framework/types/attributes.ts @@ -132,7 +132,7 @@ export interface Attributes { region: string | string[] printer: string document: string - timestamp: Date | string + timestamp: number size: number pages: number duration: number diff --git a/storage/framework/types/requests.d.ts b/storage/framework/types/requests.d.ts index 9cd68818f0..551ac8567e 100644 --- a/storage/framework/types/requests.d.ts +++ b/storage/framework/types/requests.d.ts @@ -850,7 +850,7 @@ interface RequestDataPrintLog { id: number printer: string document: string - timestamp: date + timestamp: number status: string[] size: number pages: number @@ -865,7 +865,7 @@ export interface PrintLogRequestType extends Request { id: number printer: string document: string - timestamp: date + timestamp: number status: string[] size: number pages: number From bb3a9ef156b7f58e6354167f9fcc017e3764daeb Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Sat, 29 Mar 2025 21:50:58 +0800 Subject: [PATCH 11/78] chore: wip --- .../core/commerce/src/prints/fetch.ts | 46 +++++ .../core/commerce/src/tests/prints.test.ts | 173 +++++++++++++++++- 2 files changed, 218 insertions(+), 1 deletion(-) diff --git a/storage/framework/core/commerce/src/prints/fetch.ts b/storage/framework/core/commerce/src/prints/fetch.ts index 9cdefa54ce..f92e115778 100644 --- a/storage/framework/core/commerce/src/prints/fetch.ts +++ b/storage/framework/core/commerce/src/prints/fetch.ts @@ -63,3 +63,49 @@ export async function fetchPrintJobStats( averageDuration: Math.round(stats?.averageDuration || 0), } } + +/** + * Calculate the success rate percentage for print jobs within a date range + * + * @param startDate Start date for the range + * @param endDate End date for the range + * @returns Object containing success rate percentage and detailed counts + */ +export async function fetchSuccessRate( + startDate: number, + endDate: number, +): Promise<{ + successRate: number + total: number + success: number + failed: number + warning: number + }> { + const stats = await db + .selectFrom('print_logs') + .where('timestamp', '>=', startDate) + .where('timestamp', '<=', endDate) + .select([ + db.fn.count('id').as('total'), + db.fn.count('id').filterWhere('status', '=', 'success').as('success'), + db.fn.count('id').filterWhere('status', '=', 'failed').as('failed'), + db.fn.count('id').filterWhere('status', '=', 'warning').as('warning'), + ]) + .executeTakeFirst() + + const total = stats?.total || 0 + const success = stats?.success || 0 + const failed = stats?.failed || 0 + const warning = stats?.warning || 0 + + // Calculate success rate as percentage of successful jobs vs total jobs + const successRate = total > 0 ? Math.round((success / total) * 100) : 0 + + return { + successRate, + total, + success, + failed, + warning, + } +} diff --git a/storage/framework/core/commerce/src/tests/prints.test.ts b/storage/framework/core/commerce/src/tests/prints.test.ts index 4f09b5b8a1..1b2512ecbd 100644 --- a/storage/framework/core/commerce/src/tests/prints.test.ts +++ b/storage/framework/core/commerce/src/tests/prints.test.ts @@ -3,7 +3,7 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { formatDate } from '@stacksjs/orm' import { refreshDatabase } from '@stacksjs/testing' import { bulkDestroy, destroy } from '../prints/destroy' -import { fetchAll, fetchById, fetchPrintJobStats } from '../prints/fetch' +import { fetchAll, fetchById, fetchPrintJobStats, fetchSuccessRate } from '../prints/fetch' import { bulkStore, store } from '../prints/store' import { update, updatePrintJob, updateStatus } from '../prints/update' @@ -499,5 +499,176 @@ describe('Print Log Module', () => { expect(stats.averagePages).toBe(5) expect(stats.averageDuration).toBe(30) }) + + it('should calculate success rate for print jobs within a date range', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + // Create test print logs with different statuses + const requests = [ + new TestRequest({ + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: startDate, + status: 'success', + size: 1024, + pages: 5, + duration: 30, + }), + new TestRequest({ + printer: 'Epson Printer', + document: 'report.pdf', + timestamp: startDate, + status: 'success', + size: 2048, + pages: 10, + duration: 45, + }), + new TestRequest({ + printer: 'Canon Printer', + document: 'document.pdf', + timestamp: startDate, + status: 'warning', + size: 512, + pages: 2, + duration: 15, + }), + new TestRequest({ + printer: 'Brother Printer', + document: 'error.pdf', + timestamp: startDate, + status: 'failed', + size: 256, + pages: 1, + duration: 5, + }), + ] + + await bulkStore(requests as any) + + // Fetch success rate + const stats = await fetchSuccessRate(startDate, endDate) + + // Verify the statistics + expect(stats).toBeDefined() + expect(stats.total).toBe(4) + expect(stats.success).toBe(2) + expect(stats.warning).toBe(1) + expect(stats.failed).toBe(1) + expect(stats.successRate).toBe(50) // 2 out of 4 jobs were successful + }) + + it('should return 0% success rate when no print jobs exist in date range', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + const stats = await fetchSuccessRate(startDate, endDate) + + expect(stats).toBeDefined() + expect(stats.total).toBe(0) + expect(stats.success).toBe(0) + expect(stats.warning).toBe(0) + expect(stats.failed).toBe(0) + expect(stats.successRate).toBe(0) + }) + + it('should calculate 100% success rate when all jobs are successful', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + // Create test print logs with all successful status + const requests = [ + new TestRequest({ + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: startDate, + status: 'success', + size: 1024, + pages: 5, + duration: 30, + }), + new TestRequest({ + printer: 'Epson Printer', + document: 'report.pdf', + timestamp: startDate, + status: 'success', + size: 2048, + pages: 10, + duration: 45, + }), + new TestRequest({ + printer: 'Canon Printer', + document: 'document.pdf', + timestamp: startDate, + status: 'success', + size: 512, + pages: 2, + duration: 15, + }), + ] + + await bulkStore(requests as any) + + const stats = await fetchSuccessRate(startDate, endDate) + + expect(stats).toBeDefined() + expect(stats.total).toBe(3) + expect(stats.success).toBe(3) + expect(stats.warning).toBe(0) + expect(stats.failed).toBe(0) + expect(stats.successRate).toBe(100) // All jobs were successful + }) + + it('should only count print jobs within the specified date range for success rate', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + // Create print logs with different dates + const requests = [ + new TestRequest({ + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: startDate, + status: 'success', + size: 1024, + pages: 5, + duration: 30, + }), + new TestRequest({ + printer: 'Epson Printer', + document: 'report.pdf', + timestamp: startDate - 86400000, // Yesterday + status: 'failed', + size: 2048, + pages: 10, + duration: 45, + }), + new TestRequest({ + printer: 'Canon Printer', + document: 'document.pdf', + timestamp: endDate + 1, // Tomorrow + status: 'warning', + size: 512, + pages: 2, + duration: 15, + }), + ] + + await bulkStore(requests as any) + + const stats = await fetchSuccessRate(startDate, endDate) + + // Verify only today's print log is counted + expect(stats).toBeDefined() + expect(stats.total).toBe(1) + expect(stats.success).toBe(1) + expect(stats.warning).toBe(0) + expect(stats.failed).toBe(0) + expect(stats.successRate).toBe(100) // Only today's job was successful + }) }) }) From a0d8d61f1b227cc4e266fe1c2ea264cf6cccbdb0 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 29 Mar 2025 10:34:19 -0700 Subject: [PATCH 12/78] chore: wip --- bun.lock | 242 +++++++++--------- .../defaults/components/Dashboard/Sidebar.vue | 2 +- .../printers/{prints => receipts}/index.vue | 4 - .../framework/types/browser-auto-imports.d.ts | 1 - storage/framework/types/dashboard-router.d.ts | 2 +- .../views/dashboard/storage/logs/stacks.log | 4 + 6 files changed, 127 insertions(+), 128 deletions(-) rename storage/framework/defaults/views/dashboard/commerce/printers/{prints => receipts}/index.vue (97%) diff --git a/bun.lock b/bun.lock index 533d89b66b..567e5a77f1 100644 --- a/bun.lock +++ b/bun.lock @@ -12,11 +12,11 @@ }, "storage/framework": { "name": "stacks-framework", - "version": "0.70.18", + "version": "0.70.22", }, "storage/framework/core": { "name": "stacks", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/actions": "workspace:*", "@stacksjs/ai": "workspace:*", @@ -71,7 +71,7 @@ }, "storage/framework/core/actions": { "name": "@stacksjs/actions", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/api": "workspace:*", "@stacksjs/cli": "workspace:*", @@ -95,17 +95,17 @@ }, "storage/framework/core/ai": { "name": "@stacksjs/ai", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { - "@aws-sdk/client-bedrock-runtime": "^3.777.0", - "@aws-sdk/credential-providers": "^3.777.0", + "@aws-sdk/client-bedrock-runtime": "^3.778.0", + "@aws-sdk/credential-providers": "^3.778.0", "@stacksjs/development": "workspace:*", "aws-sdk-client-mock": "^4.1.0", }, }, "storage/framework/core/alias": { "name": "@stacksjs/alias", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", "@stacksjs/path": "workspace:*", @@ -113,14 +113,14 @@ }, "storage/framework/core/analytics": { "name": "@stacksjs/analytics", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", }, }, "storage/framework/core/api": { "name": "@stacksjs/api", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", "@stacksjs/utils": "workspace:*", @@ -130,7 +130,7 @@ }, "storage/framework/core/arrays": { "name": "@stacksjs/arrays", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", "@stacksjs/utils": "workspace:*", @@ -138,7 +138,7 @@ }, "storage/framework/core/auth": { "name": "@stacksjs/auth", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@simplewebauthn/browser": "^13.1.0", "@simplewebauthn/server": "^13.1.1", @@ -152,7 +152,7 @@ }, "storage/framework/core/browser": { "name": "@stacksjs/browser", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", "@stacksjs/utils": "workspace:*", @@ -160,7 +160,7 @@ }, "storage/framework/core/buddy": { "name": "@stacksjs/buddy", - "version": "0.70.18", + "version": "0.70.22", "bin": { "stacks": "dist/cli.js", "stx": "dist/cli.js", @@ -218,7 +218,7 @@ }, "storage/framework/core/build": { "name": "@stacksjs/build", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/cli": "workspace:*", "@stacksjs/development": "workspace:*", @@ -232,42 +232,42 @@ }, "storage/framework/core/bun-create/bud": { "name": "@bun-examples/bud", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "stacks": "workspace:*", }, }, "storage/framework/core/bun-create/buddy": { "name": "@bun-examples/buddy", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "stacks": "workspace:*", }, }, "storage/framework/core/bun-create/stack": { "name": "@bun-examples/stack", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "stacks": "workspace:*", }, }, "storage/framework/core/bun-create/stacks": { "name": "@bun-examples/stacks", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "stacks": "workspace:*", }, }, "storage/framework/core/bun-create/stx": { "name": "@bun-examples/stx", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "stacks": "workspace:*", }, }, "storage/framework/core/cache": { "name": "@stacksjs/cache", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@aws-sdk/client-dynamodb": "^3.777.0", "@stacksjs/config": "workspace:*", @@ -279,7 +279,7 @@ }, "storage/framework/core/calendar": { "name": "@stacksjs/calendar-api", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/browser": "workspace:*", "@stacksjs/development": "workspace:*", @@ -288,7 +288,7 @@ }, "storage/framework/core/chat": { "name": "@stacksjs/chat", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/cli": "workspace:*", "@stacksjs/config": "workspace:*", @@ -299,7 +299,7 @@ }, "storage/framework/core/cli": { "name": "@stacksjs/cli", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@antfu/install-pkg": "^1.0.0", "@clack/core": "^0.4.1", @@ -324,7 +324,7 @@ }, "storage/framework/core/cloud": { "name": "@stacksjs/cloud", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@aws-sdk/client-bedrock": "^3.777.0", "@aws-sdk/client-cloudformation": "^3.777.0", @@ -360,7 +360,7 @@ }, "storage/framework/core/collections": { "name": "@stacksjs/collections", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", "ts-collect": "^0.4.0", @@ -368,7 +368,7 @@ }, "storage/framework/core/commerce": { "name": "@stacksjs/commerce", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "ts-spreadsheets": "^0.2.0", }, @@ -378,7 +378,7 @@ }, "storage/framework/core/components": { "name": "@stacksjs/components", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/notification": "workspace:*", }, @@ -388,7 +388,7 @@ }, "storage/framework/core/components/audio": { "name": "@stacksjs/audio", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -403,7 +403,7 @@ }, "storage/framework/core/components/auth": { "name": "@stacksjs/auths", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -418,7 +418,7 @@ }, "storage/framework/core/components/button": { "name": "@stacksjs/button", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -433,7 +433,7 @@ }, "storage/framework/core/components/calendar": { "name": "@stacksjs/calendar", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -448,7 +448,7 @@ }, "storage/framework/core/components/combobox": { "name": "@stacksjs/combobox", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -465,7 +465,7 @@ }, "storage/framework/core/components/command-palette": { "name": "@stacksjs/command-palette", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/strings": "workspace:*", "@stacksjs/ui": "workspace:*", @@ -483,7 +483,7 @@ }, "storage/framework/core/components/dialog": { "name": "@stacksjs/dialog", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -500,7 +500,7 @@ }, "storage/framework/core/components/drawer": { "name": "@stacksjs/drawer", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -517,7 +517,7 @@ }, "storage/framework/core/components/dropdown": { "name": "@stacksjs/dropdown", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -534,7 +534,7 @@ }, "storage/framework/core/components/image": { "name": "@stacksjs/image", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -549,7 +549,7 @@ }, "storage/framework/core/components/listbox": { "name": "@stacksjs/listbox", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -566,7 +566,7 @@ }, "storage/framework/core/components/navigator": { "name": "@stacksjs/navigator", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -583,7 +583,7 @@ }, "storage/framework/core/components/notification": { "name": "@stacksjs/notification", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -599,7 +599,7 @@ }, "storage/framework/core/components/payment": { "name": "@stacksjs/payment", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -615,7 +615,7 @@ }, "storage/framework/core/components/popover": { "name": "@stacksjs/popover", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -632,7 +632,7 @@ }, "storage/framework/core/components/radio-group": { "name": "@stacksjs/radio-group", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -649,7 +649,7 @@ }, "storage/framework/core/components/select": { "name": "@stacksjs/select", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -664,7 +664,7 @@ }, "storage/framework/core/components/stepper": { "name": "@stacksjs/stepper", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -682,7 +682,7 @@ }, "storage/framework/core/components/switch": { "name": "@stacksjs/switch", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -699,7 +699,7 @@ }, "storage/framework/core/components/table": { "name": "@stacksjs/table", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@vueform/multiselect": "^2.6.11", }, @@ -710,7 +710,7 @@ }, "storage/framework/core/components/transition": { "name": "@stacksjs/transition", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -727,7 +727,7 @@ }, "storage/framework/core/components/video": { "name": "@stacksjs/video", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", @@ -742,7 +742,7 @@ }, "storage/framework/core/config": { "name": "@stacksjs/config", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/alias": "workspace:*", "@stacksjs/development": "workspace:*", @@ -751,7 +751,7 @@ }, "storage/framework/core/cron": { "name": "@stacksjs/cron", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", "croner": "^9.0.0", @@ -759,7 +759,7 @@ }, "storage/framework/core/database": { "name": "@stacksjs/database", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/cli": "workspace:*", "@stacksjs/config": "workspace:*", @@ -782,7 +782,7 @@ }, "storage/framework/core/datetime": { "name": "@stacksjs/datetime", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@formkit/tempo": "^0.1.2", "@stacksjs/development": "workspace:*", @@ -791,7 +791,7 @@ }, "storage/framework/core/desktop": { "name": "@stacksjs/desktop", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/build": "workspace:*", "@stacksjs/development": "workspace:*", @@ -806,7 +806,7 @@ }, "storage/framework/core/development": { "name": "@stacksjs/development", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/alias": "workspace:*", "@stacksjs/build": "workspace:*", @@ -826,7 +826,7 @@ }, "storage/framework/core/dns": { "name": "@stacksjs/dns", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@aws-sdk/client-route-53": "^3.777.0", "@stacksjs/actions": "workspace:*", @@ -842,12 +842,12 @@ }, "storage/framework/core/docs": { "name": "@stacksjs/docs", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@iconify-json/carbon": "^1.2.8", "@shikijs/vitepress-twoslash": "^3.2.1", "@vite-pwa/assets-generator": "^0.2.6", - "@vite-pwa/vitepress": "^0.5.3", + "@vite-pwa/vitepress": "^0.5.4", "unocss": "^66.0.0", "unplugin-icons": "^22.1.0", "unplugin-vue-components": "^28.4.1", @@ -864,7 +864,7 @@ }, "storage/framework/core/email": { "name": "@stacksjs/email", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/cli": "workspace:*", "@stacksjs/config": "workspace:*", @@ -877,14 +877,14 @@ }, "storage/framework/core/enums": { "name": "@stacksjs/enums", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", }, }, "storage/framework/core/env": { "name": "@stacksjs/env", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@dotenvx/dotenvx": "^1.39.0", }, @@ -898,7 +898,7 @@ }, "storage/framework/core/error-handling": { "name": "@stacksjs/error-handling", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/cli": "workspace:*", "@stacksjs/config": "workspace:*", @@ -911,14 +911,14 @@ }, "storage/framework/core/events": { "name": "@stacksjs/events", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", }, }, "storage/framework/core/faker": { "name": "@stacksjs/faker", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@faker-js/faker": "^9.5.1", "@stacksjs/cli": "workspace:*", @@ -928,7 +928,7 @@ }, "storage/framework/core/git": { "name": "@stacksjs/git", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", "bumpp": "^10.1.0", @@ -941,7 +941,7 @@ }, "storage/framework/core/health": { "name": "@stacksjs/health", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", "@stacksjs/notifications": "workspace:*", @@ -949,14 +949,14 @@ }, "storage/framework/core/http": { "name": "@stacksjs/http", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", }, }, "storage/framework/core/lint": { "name": "@stacksjs/lint", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@commitlint/cli": "^19.8.0", "@stacksjs/development": "workspace:*", @@ -968,7 +968,7 @@ }, "storage/framework/core/logging": { "name": "@stacksjs/logging", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/cli": "workspace:*", "@stacksjs/config": "workspace:*", @@ -981,7 +981,7 @@ }, "storage/framework/core/notifications": { "name": "@stacksjs/notifications", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/chat": "workspace:*", "@stacksjs/cli": "workspace:*", @@ -996,7 +996,7 @@ }, "storage/framework/core/objects": { "name": "@stacksjs/objects", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/collections": "workspace:*", "@stacksjs/development": "workspace:*", @@ -1007,7 +1007,7 @@ }, "storage/framework/core/orm": { "name": "@stacksjs/orm", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/build": "workspace:*", "@stacksjs/config": "workspace:*", @@ -1018,14 +1018,14 @@ }, "storage/framework/core/path": { "name": "@stacksjs/path", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", }, }, "storage/framework/core/payments": { "name": "@stacksjs/payments", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/config": "workspace:*", "@stacksjs/development": "workspace:*", @@ -1037,14 +1037,14 @@ }, "storage/framework/core/plugins": { "name": "@stacksjs/slugs", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", }, }, "storage/framework/core/push": { "name": "@stacksjs/push", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/cli": "workspace:*", "@stacksjs/config": "workspace:*", @@ -1054,7 +1054,7 @@ }, "storage/framework/core/query-builder": { "name": "@stacksjs/query-builder", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/database": "workspace:*", "@stacksjs/development": "workspace:*", @@ -1068,14 +1068,14 @@ }, "storage/framework/core/queue": { "name": "@stacksjs/queue", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", }, }, "storage/framework/core/raycast": { "name": "buddy", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@raycast/api": "^1.94.2", "@raycast/utils": "^1.19.1", @@ -1085,21 +1085,21 @@ }, "storage/framework/core/realtime": { "name": "@stacksjs/realtime", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", }, }, "storage/framework/core/registry": { "name": "@stacksjs/registry", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", }, }, "storage/framework/core/repl": { "name": "@stacksjs/repl", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", "@stacksjs/tinker": "workspace:*", @@ -1107,7 +1107,7 @@ }, "storage/framework/core/router": { "name": "@stacksjs/router", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/actions": "workspace:*", "@stacksjs/config": "workspace:*", @@ -1125,7 +1125,7 @@ }, "storage/framework/core/scheduler": { "name": "@stacksjs/scheduler", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/actions": "workspace:*", "@stacksjs/cron": "workspace:*", @@ -1134,7 +1134,7 @@ }, "storage/framework/core/search-engine": { "name": "@stacksjs/search-engine", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@opensearch-project/opensearch": "^3.4.0", "@stacksjs/config": "workspace:*", @@ -1144,7 +1144,7 @@ }, "storage/framework/core/security": { "name": "@stacksjs/security", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/config": "workspace:*", "@stacksjs/development": "workspace:*", @@ -1157,7 +1157,7 @@ }, "storage/framework/core/server": { "name": "@stacksjs/server", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/config": "workspace:*", "@stacksjs/development": "workspace:*", @@ -1170,14 +1170,14 @@ }, "storage/framework/core/shell": { "name": "@stacksjs/shell", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", }, }, "storage/framework/core/slug": { "name": "@stacksjs/slug", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/cli": "workspace:*", "@stacksjs/database": "workspace:*", @@ -1189,7 +1189,7 @@ }, "storage/framework/core/sms": { "name": "@stacksjs/sms", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/cli": "workspace:*", "@stacksjs/config": "workspace:*", @@ -1200,7 +1200,7 @@ }, "storage/framework/core/storage": { "name": "@stacksjs/storage", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@aws-sdk/client-s3": "^3.777.0", "@flystorage/aws-s3": "^1.0.1", @@ -1222,7 +1222,7 @@ }, "storage/framework/core/strings": { "name": "@stacksjs/strings", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/alias": "workspace:*", "@stacksjs/development": "workspace:*", @@ -1234,7 +1234,7 @@ }, "storage/framework/core/testing": { "name": "@stacksjs/testing", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@happy-dom/global-registrator": "^17.4.4", "@stacksjs/config": "workspace:*", @@ -1244,21 +1244,21 @@ }, "storage/framework/core/tinker": { "name": "@stacksjs/tinker", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", }, }, "storage/framework/core/tunnel": { "name": "@stacksjs/tunnel", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", }, }, "storage/framework/core/types": { "name": "@stacksjs/types", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@mdit-vue/plugin-component": "^2.1.3", "@mdit-vue/plugin-frontmatter": "^2.1.3", @@ -1286,14 +1286,14 @@ "vite": "^6.2.3", "vite-plugin-inspect": "^11.0.0", "vite-plugin-pwa": "^0.21.2", - "vite-ssg": "^26.0.0", + "vite-ssg": "^26.1.0", "vitepress": "1.6.3", "vue": "^3.5.13", }, }, "storage/framework/core/ui": { "name": "@stacksjs/ui", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@headlessui/vue": "^1.7.23", "@iconify-json/hugeicons": "^1.2.4", @@ -1318,7 +1318,7 @@ }, "storage/framework/core/utils": { "name": "@stacksjs/utils", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/actions": "workspace:*", "@stacksjs/arrays": "workspace:*", @@ -1358,7 +1358,7 @@ }, "storage/framework/core/validation": { "name": "@stacksjs/validation", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", "@stacksjs/strings": "workspace:*", @@ -1368,7 +1368,7 @@ }, "storage/framework/core/vite-config": { "name": "@stacksjs/vite-config", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@babel/preset-typescript": "latest", "@stacksjs/alias": "workspace:*", @@ -1394,13 +1394,13 @@ "vite-plugin-local": "^0.5.0", "vite-plugin-pages": "^0.32.5", "vite-plugin-pwa": "^0.21.2", - "vite-ssg": "^26.0.0", + "vite-ssg": "^26.1.0", "vite-ssg-sitemap": "^0.8.1 ", }, }, "storage/framework/core/vite-plugin": { "name": "@stacksjs/vite-plugin", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@babel/preset-typescript": "latest", "@stacksjs/alias": "workspace:*", @@ -1424,13 +1424,13 @@ "vite-plugin-inspect": "^11.0.0", "vite-plugin-pages": "^0.32.5", "vite-plugin-pwa": "^0.21.2", - "vite-ssg": "^26.0.0", + "vite-ssg": "^26.1.0", "vite-ssg-sitemap": "^0.8.1", }, }, "storage/framework/core/whois": { "name": "@stacksjs/whois", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", "node-fetch": "^3.3.2", @@ -1439,7 +1439,7 @@ }, "storage/framework/core/x-ray": { "name": "@stacksjs/x-ray", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/desktop": "workspace:*", "@stacksjs/development": "workspace:*", @@ -1448,7 +1448,7 @@ }, "storage/framework/docs": { "name": "stacks-docs", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/alias": "workspace:*", "@stacksjs/cli": "workspace:*", @@ -1464,7 +1464,7 @@ }, "storage/framework/email": { "name": "stacks-email", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/path": "workspace:*", "@vue-email/compiler": "^0.8.14", @@ -1472,28 +1472,28 @@ }, "storage/framework/libs/components/vue": { "name": "@stacksjs/hello-world-vue", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "stacks": "workspace:*", }, }, "storage/framework/libs/components/web": { "name": "@stacksjs/hello-world-elements", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "stacks": "workspace:*", }, }, "storage/framework/libs/functions": { "name": "hello-world-fx", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "stacks": "workspace:*", }, }, "storage/framework/server": { "name": "stacks-server", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/development": "workspace:*", "@stacksjs/logging": "workspace:*", @@ -1505,7 +1505,7 @@ }, "storage/framework/views/dashboard": { "name": "stacks-dashboard", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/desktop": "workspace:*", "@stacksjs/development": "workspace:*", @@ -1515,7 +1515,7 @@ }, "storage/framework/views/desktop": { "name": "stacks-desktop", - "version": "0.70.18", + "version": "0.70.22", "devDependencies": { "@stacksjs/desktop": "workspace:*", "@stacksjs/development": "workspace:*", @@ -1523,11 +1523,11 @@ }, "storage/framework/views/system-tray": { "name": "stacks-system-tray", - "version": "0.70.18", + "version": "0.70.22", }, "storage/framework/views/web": { "name": "stacks-web", - "version": "0.70.18", + "version": "0.70.22", "dependencies": { "@stacksjs/alias": "workspace:*", "@stacksjs/config": "workspace:*", @@ -1565,7 +1565,7 @@ "vite-plugin-pwa": "^0.21.2", "vite-plugin-vue-devtools": "^7.7.2", "vite-plugin-vue-layouts": "^0.11.0", - "vite-ssg": "^26.0.0", + "vite-ssg": "^26.1.0", "vite-ssg-sitemap": "^0.8.1", "vue-tsc": "^2.2.8", }, @@ -1643,7 +1643,7 @@ "@aws-sdk/client-bedrock": ["@aws-sdk/client-bedrock@3.777.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-utf8": "^4.0.0", "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" } }, "sha512-+sJ62DRDxv/92p5RQ1PQm5/4+esyoCZgkD5sxsoGR8SgEMr31Qh0L0+LifvFXsapCS02PYmGzHpDWjSAS6B/Aw=="], - "@aws-sdk/client-bedrock-runtime": ["@aws-sdk/client-bedrock-runtime@3.777.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/eventstream-serde-browser": "^4.0.2", "@smithy/eventstream-serde-config-resolver": "^4.1.0", "@smithy/eventstream-serde-node": "^4.0.2", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-stream": "^4.2.0", "@smithy/util-utf8": "^4.0.0", "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" } }, "sha512-u5fuxmrjMGqHV/3Kl3nNTeqP8sNpvv/TOjHVmuJ7ZgysPywLabh44cGuGdHsMRE5i0WN/qtG510VuGZAcXBy9Q=="], + "@aws-sdk/client-bedrock-runtime": ["@aws-sdk/client-bedrock-runtime@3.778.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/eventstream-serde-browser": "^4.0.2", "@smithy/eventstream-serde-config-resolver": "^4.1.0", "@smithy/eventstream-serde-node": "^4.0.2", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-stream": "^4.2.0", "@smithy/util-utf8": "^4.0.0", "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" } }, "sha512-FCDwxgzx06JE+QotlJY/DHqu2y6MMVQTa+qxhjZHGBsIqEWDr7wy+b/rtOV/pUxoysKyVx+wmvEwj1e0KlTkOg=="], "@aws-sdk/client-cloudformation": ["@aws-sdk/client-cloudformation@3.777.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-utf8": "^4.0.0", "@smithy/util-waiter": "^4.0.3", "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" } }, "sha512-6JhXEeIRNWkXTrohzARxnGXevkC+c4/RONCNhTA2BVcjTa3crTdO13NyddWvL2ExwUOkb1IsElsjd5A2ina7Vg=="], @@ -1695,7 +1695,7 @@ "@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.777.0", "", { "dependencies": { "@aws-sdk/core": "3.775.0", "@aws-sdk/nested-clients": "3.777.0", "@aws-sdk/types": "3.775.0", "@smithy/property-provider": "^4.0.2", "@smithy/types": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-uGCqr47fnthkqwq5luNl2dksgcpHHjSXz2jUra7TXtFOpqvnhOW8qXjoa1ivlkq8qhqlaZwCzPdbcN0lXpmLzQ=="], - "@aws-sdk/credential-providers": ["@aws-sdk/credential-providers@3.777.0", "", { "dependencies": { "@aws-sdk/client-cognito-identity": "3.777.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-cognito-identity": "3.777.0", "@aws-sdk/credential-provider-env": "3.775.0", "@aws-sdk/credential-provider-http": "3.775.0", "@aws-sdk/credential-provider-ini": "3.777.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/credential-provider-process": "3.775.0", "@aws-sdk/credential-provider-sso": "3.777.0", "@aws-sdk/credential-provider-web-identity": "3.777.0", "@aws-sdk/nested-clients": "3.777.0", "@aws-sdk/types": "3.775.0", "@smithy/core": "^3.2.0", "@smithy/credential-provider-imds": "^4.0.2", "@smithy/property-provider": "^4.0.2", "@smithy/types": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-t1UyC1dUa4aph+kFixR0+5naKtDYZEtN2+PrDig4l1IvxJlD5rRRGodcVqi1duQjqfvhBwa7UPiHz5M4eRli7g=="], + "@aws-sdk/credential-providers": ["@aws-sdk/credential-providers@3.778.0", "", { "dependencies": { "@aws-sdk/client-cognito-identity": "3.777.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-cognito-identity": "3.777.0", "@aws-sdk/credential-provider-env": "3.775.0", "@aws-sdk/credential-provider-http": "3.775.0", "@aws-sdk/credential-provider-ini": "3.777.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/credential-provider-process": "3.775.0", "@aws-sdk/credential-provider-sso": "3.777.0", "@aws-sdk/credential-provider-web-identity": "3.777.0", "@aws-sdk/nested-clients": "3.777.0", "@aws-sdk/types": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/credential-provider-imds": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/property-provider": "^4.0.2", "@smithy/types": "^4.2.0", "tslib": "^2.6.2" } }, "sha512-Yy1RSBvoDp/iqGDpmgy5/YnSP2ac9NxTv3wdAjKlqVVStlKWU9nG8MPHZRfy01oPNJ5YWZL9stxHjNKC9hg9eg=="], "@aws-sdk/endpoint-cache": ["@aws-sdk/endpoint-cache@3.723.0", "", { "dependencies": { "mnemonist": "0.38.3", "tslib": "^2.6.2" } }, "sha512-2+a4WXRc+07uiPR+zJiPGKSOWaNJQNqitkks+6Hhm/haTLJqNVTgY2OWDh2PXvwMNpKB+AlGdhE65Oy6NzUgXg=="], @@ -3003,7 +3003,7 @@ "@vite-pwa/assets-generator": ["@vite-pwa/assets-generator@0.2.6", "", { "dependencies": { "cac": "^6.7.14", "colorette": "^2.0.20", "consola": "^3.2.3", "sharp": "^0.32.6", "sharp-ico": "^0.1.5", "unconfig": "^0.3.11" }, "bin": { "pwa-assets-generator": "bin/pwa-assets-generator.mjs" } }, "sha512-kK44dXltvoubEo5B+6tCGjUrOWOE1+dA4DForbFpO1rKy2wSkAVGrs8tyfN6DzTig89/QKyV8XYodgmaKyrYng=="], - "@vite-pwa/vitepress": ["@vite-pwa/vitepress@0.5.3", "", { "peerDependencies": { "@vite-pwa/assets-generator": "^0.2.6", "vite-plugin-pwa": ">=0.20.5 <1" }, "optionalPeers": ["@vite-pwa/assets-generator"] }, "sha512-ZNtBxZhS5Enp66z01gKuovTQzSorIpc6o9FEVwOk7kNivzuc4Q5RB04fcbBI1qqHE67rDmm+XqVQw0nj801gmw=="], + "@vite-pwa/vitepress": ["@vite-pwa/vitepress@0.5.4", "", { "peerDependencies": { "@vite-pwa/assets-generator": "^0.2.6", "vite-plugin-pwa": ">=0.21.2 <1" }, "optionalPeers": ["@vite-pwa/assets-generator"] }, "sha512-g57qwG983WTyQNLnOcDVPQEIeN+QDgK/HdqghmygiUFp3a/MzVvmLXC/EVnPAXxWa8W2g9pZ9lE3EiDGs2HjsA=="], "@vitejs/plugin-vue": ["@vitejs/plugin-vue@5.2.3", "", { "peerDependencies": { "vite": "^5.0.0 || ^6.0.0", "vue": "^3.2.25" } }, "sha512-IYSLEQj4LgZZuoVpdSUCw3dIynTWQgPlaRP6iAvMle4My0HdYwr5g5wQAfwOeHQBmYwEkqF70nRpSilr6PoUDg=="], @@ -5163,7 +5163,7 @@ "vite-plugin-vue-layouts": ["vite-plugin-vue-layouts@0.11.0", "", { "dependencies": { "debug": "^4.3.4", "fast-glob": "^3.3.2" }, "peerDependencies": { "vite": "^4.0.0 || ^5.0.0", "vue": "^3.2.4", "vue-router": "^4.0.11" } }, "sha512-uh6NW7lt+aOXujK4eHfiNbeo55K9OTuB7fnv+5RVc4OBn/cZull6ThXdYH03JzKanUfgt6QZ37NbbtJ0og59qw=="], - "vite-ssg": ["vite-ssg@26.0.0", "", { "dependencies": { "@unhead/dom": "^2.0.2", "@unhead/vue": "^2.0.2", "ansis": "^3.17.0", "cac": "^6.7.14", "html-minifier-terser": "^7.2.0", "html5parser": "^2.0.2", "jsdom": "^26.0.0" }, "peerDependencies": { "beasties": "^0.2.0", "prettier": "^3.3.0", "vite": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0", "vue": "^3.2.10", "vue-router": "^4.0.1" }, "optionalPeers": ["beasties", "prettier", "vue-router"], "bin": { "vite-ssg": "bin/vite-ssg.js" } }, "sha512-sAMc54DA5A+dz4JZC00KAjiTmsGRTWCKOQvDtpj19cSA0yAr26lBzhnONCRWgvJ6S23+nFMXzZvI8TPsa+h0BQ=="], + "vite-ssg": ["vite-ssg@26.1.0", "", { "dependencies": { "@unhead/dom": "^2.0.2", "@unhead/vue": "^2.0.2", "ansis": "^3.17.0", "cac": "^6.7.14", "html-minifier-terser": "^7.2.0", "html5parser": "^2.0.2", "jsdom": "^26.0.0" }, "peerDependencies": { "beasties": "^0.2.0", "prettier": "^3.3.0", "vite": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0", "vue": "^3.2.10", "vue-router": "^4.0.1" }, "optionalPeers": ["beasties", "prettier", "vue-router"], "bin": { "vite-ssg": "bin/vite-ssg.js" } }, "sha512-cNkvC7KzRrDMWZzG63xNe3mPuxYRP/yx2N81EG0o5od5Y0+UvdZyofrG8gPrrHeeSt1B8f5YHeW4rx96ul1p+g=="], "vite-ssg-sitemap": ["vite-ssg-sitemap@0.8.1", "", {}, "sha512-4IjhsnsC+Kcc/3Z4zOie9KIU633oH0lODZHNIjz3vJvw8aZ2SUor2tvcK16VWpMkkmQkU1iAIY04WWm3DzjM1w=="], diff --git a/storage/framework/defaults/components/Dashboard/Sidebar.vue b/storage/framework/defaults/components/Dashboard/Sidebar.vue index cf0af25d6e..543766511e 100644 --- a/storage/framework/defaults/components/Dashboard/Sidebar.vue +++ b/storage/framework/defaults/components/Dashboard/Sidebar.vue @@ -255,7 +255,7 @@ const sectionContent: Record = { text: 'Printers', children: [ { to: '/commerce/printers/devices', icon: 'i-hugeicons-printer', text: 'Devices' }, - { to: '/commerce/printers/prints', icon: 'i-hugeicons-file-02', text: 'Prints' } + { to: '/commerce/printers/receipts', icon: 'i-hugeicons-file-02', text: 'Receipts' } ] } ] diff --git a/storage/framework/defaults/views/dashboard/commerce/printers/prints/index.vue b/storage/framework/defaults/views/dashboard/commerce/printers/receipts/index.vue similarity index 97% rename from storage/framework/defaults/views/dashboard/commerce/printers/prints/index.vue rename to storage/framework/defaults/views/dashboard/commerce/printers/receipts/index.vue index 399851b9c6..dbff6aef6e 100644 --- a/storage/framework/defaults/views/dashboard/commerce/printers/prints/index.vue +++ b/storage/framework/defaults/views/dashboard/commerce/printers/receipts/index.vue @@ -257,8 +257,6 @@ const totalPages = 1105 Document Timestamp Status - Size - Pages Duration Actions @@ -279,8 +277,6 @@ const totalPages = 1105 {{ print.status }} - {{ print.size }} - {{ print.pages }} {{ print.duration }}
diff --git a/storage/framework/types/browser-auto-imports.d.ts b/storage/framework/types/browser-auto-imports.d.ts index 043b3a8d66..5d3f6d0a2e 100644 --- a/storage/framework/types/browser-auto-imports.d.ts +++ b/storage/framework/types/browser-auto-imports.d.ts @@ -536,7 +536,6 @@ declare module 'vue' { readonly extendRef: UnwrapRef readonly format: UnwrapRef readonly formatTimeAgo: UnwrapRef - readonly getActiveHead: UnwrapRef readonly getActivePinia: UnwrapRef readonly getCurrentInstance: UnwrapRef readonly getCurrentScope: UnwrapRef diff --git a/storage/framework/types/dashboard-router.d.ts b/storage/framework/types/dashboard-router.d.ts index ba9f1b4906..ec958f5ba9 100644 --- a/storage/framework/types/dashboard-router.d.ts +++ b/storage/framework/types/dashboard-router.d.ts @@ -54,7 +54,7 @@ declare module 'vue-router/auto-routes' { '/commerce/orders/': RouteRecordInfo<'/commerce/orders/', '/commerce/orders', Record, Record>, '/commerce/payments/': RouteRecordInfo<'/commerce/payments/', '/commerce/payments', Record, Record>, '/commerce/printers/devices/': RouteRecordInfo<'/commerce/printers/devices/', '/commerce/printers/devices', Record, Record>, - '/commerce/printers/prints/': RouteRecordInfo<'/commerce/printers/prints/', '/commerce/printers/prints', Record, Record>, + '/commerce/printers/receipts/': RouteRecordInfo<'/commerce/printers/receipts/', '/commerce/printers/receipts', Record, Record>, '/commerce/products/': RouteRecordInfo<'/commerce/products/', '/commerce/products', Record, Record>, '/commerce/products/detail': RouteRecordInfo<'/commerce/products/detail', '/commerce/products/detail', Record, Record>, '/commerce/reviews/': RouteRecordInfo<'/commerce/reviews/', '/commerce/reviews', Record, Record>, diff --git a/storage/framework/views/dashboard/storage/logs/stacks.log b/storage/framework/views/dashboard/storage/logs/stacks.log index a743e340af..3e5aaaec38 100644 --- a/storage/framework/views/dashboard/storage/logs/stacks.log +++ b/storage/framework/views/dashboard/storage/logs/stacks.log @@ -3,3 +3,7 @@ [2025-03-25T09:30:28.414Z] DEBUG: Using database driver: sqlite [2025-03-25T10:43:07.070Z] DEBUG: Using database driver: sqlite [2025-03-25T13:55:58.870Z] DEBUG: Using database driver: sqlite +[2025-03-29T17:20:59.617Z] DEBUG: Using database driver: sqlite +[2025-03-29T17:20:59.643Z] DEBUG: Using database driver: sqlite +[2025-03-29T17:21:36.402Z] DEBUG: Using database driver: sqlite +[2025-03-29T17:21:36.423Z] DEBUG: Using database driver: sqlite From e04e35a6ce9389de0ff450c4535f41cc97f11e7b Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 29 Mar 2025 23:09:50 -0700 Subject: [PATCH 13/78] chore: wip --- .../defaults/components/Dashboard/Sidebar.vue | 1 + .../views/dashboard/commerce/pos/index.vue | 1025 +++++++++++++++++ storage/framework/types/dashboard-router.d.ts | 1 + 3 files changed, 1027 insertions(+) create mode 100644 storage/framework/defaults/views/dashboard/commerce/pos/index.vue diff --git a/storage/framework/defaults/components/Dashboard/Sidebar.vue b/storage/framework/defaults/components/Dashboard/Sidebar.vue index 543766511e..f9df620916 100644 --- a/storage/framework/defaults/components/Dashboard/Sidebar.vue +++ b/storage/framework/defaults/components/Dashboard/Sidebar.vue @@ -220,6 +220,7 @@ const sectionContent: Record = { commerce: { items: [ { to: '/commerce/dashboard', icon: 'i-hugeicons-dashboard-speed-01', text: 'Dashboard' }, + { to: '/commerce/pos', icon: 'i-hugeicons-shopping-cart-02', text: 'POS' }, { to: '/commerce/customers', icon: 'i-hugeicons-user-account', text: 'Customers' }, { to: '/commerce/orders', icon: 'i-hugeicons-search-list-01', text: 'Orders' }, { diff --git a/storage/framework/defaults/views/dashboard/commerce/pos/index.vue b/storage/framework/defaults/views/dashboard/commerce/pos/index.vue new file mode 100644 index 0000000000..4dbfb512da --- /dev/null +++ b/storage/framework/defaults/views/dashboard/commerce/pos/index.vue @@ -0,0 +1,1025 @@ + + + diff --git a/storage/framework/types/dashboard-router.d.ts b/storage/framework/types/dashboard-router.d.ts index ec958f5ba9..e65d88454c 100644 --- a/storage/framework/types/dashboard-router.d.ts +++ b/storage/framework/types/dashboard-router.d.ts @@ -53,6 +53,7 @@ declare module 'vue-router/auto-routes' { '/commerce/manufacturers/': RouteRecordInfo<'/commerce/manufacturers/', '/commerce/manufacturers', Record, Record>, '/commerce/orders/': RouteRecordInfo<'/commerce/orders/', '/commerce/orders', Record, Record>, '/commerce/payments/': RouteRecordInfo<'/commerce/payments/', '/commerce/payments', Record, Record>, + '/commerce/pos/': RouteRecordInfo<'/commerce/pos/', '/commerce/pos', Record, Record>, '/commerce/printers/devices/': RouteRecordInfo<'/commerce/printers/devices/', '/commerce/printers/devices', Record, Record>, '/commerce/printers/receipts/': RouteRecordInfo<'/commerce/printers/receipts/', '/commerce/printers/receipts', Record, Record>, '/commerce/products/': RouteRecordInfo<'/commerce/products/', '/commerce/products', Record, Record>, From 65ac7c0081725b14aa342fc27a86e4f6668dae81 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 29 Mar 2025 23:11:45 -0700 Subject: [PATCH 14/78] chore(deps): update dependency @vite-pwa/vitepress to v1 (#1329) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- storage/framework/core/docs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/framework/core/docs/package.json b/storage/framework/core/docs/package.json index 9c0b32172b..7857c11f7c 100644 --- a/storage/framework/core/docs/package.json +++ b/storage/framework/core/docs/package.json @@ -37,7 +37,7 @@ "@iconify-json/carbon": "^1.2.8", "@shikijs/vitepress-twoslash": "^3.2.1", "@vite-pwa/assets-generator": "^0.2.6", - "@vite-pwa/vitepress": "^0.5.4", + "@vite-pwa/vitepress": "^1.0.0", "unocss": "^66.0.0", "unplugin-icons": "^22.1.0", "unplugin-vue-components": "^28.4.1", From 46fcdaaecc6a3002570b096aff625512bedeb692 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 29 Mar 2025 23:11:57 -0700 Subject: [PATCH 15/78] chore(deps): update devdependency vite-plugin-pwa to v1 (#1328) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- storage/framework/core/docs/package.json | 2 +- storage/framework/core/types/package.json | 2 +- storage/framework/core/vite-config/package.json | 2 +- storage/framework/core/vite-plugin/package.json | 2 +- storage/framework/views/web/package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/storage/framework/core/docs/package.json b/storage/framework/core/docs/package.json index 7857c11f7c..3b756db0c3 100644 --- a/storage/framework/core/docs/package.json +++ b/storage/framework/core/docs/package.json @@ -41,7 +41,7 @@ "unocss": "^66.0.0", "unplugin-icons": "^22.1.0", "unplugin-vue-components": "^28.4.1", - "vite-plugin-pwa": "^0.21.2", + "vite-plugin-pwa": "^1.0.0", "vitepress": "1.6.3" }, "devDependencies": { diff --git a/storage/framework/core/types/package.json b/storage/framework/core/types/package.json index 8d12c1e6c3..74999a61f7 100644 --- a/storage/framework/core/types/package.json +++ b/storage/framework/core/types/package.json @@ -69,7 +69,7 @@ "unplugin-vue-components": "^28.4.1", "vite": "^6.2.3", "vite-plugin-inspect": "^11.0.0", - "vite-plugin-pwa": "^0.21.2", + "vite-plugin-pwa": "^1.0.0", "vite-ssg": "^26.1.0", "vitepress": "1.6.3", "vue": "^3.5.13" diff --git a/storage/framework/core/vite-config/package.json b/storage/framework/core/vite-config/package.json index ad9cc140a5..b1cc90bf9a 100644 --- a/storage/framework/core/vite-config/package.json +++ b/storage/framework/core/vite-config/package.json @@ -95,7 +95,7 @@ "vite-plugin-inspect": "^11.0.0", "vite-plugin-local": "^0.5.0", "vite-plugin-pages": "^0.32.5", - "vite-plugin-pwa": "^0.21.2", + "vite-plugin-pwa": "^1.0.0", "vite-ssg": "^26.1.0", "vite-ssg-sitemap": "^0.8.1 " } diff --git a/storage/framework/core/vite-plugin/package.json b/storage/framework/core/vite-plugin/package.json index 8abe765e0c..695781c335 100644 --- a/storage/framework/core/vite-plugin/package.json +++ b/storage/framework/core/vite-plugin/package.json @@ -100,7 +100,7 @@ "vite-plugin-full-reload": "^1.2.0", "vite-plugin-inspect": "^11.0.0", "vite-plugin-pages": "^0.32.5", - "vite-plugin-pwa": "^0.21.2", + "vite-plugin-pwa": "^1.0.0", "vite-ssg": "^26.1.0", "vite-ssg-sitemap": "^0.8.1" } diff --git a/storage/framework/views/web/package.json b/storage/framework/views/web/package.json index fd4bf1e447..becf86e05e 100644 --- a/storage/framework/views/web/package.json +++ b/storage/framework/views/web/package.json @@ -45,7 +45,7 @@ "vite": "^6.2.3", "vite-bundle-visualizer": "^1.2.1", "vite-plugin-inspect": "^11.0.0", - "vite-plugin-pwa": "^0.21.2", + "vite-plugin-pwa": "^1.0.0", "vite-plugin-vue-devtools": "^7.7.2", "vite-plugin-vue-layouts": "^0.11.0", "vite-ssg": "^26.1.0", From 16ce2a85f39606e058f6360df03710cc80c501fe Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 29 Mar 2025 23:12:56 -0700 Subject: [PATCH 16/78] chore(deps): update dependency @vite-pwa/assets-generator to v1 (#1327) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- storage/framework/core/docs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/framework/core/docs/package.json b/storage/framework/core/docs/package.json index 3b756db0c3..ef55a9306f 100644 --- a/storage/framework/core/docs/package.json +++ b/storage/framework/core/docs/package.json @@ -36,7 +36,7 @@ "dependencies": { "@iconify-json/carbon": "^1.2.8", "@shikijs/vitepress-twoslash": "^3.2.1", - "@vite-pwa/assets-generator": "^0.2.6", + "@vite-pwa/assets-generator": "^1.0.0", "@vite-pwa/vitepress": "^1.0.0", "unocss": "^66.0.0", "unplugin-icons": "^22.1.0", From e1743ccd005b73f15bd1f9bf866d6184616819d1 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 29 Mar 2025 23:19:58 -0700 Subject: [PATCH 17/78] chore: wip --- bun.lock | 74 +++++++++++++------ resources/layouts/README.md | 2 +- storage/framework/core/tsconfig.json | 1 - storage/framework/core/vite-config/build.ts | 1 - .../framework/core/vite-config/package.json | 1 - storage/framework/core/vite-plugin/build.ts | 1 - .../framework/core/vite-plugin/package.json | 1 - storage/framework/defaults/layouts/README.md | 2 +- storage/framework/server/tsconfig.docker.json | 1 - 9 files changed, 55 insertions(+), 29 deletions(-) diff --git a/bun.lock b/bun.lock index 567e5a77f1..719277cffd 100644 --- a/bun.lock +++ b/bun.lock @@ -846,12 +846,12 @@ "dependencies": { "@iconify-json/carbon": "^1.2.8", "@shikijs/vitepress-twoslash": "^3.2.1", - "@vite-pwa/assets-generator": "^0.2.6", - "@vite-pwa/vitepress": "^0.5.4", + "@vite-pwa/assets-generator": "^1.0.0", + "@vite-pwa/vitepress": "^1.0.0", "unocss": "^66.0.0", "unplugin-icons": "^22.1.0", "unplugin-vue-components": "^28.4.1", - "vite-plugin-pwa": "^0.21.2", + "vite-plugin-pwa": "^1.0.0", "vitepress": "1.6.3", }, "devDependencies": { @@ -1285,7 +1285,7 @@ "unplugin-vue-components": "^28.4.1", "vite": "^6.2.3", "vite-plugin-inspect": "^11.0.0", - "vite-plugin-pwa": "^0.21.2", + "vite-plugin-pwa": "^1.0.0", "vite-ssg": "^26.1.0", "vitepress": "1.6.3", "vue": "^3.5.13", @@ -1392,8 +1392,7 @@ "vite-plugin-full-reload": "^1.2.0", "vite-plugin-inspect": "^11.0.0", "vite-plugin-local": "^0.5.0", - "vite-plugin-pages": "^0.32.5", - "vite-plugin-pwa": "^0.21.2", + "vite-plugin-pwa": "^1.0.0", "vite-ssg": "^26.1.0", "vite-ssg-sitemap": "^0.8.1 ", }, @@ -1422,8 +1421,7 @@ "vite": "^6.2.3", "vite-plugin-full-reload": "^1.2.0", "vite-plugin-inspect": "^11.0.0", - "vite-plugin-pages": "^0.32.5", - "vite-plugin-pwa": "^0.21.2", + "vite-plugin-pwa": "^1.0.0", "vite-ssg": "^26.1.0", "vite-ssg-sitemap": "^0.8.1", }, @@ -1562,7 +1560,7 @@ "vite": "^6.2.3", "vite-bundle-visualizer": "^1.2.1", "vite-plugin-inspect": "^11.0.0", - "vite-plugin-pwa": "^0.21.2", + "vite-plugin-pwa": "^1.0.0", "vite-plugin-vue-devtools": "^7.7.2", "vite-plugin-vue-layouts": "^0.11.0", "vite-ssg": "^26.1.0", @@ -2149,6 +2147,44 @@ "@iconify/utils": ["@iconify/utils@2.3.0", "", { "dependencies": { "@antfu/install-pkg": "^1.0.0", "@antfu/utils": "^8.1.0", "@iconify/types": "^2.0.0", "debug": "^4.4.0", "globals": "^15.14.0", "kolorist": "^1.8.0", "local-pkg": "^1.0.0", "mlly": "^1.7.4" } }, "sha512-GmQ78prtwYW6EtzXRU1rY+KwOKfz32PD7iJh6Iyqw68GiKuoZ2A6pRtzWONz5VQJbp50mEjXh/7NkumtrAgRKA=="], + "@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.0.4" }, "os": "darwin", "cpu": "arm64" }, "sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ=="], + + "@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.0.4" }, "os": "darwin", "cpu": "x64" }, "sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q=="], + + "@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.0.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg=="], + + "@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.0.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ=="], + + "@img/sharp-libvips-linux-arm": ["@img/sharp-libvips-linux-arm@1.0.5", "", { "os": "linux", "cpu": "arm" }, "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g=="], + + "@img/sharp-libvips-linux-arm64": ["@img/sharp-libvips-linux-arm64@1.0.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA=="], + + "@img/sharp-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.0.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA=="], + + "@img/sharp-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.0.4", "", { "os": "linux", "cpu": "x64" }, "sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw=="], + + "@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.0.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA=="], + + "@img/sharp-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.0.4", "", { "os": "linux", "cpu": "x64" }, "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw=="], + + "@img/sharp-linux-arm": ["@img/sharp-linux-arm@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.0.5" }, "os": "linux", "cpu": "arm" }, "sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ=="], + + "@img/sharp-linux-arm64": ["@img/sharp-linux-arm64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.0.4" }, "os": "linux", "cpu": "arm64" }, "sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA=="], + + "@img/sharp-linux-s390x": ["@img/sharp-linux-s390x@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.0.4" }, "os": "linux", "cpu": "s390x" }, "sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q=="], + + "@img/sharp-linux-x64": ["@img/sharp-linux-x64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.0.4" }, "os": "linux", "cpu": "x64" }, "sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA=="], + + "@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.0.4" }, "os": "linux", "cpu": "arm64" }, "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g=="], + + "@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.0.4" }, "os": "linux", "cpu": "x64" }, "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw=="], + + "@img/sharp-wasm32": ["@img/sharp-wasm32@0.33.5", "", { "dependencies": { "@emnapi/runtime": "^1.2.0" }, "cpu": "none" }, "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg=="], + + "@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.33.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ=="], + + "@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.33.5", "", { "os": "win32", "cpu": "x64" }, "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg=="], + "@inquirer/checkbox": ["@inquirer/checkbox@4.1.4", "", { "dependencies": { "@inquirer/core": "^10.1.9", "@inquirer/figures": "^1.0.11", "@inquirer/type": "^3.0.5", "ansi-escapes": "^4.3.2", "yoctocolors-cjs": "^2.1.2" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-d30576EZdApjAMceijXA5jDzRQHT/MygbC+J8I7EqA6f/FRpYxlRtRJbHF8gHeWYeSdOuTEJqonn7QLB1ELezA=="], "@inquirer/confirm": ["@inquirer/confirm@5.1.8", "", { "dependencies": { "@inquirer/core": "^10.1.9", "@inquirer/type": "^3.0.5" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-dNLWCYZvXDjO3rnQfk2iuJNL4Ivwz/T2+C3+WnNfJKsNGSuOs3wAo2F6e0p946gtSAk31nZMfW+MRmYaplPKsg=="], @@ -3001,9 +3037,9 @@ "@vinejs/vine": ["@vinejs/vine@3.0.1", "", { "dependencies": { "@poppinss/macroable": "^1.0.4", "@types/validator": "^13.12.2", "@vinejs/compiler": "^3.0.0", "camelcase": "^8.0.0", "dayjs": "^1.11.13", "dlv": "^1.1.3", "normalize-url": "^8.0.1", "validator": "^13.12.0" } }, "sha512-ZtvYkYpZOYdvbws3uaOAvTFuvFXoQGAtmzeiXu+XSMGxi5GVsODpoI9Xu9TplEMuD/5fmAtBbKb9cQHkWkLXDQ=="], - "@vite-pwa/assets-generator": ["@vite-pwa/assets-generator@0.2.6", "", { "dependencies": { "cac": "^6.7.14", "colorette": "^2.0.20", "consola": "^3.2.3", "sharp": "^0.32.6", "sharp-ico": "^0.1.5", "unconfig": "^0.3.11" }, "bin": { "pwa-assets-generator": "bin/pwa-assets-generator.mjs" } }, "sha512-kK44dXltvoubEo5B+6tCGjUrOWOE1+dA4DForbFpO1rKy2wSkAVGrs8tyfN6DzTig89/QKyV8XYodgmaKyrYng=="], + "@vite-pwa/assets-generator": ["@vite-pwa/assets-generator@1.0.0", "", { "dependencies": { "cac": "^6.7.14", "colorette": "^2.0.20", "consola": "^3.4.2", "sharp": "^0.33.5", "sharp-ico": "^0.1.5", "unconfig": "^7.3.1" }, "bin": { "pwa-assets-generator": "bin/pwa-assets-generator.mjs" } }, "sha512-tWRF/tsqGkND5+dDVnJz7DzQkIRjtTRRYvA3y6l4FwTwK47OK72p1X7ResSz6T7PimIZMuFd+arsB8NRIG+Sww=="], - "@vite-pwa/vitepress": ["@vite-pwa/vitepress@0.5.4", "", { "peerDependencies": { "@vite-pwa/assets-generator": "^0.2.6", "vite-plugin-pwa": ">=0.21.2 <1" }, "optionalPeers": ["@vite-pwa/assets-generator"] }, "sha512-g57qwG983WTyQNLnOcDVPQEIeN+QDgK/HdqghmygiUFp3a/MzVvmLXC/EVnPAXxWa8W2g9pZ9lE3EiDGs2HjsA=="], + "@vite-pwa/vitepress": ["@vite-pwa/vitepress@1.0.0", "", { "peerDependencies": { "@vite-pwa/assets-generator": "^1.0.0", "vite-plugin-pwa": "^1.0.0" }, "optionalPeers": ["@vite-pwa/assets-generator"] }, "sha512-i5RFah4urA6tZycYlGyBslVx8cVzbZBcARJLDg5rWMfAkRmyLtpRU6usGfVOwyN9kjJ2Bkm+gBHXF1hhr7HptQ=="], "@vitejs/plugin-vue": ["@vitejs/plugin-vue@5.2.3", "", { "peerDependencies": { "vite": "^5.0.0 || ^6.0.0", "vue": "^3.2.25" } }, "sha512-IYSLEQj4LgZZuoVpdSUCw3dIynTWQgPlaRP6iAvMle4My0HdYwr5g5wQAfwOeHQBmYwEkqF70nRpSilr6PoUDg=="], @@ -3693,8 +3729,6 @@ "esprima": ["esprima@4.0.1", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="], - "esprima-extract-comments": ["esprima-extract-comments@1.1.0", "", { "dependencies": { "esprima": "^4.0.0" } }, "sha512-sBQUnvJwpeE9QnPrxh7dpI/dp67erYG4WXEAreAMoelPRpMR7NWb4YtwRPn9b+H1uLQKl/qS8WYmyaljTpjIsw=="], - "esquery": ["esquery@1.6.0", "", { "dependencies": { "estraverse": "^5.1.0" } }, "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg=="], "esrecurse": ["esrecurse@4.3.0", "", { "dependencies": { "estraverse": "^5.2.0" } }, "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag=="], @@ -3727,8 +3761,6 @@ "external-editor": ["external-editor@3.1.0", "", { "dependencies": { "chardet": "^0.7.0", "iconv-lite": "^0.4.24", "tmp": "^0.0.33" } }, "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew=="], - "extract-comments": ["extract-comments@1.1.0", "", { "dependencies": { "esprima-extract-comments": "^1.1.0", "parse-code-context": "^1.0.0" } }, "sha512-dzbZV2AdSSVW/4E7Ti5hZdHWbA+Z80RJsJhr5uiL10oyjl/gy7/o+HI1HwK4/WSZhlq4SNKU3oUzXlM13Qx02Q=="], - "fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="], "fast-fifo": ["fast-fifo@1.3.2", "", {}, "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ=="], @@ -4471,8 +4503,6 @@ "parent-module": ["parent-module@1.0.1", "", { "dependencies": { "callsites": "^3.0.0" } }, "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g=="], - "parse-code-context": ["parse-code-context@1.0.0", "", {}, "sha512-OZQaqKaQnR21iqhlnPfVisFjBWjhnMl5J9MgbP8xC+EwoVqbXrq78lp+9Zb3ahmLzrIX5Us/qbvBnaS3hkH6OA=="], - "parse-gitignore": ["parse-gitignore@2.0.0", "", {}, "sha512-RmVuCHWsfu0QPNW+mraxh/xjQVw/lhUCUru8Zni3Ctq3AoMhpDTq0OVdKS6iesd6Kqb7viCV3isAL43dciOSog=="], "parse-imports": ["parse-imports@2.2.1", "", { "dependencies": { "es-module-lexer": "^1.5.3", "slashes": "^3.0.12" } }, "sha512-OL/zLggRp8mFhKL0rNORUTR4yBYujK/uU+xZL+/0Rgm2QE4nLO9v8PzEweSJEbMGKmDRjJE4R3IMJlL2di4JeQ=="], @@ -4787,7 +4817,7 @@ "set-proto": ["set-proto@1.0.0", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0" } }, "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw=="], - "sharp": ["sharp@0.32.6", "", { "dependencies": { "color": "^4.2.3", "detect-libc": "^2.0.2", "node-addon-api": "^6.1.0", "prebuild-install": "^7.1.1", "semver": "^7.5.4", "simple-get": "^4.0.1", "tar-fs": "^3.0.4", "tunnel-agent": "^0.6.0" } }, "sha512-KyLTWwgcR9Oe4d9HwCwNM2l7+J0dUQwn/yf7S0EnTtb0eVS4RxO0eUSvxPtzT4F3SY+C4K6fqdv/DO27sJ/v/w=="], + "sharp": ["sharp@0.33.5", "", { "dependencies": { "color": "^4.2.3", "detect-libc": "^2.0.3", "semver": "^7.6.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.33.5", "@img/sharp-darwin-x64": "0.33.5", "@img/sharp-libvips-darwin-arm64": "1.0.4", "@img/sharp-libvips-darwin-x64": "1.0.4", "@img/sharp-libvips-linux-arm": "1.0.5", "@img/sharp-libvips-linux-arm64": "1.0.4", "@img/sharp-libvips-linux-s390x": "1.0.4", "@img/sharp-libvips-linux-x64": "1.0.4", "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", "@img/sharp-libvips-linuxmusl-x64": "1.0.4", "@img/sharp-linux-arm": "0.33.5", "@img/sharp-linux-arm64": "0.33.5", "@img/sharp-linux-s390x": "0.33.5", "@img/sharp-linux-x64": "0.33.5", "@img/sharp-linuxmusl-arm64": "0.33.5", "@img/sharp-linuxmusl-x64": "0.33.5", "@img/sharp-wasm32": "0.33.5", "@img/sharp-win32-ia32": "0.33.5", "@img/sharp-win32-x64": "0.33.5" } }, "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw=="], "sharp-ico": ["sharp-ico@0.1.5", "", { "dependencies": { "decode-ico": "*", "ico-endec": "*", "sharp": "*" } }, "sha512-a3jODQl82NPp1d5OYb0wY+oFaPk7AvyxipIowCHk7pBsZCWgbe0yAkU2OOXdoH0ENyANhyOQbs9xkAiRHcF02Q=="], @@ -5153,9 +5183,7 @@ "vite-plugin-local": ["vite-plugin-local@0.5.0", "", {}, "sha512-fY33ZzFnAQT+2s+U885YokrW9yfME0gD9pePAofko5cVFNY8FVeowlSxpNZOeQrilCfTEF3wYLObPUgPZAzMpg=="], - "vite-plugin-pages": ["vite-plugin-pages@0.32.5", "", { "dependencies": { "@types/debug": "^4.1.12", "debug": "^4.4.0", "dequal": "^2.0.3", "extract-comments": "^1.1.0", "fast-glob": "^3.3.3", "json5": "^2.2.3", "local-pkg": "^1.0.0", "picocolors": "^1.1.1", "yaml": "^2.7.0" }, "peerDependencies": { "@vue/compiler-sfc": "^2.7.0 || ^3.0.0", "vite": "^2.0.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0 || ^6.0.0" }, "optionalPeers": ["@vue/compiler-sfc"] }, "sha512-GY2JAt+4vZ4BqTtw+4CSUxPgYiqamrMRIzYk2AtJvQHeBoMlctsQW+tgCpKriUKINiKfi6NegbP07r1XrdxTWA=="], - - "vite-plugin-pwa": ["vite-plugin-pwa@0.21.2", "", { "dependencies": { "debug": "^4.3.6", "pretty-bytes": "^6.1.1", "tinyglobby": "^0.2.10", "workbox-build": "^7.3.0", "workbox-window": "^7.3.0" }, "peerDependencies": { "@vite-pwa/assets-generator": "^0.2.6", "vite": "^3.1.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" }, "optionalPeers": ["@vite-pwa/assets-generator"] }, "sha512-vFhH6Waw8itNu37hWUJxL50q+CBbNcMVzsKaYHQVrfxTt3ihk3PeLO22SbiP1UNWzcEPaTQv+YVxe4G0KOjAkg=="], + "vite-plugin-pwa": ["vite-plugin-pwa@1.0.0", "", { "dependencies": { "debug": "^4.3.6", "pretty-bytes": "^6.1.1", "tinyglobby": "^0.2.10", "workbox-build": "^7.3.0", "workbox-window": "^7.3.0" }, "peerDependencies": { "@vite-pwa/assets-generator": "^1.0.0", "vite": "^3.1.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" }, "optionalPeers": ["@vite-pwa/assets-generator"] }, "sha512-X77jo0AOd5OcxmWj3WnVti8n7Kw2tBgV1c8MCXFclrSlDV23ePzv2eTDIALXI2Qo6nJ5pZJeZAuX0AawvRfoeA=="], "vite-plugin-vue-devtools": ["vite-plugin-vue-devtools@7.7.2", "", { "dependencies": { "@vue/devtools-core": "^7.7.2", "@vue/devtools-kit": "^7.7.2", "@vue/devtools-shared": "^7.7.2", "execa": "^9.5.1", "sirv": "^3.0.0", "vite-plugin-inspect": "0.8.9", "vite-plugin-vue-inspector": "^5.3.1" }, "peerDependencies": { "vite": "^3.1.0 || ^4.0.0-0 || ^5.0.0-0 || ^6.0.0-0" } }, "sha512-5V0UijQWiSBj32blkyPEqIbzc6HO9c1bwnBhx+ay2dzU0FakH+qMdNUT8nF9BvDE+i6I1U8CqCuJiO20vKEdQw=="], @@ -5819,6 +5847,8 @@ "sharp/semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], + "sharp-ico/sharp": ["sharp@0.32.6", "", { "dependencies": { "color": "^4.2.3", "detect-libc": "^2.0.2", "node-addon-api": "^6.1.0", "prebuild-install": "^7.1.1", "semver": "^7.5.4", "simple-get": "^4.0.1", "tar-fs": "^3.0.4", "tunnel-agent": "^0.6.0" } }, "sha512-KyLTWwgcR9Oe4d9HwCwNM2l7+J0dUQwn/yf7S0EnTtb0eVS4RxO0eUSvxPtzT4F3SY+C4K6fqdv/DO27sJ/v/w=="], + "shiki/@shikijs/core": ["@shikijs/core@3.2.1", "", { "dependencies": { "@shikijs/types": "3.2.1", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.5" } }, "sha512-FhsdxMWYu/C11sFisEp7FMGBtX/OSSbnXZDMBhGuUDBNTdsoZlMSgQv5f90rwvzWAdWIW6VobD+G3IrazxA6dQ=="], "shiki/@shikijs/types": ["@shikijs/types@3.2.1", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-/NTWAk4KE2M8uac0RhOsIhYQf4pdU0OywQuYDGIGAJ6Mjunxl2cGiuLkvu4HLCMn+OTTLRWkjZITp+aYJv60yA=="], @@ -6459,6 +6489,8 @@ "semver/lru-cache/yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="], + "sharp-ico/sharp/semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], + "string-width-cjs/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], "sucrase/glob/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="], diff --git a/resources/layouts/README.md b/resources/layouts/README.md index 57887d7511..3824ced03a 100644 --- a/resources/layouts/README.md +++ b/resources/layouts/README.md @@ -4,7 +4,7 @@ Vue components in this dir are used as layouts. By default, `default.stx` will be used unless an alternative is specified in the route meta. -With [`vite-plugin-pages`](https://github.com/hannoeru/vite-plugin-pages) and [`vite-plugin-vue-layouts`](https://github.com/johncampionjr/vite-plugin-vue-layouts), you can specify the layout in the page's SFCs like this: +With [`unplugin-vue-router`](https://github.com/posva/unplugin-vue-router) and [`vite-plugin-layouts`](https://github.com/stacksjs/vite-plugin-layouts), you can specify the layout in the page's SFCs like this: ```html diff --git a/storage/framework/core/tsconfig.json b/storage/framework/core/tsconfig.json index e49df264c3..785edcfd60 100644 --- a/storage/framework/core/tsconfig.json +++ b/storage/framework/core/tsconfig.json @@ -28,7 +28,6 @@ "bun", "vite/client", // "vue/ref-macros", - "vite-plugin-pages/client", "vite-plugin-pwa/client", "vite-plugin-vue-layouts/client", "@intlify/unplugin-vue-i18n/messages", diff --git a/storage/framework/core/vite-config/build.ts b/storage/framework/core/vite-config/build.ts index 8fadc3f76e..b089a91301 100644 --- a/storage/framework/core/vite-config/build.ts +++ b/storage/framework/core/vite-config/build.ts @@ -38,7 +38,6 @@ const result = await Bun.build({ 'vite-ssg-sitemap', 'vitepress', 'vite-plugin-pwa', - 'vite-plugin-pages', 'vite-plugin-vue-devtools', 'unocss', '@vitejs/plugin-vue', diff --git a/storage/framework/core/vite-config/package.json b/storage/framework/core/vite-config/package.json index b1cc90bf9a..4ffbc084b2 100644 --- a/storage/framework/core/vite-config/package.json +++ b/storage/framework/core/vite-config/package.json @@ -94,7 +94,6 @@ "vite-plugin-full-reload": "^1.2.0", "vite-plugin-inspect": "^11.0.0", "vite-plugin-local": "^0.5.0", - "vite-plugin-pages": "^0.32.5", "vite-plugin-pwa": "^1.0.0", "vite-ssg": "^26.1.0", "vite-ssg-sitemap": "^0.8.1 " diff --git a/storage/framework/core/vite-plugin/build.ts b/storage/framework/core/vite-plugin/build.ts index 6ed0c8fb7b..fbd2fd9eb5 100644 --- a/storage/framework/core/vite-plugin/build.ts +++ b/storage/framework/core/vite-plugin/build.ts @@ -37,7 +37,6 @@ const result = await Bun.build({ 'vite-ssg-sitemap', 'vitepress', 'vite-plugin-pwa', - 'vite-plugin-pages', 'vite-plugin-vue-devtools', 'unocss', '@vitejs/plugin-vue', diff --git a/storage/framework/core/vite-plugin/package.json b/storage/framework/core/vite-plugin/package.json index 695781c335..a60d9fa7ef 100644 --- a/storage/framework/core/vite-plugin/package.json +++ b/storage/framework/core/vite-plugin/package.json @@ -99,7 +99,6 @@ "vite": "^6.2.3", "vite-plugin-full-reload": "^1.2.0", "vite-plugin-inspect": "^11.0.0", - "vite-plugin-pages": "^0.32.5", "vite-plugin-pwa": "^1.0.0", "vite-ssg": "^26.1.0", "vite-ssg-sitemap": "^0.8.1" diff --git a/storage/framework/defaults/layouts/README.md b/storage/framework/defaults/layouts/README.md index 57887d7511..3824ced03a 100644 --- a/storage/framework/defaults/layouts/README.md +++ b/storage/framework/defaults/layouts/README.md @@ -4,7 +4,7 @@ Vue components in this dir are used as layouts. By default, `default.stx` will be used unless an alternative is specified in the route meta. -With [`vite-plugin-pages`](https://github.com/hannoeru/vite-plugin-pages) and [`vite-plugin-vue-layouts`](https://github.com/johncampionjr/vite-plugin-vue-layouts), you can specify the layout in the page's SFCs like this: +With [`unplugin-vue-router`](https://github.com/posva/unplugin-vue-router) and [`vite-plugin-layouts`](https://github.com/stacksjs/vite-plugin-layouts), you can specify the layout in the page's SFCs like this: ```html diff --git a/storage/framework/server/tsconfig.docker.json b/storage/framework/server/tsconfig.docker.json index b5ccfdbc6b..a0f56469d4 100644 --- a/storage/framework/server/tsconfig.docker.json +++ b/storage/framework/server/tsconfig.docker.json @@ -22,7 +22,6 @@ "resolveJsonModule": true, "types": [ "vite/client", - "vite-plugin-pages/client", "vite-plugin-pwa/client", "vite-plugin-vue-layouts/client", "@intlify/unplugin-vue-i18n/messages" From bb86b0034991a99f590eec5b357414ceeed9da39 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 29 Mar 2025 23:22:14 -0700 Subject: [PATCH 18/78] chore: wip --- storage/framework/core/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/framework/core/tsconfig.json b/storage/framework/core/tsconfig.json index 785edcfd60..5b8a527211 100644 --- a/storage/framework/core/tsconfig.json +++ b/storage/framework/core/tsconfig.json @@ -27,6 +27,7 @@ "types": [ "bun", "vite/client", + "unplugin-vue-router/client", // "vue/ref-macros", "vite-plugin-pwa/client", "vite-plugin-vue-layouts/client", From a3cdb1093458a0daa044735be681142f7768687f Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 29 Mar 2025 23:27:11 -0700 Subject: [PATCH 19/78] chore: wip --- .../framework/defaults/views/dashboard/commerce/pos/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/framework/defaults/views/dashboard/commerce/pos/index.vue b/storage/framework/defaults/views/dashboard/commerce/pos/index.vue index 4dbfb512da..201e2dc06f 100644 --- a/storage/framework/defaults/views/dashboard/commerce/pos/index.vue +++ b/storage/framework/defaults/views/dashboard/commerce/pos/index.vue @@ -451,7 +451,7 @@ function getAllergyClass(allergy: string): string { type="button" class="relative inline-flex items-center rounded-md bg-blue-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600" > -
+
View Order Date: Sat, 29 Mar 2025 23:35:08 -0700 Subject: [PATCH 20/78] chore: wip chore: wip --- .../views/dashboard/commerce/pos/index.vue | 403 +++++++++--------- 1 file changed, 201 insertions(+), 202 deletions(-) diff --git a/storage/framework/defaults/views/dashboard/commerce/pos/index.vue b/storage/framework/defaults/views/dashboard/commerce/pos/index.vue index 201e2dc06f..8d7eee3d4b 100644 --- a/storage/framework/defaults/views/dashboard/commerce/pos/index.vue +++ b/storage/framework/defaults/views/dashboard/commerce/pos/index.vue @@ -4,7 +4,7 @@ import { useHead } from '@vueuse/head' import { useLocalStorage } from '@vueuse/core' useHead({ - title: 'Restaurant POS - Table Ordering', + title: 'Self-Service Menu', }) // Define menu item type @@ -334,8 +334,11 @@ function updateItemQuantity(index: number, quantity: number): void { return } - currentOrder.items[index].quantity = quantity - updateOrderTotal() + const item = currentOrder.items[index] + if (item) { + item.quantity = quantity + updateOrderTotal() + } } // Update order total @@ -351,14 +354,20 @@ const currentEditingItemIndex = ref(-1) const tempSpecialInstructions = ref('') function openSpecialInstructionsModal(index: number): void { - currentEditingItemIndex.value = index - tempSpecialInstructions.value = currentOrder.items[index].specialInstructions - showSpecialInstructionsModal.value = true + const item = currentOrder.items[index] + if (item) { + currentEditingItemIndex.value = index + tempSpecialInstructions.value = item.specialInstructions + showSpecialInstructionsModal.value = true + } } function saveSpecialInstructions(): void { if (currentEditingItemIndex.value >= 0) { - currentOrder.items[currentEditingItemIndex.value].specialInstructions = tempSpecialInstructions.value + const item = currentOrder.items[currentEditingItemIndex.value] + if (item) { + item.specialInstructions = tempSpecialInstructions.value + } } showSpecialInstructionsModal.value = false } @@ -416,6 +425,14 @@ function getAllergyClass(allergy: string): string { return 'bg-gray-50 text-gray-700 ring-1 ring-inset ring-gray-600/20 dark:bg-gray-900/30 dark:text-gray-400' } } + +// Add the scrollToOrder function to the script +function scrollToOrder(): void { + const orderElement = document.getElementById('order-section') + if (orderElement) { + orderElement.scrollIntoView({ behavior: 'smooth' }) + } +} + + From 233834f43696e11f21bdaf140816fc7bb81c2547 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Mon, 31 Mar 2025 18:47:54 +0800 Subject: [PATCH 21/78] chore: wip --- ...able.ts => 1743417329388-create-projects-table.ts} | 0 ...> 1743417329412-create-subscriber_emails-table.ts} | 0 ...3417329434-create-personal_access_tokens-table.ts} | 2 ++ ...le.ts => 1743417329437-create-team_users-table.ts} | 0 ...s-table.ts => 1743417329455-create-teams-table.ts} | 2 ++ ...e.ts => 1743417329475-create-subscribers-table.ts} | 2 ++ ...e.ts => 1743417329495-create-deployments-table.ts} | 2 ++ ...able.ts => 1743417329513-create-releases-table.ts} | 0 ...able.ts => 1743417329531-create-passkeys-table.ts} | 0 ...s-table.ts => 1743417329532-create-users-table.ts} | 2 ++ ...s-table.ts => 1743417329552-create-posts-table.ts} | 2 ++ ...le.ts => 1743417329572-create-categories-table.ts} | 0 ...able.ts => 1743417329591-create-payments-table.ts} | 4 ++++ ...table.ts => 1743417329611-create-drivers-table.ts} | 2 ++ ...> 1743417329630-create-waitlist_products-table.ts} | 4 ++++ ... 1743417329650-create-digital_deliveries-table.ts} | 0 ...ts => 1743417329669-create-manufacturers-table.ts} | 0 ...e.ts => 1743417329688-create-order_items-table.ts} | 2 ++ ...s => 1743417329707-create-shipping_zones-table.ts} | 2 ++ ...ble.ts => 1743417329724-create-customers-table.ts} | 2 ++ ...able.ts => 1743417329743-create-products-table.ts} | 4 ++++ ...=> 1743417329762-create-product_variants-table.ts} | 2 ++ ....ts => 1743417329783-create-license_keys-table.ts} | 6 ++++++ ...743417329802-create-waitlist_restaurants-table.ts} | 2 ++ ...table.ts => 1743417329821-create-reviews-table.ts} | 4 ++++ ...ts => 1743417329841-create-product_units-table.ts} | 2 ++ ...le.ts => 1743417329862-create-gift_cards-table.ts} | 2 ++ ...-table.ts => 1743417329881-create-orders-table.ts} | 6 ++++++ ...table.ts => 1743417329901-create-coupons-table.ts} | 2 ++ ...ble.ts => 1743417329921-create-tax_rates-table.ts} | 0 ...le.ts => 1743417329940-create-print_logs-table.ts} | 0 ....ts => 1743417329962-create-transactions-table.ts} | 0 ...s => 1743417329982-create-loyalty_points-table.ts} | 0 ...ts => 1743417330003-create-product_items-table.ts} | 0 ... => 1743417330023-create-loyalty_rewards-table.ts} | 0 ...=> 1743417330044-create-shipping_methods-table.ts} | 0 ...s => 1743417330064-create-shipping_rates-table.ts} | 0 ... => 1743417330084-create-delivery_routes-table.ts} | 2 ++ ...e.ts => 1743417330103-create-failed_jobs-table.ts} | 0 ... => 1743417330123-create-payment_methods-table.ts} | 2 ++ ...743417330142-create-payment_transactions-table.ts} | 4 ++++ ...able.ts => 1743417330162-create-requests-table.ts} | 0 ...bs-table.ts => 1743417330181-create-jobs-table.ts} | 0 ...ts => 1743417330201-create-subscriptions-table.ts} | 2 ++ ...=> 1743417330222-create-payment_products-table.ts} | 0 ...-table.ts => 1743417330241-create-errors-table.ts} | 0 storage/framework/core/commerce/src/prints/fetch.ts | 2 +- .../framework/core/commerce/src/tests/prints.test.ts | 1 - storage/framework/core/database/src/drivers/sqlite.ts | 11 +++++++++++ 49 files changed, 80 insertions(+), 2 deletions(-) rename database/migrations/{1743254856988-create-projects-table.ts => 1743417329388-create-projects-table.ts} (100%) rename database/migrations/{1743254857011-create-subscriber_emails-table.ts => 1743417329412-create-subscriber_emails-table.ts} (100%) rename database/migrations/{1743254857032-create-personal_access_tokens-table.ts => 1743417329434-create-personal_access_tokens-table.ts} (88%) rename database/migrations/{1743254857034-create-team_users-table.ts => 1743417329437-create-team_users-table.ts} (100%) rename database/migrations/{1743254857053-create-teams-table.ts => 1743417329455-create-teams-table.ts} (91%) rename database/migrations/{1743254857073-create-subscribers-table.ts => 1743417329475-create-subscribers-table.ts} (84%) rename database/migrations/{1743254857093-create-deployments-table.ts => 1743417329495-create-deployments-table.ts} (90%) rename database/migrations/{1743254857113-create-releases-table.ts => 1743417329513-create-releases-table.ts} (100%) rename database/migrations/{1743254857133-create-passkeys-table.ts => 1743417329531-create-passkeys-table.ts} (100%) rename database/migrations/{1743254857133-create-users-table.ts => 1743417329532-create-users-table.ts} (90%) rename database/migrations/{1743254857153-create-posts-table.ts => 1743417329552-create-posts-table.ts} (86%) rename database/migrations/{1743254857176-create-categories-table.ts => 1743417329572-create-categories-table.ts} (100%) rename database/migrations/{1743254857196-create-payments-table.ts => 1743417329591-create-payments-table.ts} (85%) rename database/migrations/{1743254857215-create-drivers-table.ts => 1743417329611-create-drivers-table.ts} (89%) rename database/migrations/{1743254857234-create-waitlist_products-table.ts => 1743417329630-create-waitlist_products-table.ts} (82%) rename database/migrations/{1743254857254-create-digital_deliveries-table.ts => 1743417329650-create-digital_deliveries-table.ts} (100%) rename database/migrations/{1743254857274-create-manufacturers-table.ts => 1743417329669-create-manufacturers-table.ts} (100%) rename database/migrations/{1743254857294-create-order_items-table.ts => 1743417329688-create-order_items-table.ts} (86%) rename database/migrations/{1743254857313-create-shipping_zones-table.ts => 1743417329707-create-shipping_zones-table.ts} (85%) rename database/migrations/{1743254857331-create-customers-table.ts => 1743417329724-create-customers-table.ts} (90%) rename database/migrations/{1743254857348-create-products-table.ts => 1743417329743-create-products-table.ts} (82%) rename database/migrations/{1743254857368-create-product_variants-table.ts => 1743417329762-create-product_variants-table.ts} (86%) rename database/migrations/{1743254857387-create-license_keys-table.ts => 1743417329783-create-license_keys-table.ts} (74%) rename database/migrations/{1743254857407-create-waitlist_restaurants-table.ts => 1743417329802-create-waitlist_restaurants-table.ts} (90%) rename database/migrations/{1743254857428-create-reviews-table.ts => 1743417329821-create-reviews-table.ts} (84%) rename database/migrations/{1743254857447-create-product_units-table.ts => 1743417329841-create-product_units-table.ts} (87%) rename database/migrations/{1743254857466-create-gift_cards-table.ts => 1743417329862-create-gift_cards-table.ts} (91%) rename database/migrations/{1743254857486-create-orders-table.ts => 1743417329881-create-orders-table.ts} (80%) rename database/migrations/{1743254857506-create-coupons-table.ts => 1743417329901-create-coupons-table.ts} (92%) rename database/migrations/{1743254857525-create-tax_rates-table.ts => 1743417329921-create-tax_rates-table.ts} (100%) rename database/migrations/{1743254857544-create-print_logs-table.ts => 1743417329940-create-print_logs-table.ts} (100%) rename database/migrations/{1743254857563-create-transactions-table.ts => 1743417329962-create-transactions-table.ts} (100%) rename database/migrations/{1743254857584-create-loyalty_points-table.ts => 1743417329982-create-loyalty_points-table.ts} (100%) rename database/migrations/{1743254857604-create-product_items-table.ts => 1743417330003-create-product_items-table.ts} (100%) rename database/migrations/{1743254857628-create-loyalty_rewards-table.ts => 1743417330023-create-loyalty_rewards-table.ts} (100%) rename database/migrations/{1743254857648-create-shipping_methods-table.ts => 1743417330044-create-shipping_methods-table.ts} (100%) rename database/migrations/{1743254857669-create-shipping_rates-table.ts => 1743417330064-create-shipping_rates-table.ts} (100%) rename database/migrations/{1743254857688-create-delivery_routes-table.ts => 1743417330084-create-delivery_routes-table.ts} (88%) rename database/migrations/{1743254857707-create-failed_jobs-table.ts => 1743417330103-create-failed_jobs-table.ts} (100%) rename database/migrations/{1743254857725-create-payment_methods-table.ts => 1743417330123-create-payment_methods-table.ts} (88%) rename database/migrations/{1743254857744-create-payment_transactions-table.ts => 1743417330142-create-payment_transactions-table.ts} (77%) rename database/migrations/{1743254857762-create-requests-table.ts => 1743417330162-create-requests-table.ts} (100%) rename database/migrations/{1743254857782-create-jobs-table.ts => 1743417330181-create-jobs-table.ts} (100%) rename database/migrations/{1743254857801-create-subscriptions-table.ts => 1743417330201-create-subscriptions-table.ts} (90%) rename database/migrations/{1743254857821-create-payment_products-table.ts => 1743417330222-create-payment_products-table.ts} (100%) rename database/migrations/{1743254857840-create-errors-table.ts => 1743417330241-create-errors-table.ts} (100%) diff --git a/database/migrations/1743254856988-create-projects-table.ts b/database/migrations/1743417329388-create-projects-table.ts similarity index 100% rename from database/migrations/1743254856988-create-projects-table.ts rename to database/migrations/1743417329388-create-projects-table.ts diff --git a/database/migrations/1743254857011-create-subscriber_emails-table.ts b/database/migrations/1743417329412-create-subscriber_emails-table.ts similarity index 100% rename from database/migrations/1743254857011-create-subscriber_emails-table.ts rename to database/migrations/1743417329412-create-subscriber_emails-table.ts diff --git a/database/migrations/1743254857032-create-personal_access_tokens-table.ts b/database/migrations/1743417329434-create-personal_access_tokens-table.ts similarity index 88% rename from database/migrations/1743254857032-create-personal_access_tokens-table.ts rename to database/migrations/1743417329434-create-personal_access_tokens-table.ts index d5875daf61..b7bf56c8c5 100644 --- a/database/migrations/1743254857032-create-personal_access_tokens-table.ts +++ b/database/migrations/1743417329434-create-personal_access_tokens-table.ts @@ -20,4 +20,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('personal_access_tokens_team_id_index').on('personal_access_tokens').column('team_id').execute() } diff --git a/database/migrations/1743254857034-create-team_users-table.ts b/database/migrations/1743417329437-create-team_users-table.ts similarity index 100% rename from database/migrations/1743254857034-create-team_users-table.ts rename to database/migrations/1743417329437-create-team_users-table.ts diff --git a/database/migrations/1743254857053-create-teams-table.ts b/database/migrations/1743417329455-create-teams-table.ts similarity index 91% rename from database/migrations/1743254857053-create-teams-table.ts rename to database/migrations/1743417329455-create-teams-table.ts index 2c06f3944f..de552ee055 100644 --- a/database/migrations/1743254857053-create-teams-table.ts +++ b/database/migrations/1743417329455-create-teams-table.ts @@ -18,4 +18,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('teams_user_id_index').on('teams').column('user_id').execute() } diff --git a/database/migrations/1743254857073-create-subscribers-table.ts b/database/migrations/1743417329475-create-subscribers-table.ts similarity index 84% rename from database/migrations/1743254857073-create-subscribers-table.ts rename to database/migrations/1743417329475-create-subscribers-table.ts index 2fb0a49e8b..5bf7fa4472 100644 --- a/database/migrations/1743254857073-create-subscribers-table.ts +++ b/database/migrations/1743417329475-create-subscribers-table.ts @@ -11,4 +11,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('subscribers_user_id_index').on('subscribers').column('user_id').execute() } diff --git a/database/migrations/1743254857093-create-deployments-table.ts b/database/migrations/1743417329495-create-deployments-table.ts similarity index 90% rename from database/migrations/1743254857093-create-deployments-table.ts rename to database/migrations/1743417329495-create-deployments-table.ts index 288c847840..dbd0604fb3 100644 --- a/database/migrations/1743254857093-create-deployments-table.ts +++ b/database/migrations/1743417329495-create-deployments-table.ts @@ -18,4 +18,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('deployments_user_id_index').on('deployments').column('user_id').execute() } diff --git a/database/migrations/1743254857113-create-releases-table.ts b/database/migrations/1743417329513-create-releases-table.ts similarity index 100% rename from database/migrations/1743254857113-create-releases-table.ts rename to database/migrations/1743417329513-create-releases-table.ts diff --git a/database/migrations/1743254857133-create-passkeys-table.ts b/database/migrations/1743417329531-create-passkeys-table.ts similarity index 100% rename from database/migrations/1743254857133-create-passkeys-table.ts rename to database/migrations/1743417329531-create-passkeys-table.ts diff --git a/database/migrations/1743254857133-create-users-table.ts b/database/migrations/1743417329532-create-users-table.ts similarity index 90% rename from database/migrations/1743254857133-create-users-table.ts rename to database/migrations/1743417329532-create-users-table.ts index 7e5250fe8b..11acc1b25b 100644 --- a/database/migrations/1743254857133-create-users-table.ts +++ b/database/migrations/1743417329532-create-users-table.ts @@ -17,4 +17,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('users_team_id_index').on('users').column('team_id').execute() } diff --git a/database/migrations/1743254857153-create-posts-table.ts b/database/migrations/1743417329552-create-posts-table.ts similarity index 86% rename from database/migrations/1743254857153-create-posts-table.ts rename to database/migrations/1743417329552-create-posts-table.ts index 0bcd7b6542..2c2ebd40c9 100644 --- a/database/migrations/1743254857153-create-posts-table.ts +++ b/database/migrations/1743417329552-create-posts-table.ts @@ -12,4 +12,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('posts_user_id_index').on('posts').column('user_id').execute() } diff --git a/database/migrations/1743254857176-create-categories-table.ts b/database/migrations/1743417329572-create-categories-table.ts similarity index 100% rename from database/migrations/1743254857176-create-categories-table.ts rename to database/migrations/1743417329572-create-categories-table.ts diff --git a/database/migrations/1743254857196-create-payments-table.ts b/database/migrations/1743417329591-create-payments-table.ts similarity index 85% rename from database/migrations/1743254857196-create-payments-table.ts rename to database/migrations/1743417329591-create-payments-table.ts index b0fee527b8..97db64cc50 100644 --- a/database/migrations/1743254857196-create-payments-table.ts +++ b/database/migrations/1743417329591-create-payments-table.ts @@ -25,4 +25,8 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('payments_customer_id_index').on('payments').column('customer_id').execute() + + await db.schema.createIndex('payments_order_id_index').on('payments').column('order_id').execute() } diff --git a/database/migrations/1743254857215-create-drivers-table.ts b/database/migrations/1743417329611-create-drivers-table.ts similarity index 89% rename from database/migrations/1743254857215-create-drivers-table.ts rename to database/migrations/1743417329611-create-drivers-table.ts index 854322ca34..0bdcc6b348 100644 --- a/database/migrations/1743254857215-create-drivers-table.ts +++ b/database/migrations/1743417329611-create-drivers-table.ts @@ -16,4 +16,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('drivers_user_id_index').on('drivers').column('user_id').execute() } diff --git a/database/migrations/1743254857234-create-waitlist_products-table.ts b/database/migrations/1743417329630-create-waitlist_products-table.ts similarity index 82% rename from database/migrations/1743254857234-create-waitlist_products-table.ts rename to database/migrations/1743417329630-create-waitlist_products-table.ts index e01d0ebb79..01a90166b2 100644 --- a/database/migrations/1743254857234-create-waitlist_products-table.ts +++ b/database/migrations/1743417329630-create-waitlist_products-table.ts @@ -24,4 +24,8 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('waitlist_products_customer_id_index').on('waitlist_products').column('customer_id').execute() + + await db.schema.createIndex('waitlist_products_product_id_index').on('waitlist_products').column('product_id').execute() } diff --git a/database/migrations/1743254857254-create-digital_deliveries-table.ts b/database/migrations/1743417329650-create-digital_deliveries-table.ts similarity index 100% rename from database/migrations/1743254857254-create-digital_deliveries-table.ts rename to database/migrations/1743417329650-create-digital_deliveries-table.ts diff --git a/database/migrations/1743254857274-create-manufacturers-table.ts b/database/migrations/1743417329669-create-manufacturers-table.ts similarity index 100% rename from database/migrations/1743254857274-create-manufacturers-table.ts rename to database/migrations/1743417329669-create-manufacturers-table.ts diff --git a/database/migrations/1743254857294-create-order_items-table.ts b/database/migrations/1743417329688-create-order_items-table.ts similarity index 86% rename from database/migrations/1743254857294-create-order_items-table.ts rename to database/migrations/1743417329688-create-order_items-table.ts index e19bb811be..1ecd5f7528 100644 --- a/database/migrations/1743254857294-create-order_items-table.ts +++ b/database/migrations/1743417329688-create-order_items-table.ts @@ -13,4 +13,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('order_items_order_id_index').on('order_items').column('order_id').execute() } diff --git a/database/migrations/1743254857313-create-shipping_zones-table.ts b/database/migrations/1743417329707-create-shipping_zones-table.ts similarity index 85% rename from database/migrations/1743254857313-create-shipping_zones-table.ts rename to database/migrations/1743417329707-create-shipping_zones-table.ts index 25e2a85652..21bee99092 100644 --- a/database/migrations/1743254857313-create-shipping_zones-table.ts +++ b/database/migrations/1743417329707-create-shipping_zones-table.ts @@ -16,4 +16,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('shipping_zones_shipping_method_id_index').on('shipping_zones').column('shipping_method_id').execute() } diff --git a/database/migrations/1743254857331-create-customers-table.ts b/database/migrations/1743417329724-create-customers-table.ts similarity index 90% rename from database/migrations/1743254857331-create-customers-table.ts rename to database/migrations/1743417329724-create-customers-table.ts index 74980c2a83..10e406c2a2 100644 --- a/database/migrations/1743254857331-create-customers-table.ts +++ b/database/migrations/1743417329724-create-customers-table.ts @@ -18,4 +18,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('customers_user_id_index').on('customers').column('user_id').execute() } diff --git a/database/migrations/1743254857348-create-products-table.ts b/database/migrations/1743417329743-create-products-table.ts similarity index 82% rename from database/migrations/1743254857348-create-products-table.ts rename to database/migrations/1743417329743-create-products-table.ts index 39ab3b1202..f5fdcfe3ef 100644 --- a/database/migrations/1743254857348-create-products-table.ts +++ b/database/migrations/1743417329743-create-products-table.ts @@ -22,4 +22,8 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('products_category_id_index').on('products').column('category_id').execute() + + await db.schema.createIndex('products_manufacturer_id_index').on('products').column('manufacturer_id').execute() } diff --git a/database/migrations/1743254857368-create-product_variants-table.ts b/database/migrations/1743417329762-create-product_variants-table.ts similarity index 86% rename from database/migrations/1743254857368-create-product_variants-table.ts rename to database/migrations/1743417329762-create-product_variants-table.ts index f636eba784..299576871d 100644 --- a/database/migrations/1743254857368-create-product_variants-table.ts +++ b/database/migrations/1743417329762-create-product_variants-table.ts @@ -16,4 +16,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('product_variants_product_id_index').on('product_variants').column('product_id').execute() } diff --git a/database/migrations/1743254857387-create-license_keys-table.ts b/database/migrations/1743417329783-create-license_keys-table.ts similarity index 74% rename from database/migrations/1743254857387-create-license_keys-table.ts rename to database/migrations/1743417329783-create-license_keys-table.ts index 15e1c17e83..b5492bfa77 100644 --- a/database/migrations/1743254857387-create-license_keys-table.ts +++ b/database/migrations/1743417329783-create-license_keys-table.ts @@ -19,4 +19,10 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('license_keys_customer_id_index').on('license_keys').column('customer_id').execute() + + await db.schema.createIndex('license_keys_product_id_index').on('license_keys').column('product_id').execute() + + await db.schema.createIndex('license_keys_order_id_index').on('license_keys').column('order_id').execute() } diff --git a/database/migrations/1743254857407-create-waitlist_restaurants-table.ts b/database/migrations/1743417329802-create-waitlist_restaurants-table.ts similarity index 90% rename from database/migrations/1743254857407-create-waitlist_restaurants-table.ts rename to database/migrations/1743417329802-create-waitlist_restaurants-table.ts index 60406d873f..693cfa5144 100644 --- a/database/migrations/1743254857407-create-waitlist_restaurants-table.ts +++ b/database/migrations/1743417329802-create-waitlist_restaurants-table.ts @@ -24,4 +24,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('waitlist_restaurants_customer_id_index').on('waitlist_restaurants').column('customer_id').execute() } diff --git a/database/migrations/1743254857428-create-reviews-table.ts b/database/migrations/1743417329821-create-reviews-table.ts similarity index 84% rename from database/migrations/1743254857428-create-reviews-table.ts rename to database/migrations/1743417329821-create-reviews-table.ts index 6e293983dc..fa2a97a181 100644 --- a/database/migrations/1743254857428-create-reviews-table.ts +++ b/database/migrations/1743417329821-create-reviews-table.ts @@ -23,4 +23,8 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('reviews_customer_id_index').on('reviews').column('customer_id').execute() + + await db.schema.createIndex('reviews_product_id_index').on('reviews').column('product_id').execute() } diff --git a/database/migrations/1743254857447-create-product_units-table.ts b/database/migrations/1743417329841-create-product_units-table.ts similarity index 87% rename from database/migrations/1743254857447-create-product_units-table.ts rename to database/migrations/1743417329841-create-product_units-table.ts index a97f64f0ef..e3dd8c680b 100644 --- a/database/migrations/1743254857447-create-product_units-table.ts +++ b/database/migrations/1743417329841-create-product_units-table.ts @@ -16,4 +16,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('product_units_product_id_index').on('product_units').column('product_id').execute() } diff --git a/database/migrations/1743254857466-create-gift_cards-table.ts b/database/migrations/1743417329862-create-gift_cards-table.ts similarity index 91% rename from database/migrations/1743254857466-create-gift_cards-table.ts rename to database/migrations/1743417329862-create-gift_cards-table.ts index d65ba7fecb..13d74788b2 100644 --- a/database/migrations/1743254857466-create-gift_cards-table.ts +++ b/database/migrations/1743417329862-create-gift_cards-table.ts @@ -26,4 +26,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('gift_cards_customer_id_index').on('gift_cards').column('customer_id').execute() } diff --git a/database/migrations/1743254857486-create-orders-table.ts b/database/migrations/1743417329881-create-orders-table.ts similarity index 80% rename from database/migrations/1743254857486-create-orders-table.ts rename to database/migrations/1743417329881-create-orders-table.ts index 52e41be5ad..47c54cac9e 100644 --- a/database/migrations/1743254857486-create-orders-table.ts +++ b/database/migrations/1743417329881-create-orders-table.ts @@ -26,4 +26,10 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('orders_customer_id_index').on('orders').column('customer_id').execute() + + await db.schema.createIndex('orders_gift_card_id_index').on('orders').column('gift_card_id').execute() + + await db.schema.createIndex('orders_coupon_id_index').on('orders').column('coupon_id').execute() } diff --git a/database/migrations/1743254857506-create-coupons-table.ts b/database/migrations/1743417329901-create-coupons-table.ts similarity index 92% rename from database/migrations/1743254857506-create-coupons-table.ts rename to database/migrations/1743417329901-create-coupons-table.ts index 2f1ce893ce..e11fd476e1 100644 --- a/database/migrations/1743254857506-create-coupons-table.ts +++ b/database/migrations/1743417329901-create-coupons-table.ts @@ -25,4 +25,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('coupons_product_id_index').on('coupons').column('product_id').execute() } diff --git a/database/migrations/1743254857525-create-tax_rates-table.ts b/database/migrations/1743417329921-create-tax_rates-table.ts similarity index 100% rename from database/migrations/1743254857525-create-tax_rates-table.ts rename to database/migrations/1743417329921-create-tax_rates-table.ts diff --git a/database/migrations/1743254857544-create-print_logs-table.ts b/database/migrations/1743417329940-create-print_logs-table.ts similarity index 100% rename from database/migrations/1743254857544-create-print_logs-table.ts rename to database/migrations/1743417329940-create-print_logs-table.ts diff --git a/database/migrations/1743254857563-create-transactions-table.ts b/database/migrations/1743417329962-create-transactions-table.ts similarity index 100% rename from database/migrations/1743254857563-create-transactions-table.ts rename to database/migrations/1743417329962-create-transactions-table.ts diff --git a/database/migrations/1743254857584-create-loyalty_points-table.ts b/database/migrations/1743417329982-create-loyalty_points-table.ts similarity index 100% rename from database/migrations/1743254857584-create-loyalty_points-table.ts rename to database/migrations/1743417329982-create-loyalty_points-table.ts diff --git a/database/migrations/1743254857604-create-product_items-table.ts b/database/migrations/1743417330003-create-product_items-table.ts similarity index 100% rename from database/migrations/1743254857604-create-product_items-table.ts rename to database/migrations/1743417330003-create-product_items-table.ts diff --git a/database/migrations/1743254857628-create-loyalty_rewards-table.ts b/database/migrations/1743417330023-create-loyalty_rewards-table.ts similarity index 100% rename from database/migrations/1743254857628-create-loyalty_rewards-table.ts rename to database/migrations/1743417330023-create-loyalty_rewards-table.ts diff --git a/database/migrations/1743254857648-create-shipping_methods-table.ts b/database/migrations/1743417330044-create-shipping_methods-table.ts similarity index 100% rename from database/migrations/1743254857648-create-shipping_methods-table.ts rename to database/migrations/1743417330044-create-shipping_methods-table.ts diff --git a/database/migrations/1743254857669-create-shipping_rates-table.ts b/database/migrations/1743417330064-create-shipping_rates-table.ts similarity index 100% rename from database/migrations/1743254857669-create-shipping_rates-table.ts rename to database/migrations/1743417330064-create-shipping_rates-table.ts diff --git a/database/migrations/1743254857688-create-delivery_routes-table.ts b/database/migrations/1743417330084-create-delivery_routes-table.ts similarity index 88% rename from database/migrations/1743254857688-create-delivery_routes-table.ts rename to database/migrations/1743417330084-create-delivery_routes-table.ts index af971294ee..bc38214fd6 100644 --- a/database/migrations/1743254857688-create-delivery_routes-table.ts +++ b/database/migrations/1743417330084-create-delivery_routes-table.ts @@ -17,4 +17,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('delivery_routes_driver_id_index').on('delivery_routes').column('driver_id').execute() } diff --git a/database/migrations/1743254857707-create-failed_jobs-table.ts b/database/migrations/1743417330103-create-failed_jobs-table.ts similarity index 100% rename from database/migrations/1743254857707-create-failed_jobs-table.ts rename to database/migrations/1743417330103-create-failed_jobs-table.ts diff --git a/database/migrations/1743254857725-create-payment_methods-table.ts b/database/migrations/1743417330123-create-payment_methods-table.ts similarity index 88% rename from database/migrations/1743254857725-create-payment_methods-table.ts rename to database/migrations/1743417330123-create-payment_methods-table.ts index 48722f704d..29646d87e3 100644 --- a/database/migrations/1743254857725-create-payment_methods-table.ts +++ b/database/migrations/1743417330123-create-payment_methods-table.ts @@ -18,4 +18,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('payment_methods_user_id_index').on('payment_methods').column('user_id').execute() } diff --git a/database/migrations/1743254857744-create-payment_transactions-table.ts b/database/migrations/1743417330142-create-payment_transactions-table.ts similarity index 77% rename from database/migrations/1743254857744-create-payment_transactions-table.ts rename to database/migrations/1743417330142-create-payment_transactions-table.ts index 8f74b8b97f..992f4a53f7 100644 --- a/database/migrations/1743254857744-create-payment_transactions-table.ts +++ b/database/migrations/1743417330142-create-payment_transactions-table.ts @@ -18,4 +18,8 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('payment_transactions_user_id_index').on('payment_transactions').column('user_id').execute() + + await db.schema.createIndex('payment_transactions_payment_method_id_index').on('payment_transactions').column('payment_method_id').execute() } diff --git a/database/migrations/1743254857762-create-requests-table.ts b/database/migrations/1743417330162-create-requests-table.ts similarity index 100% rename from database/migrations/1743254857762-create-requests-table.ts rename to database/migrations/1743417330162-create-requests-table.ts diff --git a/database/migrations/1743254857782-create-jobs-table.ts b/database/migrations/1743417330181-create-jobs-table.ts similarity index 100% rename from database/migrations/1743254857782-create-jobs-table.ts rename to database/migrations/1743417330181-create-jobs-table.ts diff --git a/database/migrations/1743254857801-create-subscriptions-table.ts b/database/migrations/1743417330201-create-subscriptions-table.ts similarity index 90% rename from database/migrations/1743254857801-create-subscriptions-table.ts rename to database/migrations/1743417330201-create-subscriptions-table.ts index 36f057f322..391c483ad9 100644 --- a/database/migrations/1743254857801-create-subscriptions-table.ts +++ b/database/migrations/1743417330201-create-subscriptions-table.ts @@ -22,4 +22,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('subscriptions_user_id_index').on('subscriptions').column('user_id').execute() } diff --git a/database/migrations/1743254857821-create-payment_products-table.ts b/database/migrations/1743417330222-create-payment_products-table.ts similarity index 100% rename from database/migrations/1743254857821-create-payment_products-table.ts rename to database/migrations/1743417330222-create-payment_products-table.ts diff --git a/database/migrations/1743254857840-create-errors-table.ts b/database/migrations/1743417330241-create-errors-table.ts similarity index 100% rename from database/migrations/1743254857840-create-errors-table.ts rename to database/migrations/1743417330241-create-errors-table.ts diff --git a/storage/framework/core/commerce/src/prints/fetch.ts b/storage/framework/core/commerce/src/prints/fetch.ts index f92e115778..752d4da7e6 100644 --- a/storage/framework/core/commerce/src/prints/fetch.ts +++ b/storage/framework/core/commerce/src/prints/fetch.ts @@ -66,7 +66,7 @@ export async function fetchPrintJobStats( /** * Calculate the success rate percentage for print jobs within a date range - * + * * @param startDate Start date for the range * @param endDate End date for the range * @returns Object containing success rate percentage and detailed counts diff --git a/storage/framework/core/commerce/src/tests/prints.test.ts b/storage/framework/core/commerce/src/tests/prints.test.ts index 1b2512ecbd..9b84ab8e2c 100644 --- a/storage/framework/core/commerce/src/tests/prints.test.ts +++ b/storage/framework/core/commerce/src/tests/prints.test.ts @@ -1,6 +1,5 @@ import type { PrintLogJsonResponse } from '@stacksjs/orm' import { beforeEach, describe, expect, it } from 'bun:test' -import { formatDate } from '@stacksjs/orm' import { refreshDatabase } from '@stacksjs/testing' import { bulkDestroy, destroy } from '../prints/destroy' import { fetchAll, fetchById, fetchPrintJobStats, fetchSuccessRate } from '../prints/fetch' diff --git a/storage/framework/core/database/src/drivers/sqlite.ts b/storage/framework/core/database/src/drivers/sqlite.ts index 034d922db5..d09f16abdb 100644 --- a/storage/framework/core/database/src/drivers/sqlite.ts +++ b/storage/framework/core/database/src/drivers/sqlite.ts @@ -146,6 +146,7 @@ export async function copyModelFiles(modelPath: string): Promise { // store the fields of the model to a file await Bun.$`cp ${modelPath} ${copiedModelPath}` } + async function createTableMigration(modelPath: string) { log.debug('createTableMigration modelPath:', modelPath) @@ -241,6 +242,16 @@ async function createTableMigration(modelPath: string) { migrationContent += ` .addColumn('deleted_at', 'timestamp')\n` migrationContent += ` .execute()\n` + + if (otherModelRelations?.length) { + for (const modelRelation of otherModelRelations) { + if (!modelRelation.foreignKey) + continue + + migrationContent += ` \n await db.schema.createIndex('${tableName}_${modelRelation.foreignKey}_index').on('${tableName}').column('${modelRelation.foreignKey}').execute()\n\n` + } + } + migrationContent += `}\n` const timestamp = new Date().getTime().toString() From 8c5c7915f39ece50957176465a018459516e8424 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Mon, 31 Mar 2025 19:05:32 +0800 Subject: [PATCH 22/78] chore: wip --- ...=> 1743419049037-create-projects-table.ts} | 0 ...9049064-create-subscriber_emails-table.ts} | 0 ...86-create-personal_access_tokens-table.ts} | 0 ... 1743419049090-create-team_users-table.ts} | 0 ...ts => 1743419049109-create-teams-table.ts} | 0 ...1743419049130-create-subscribers-table.ts} | 0 ...1743419049150-create-deployments-table.ts} | 0 ...=> 1743419049172-create-releases-table.ts} | 0 ...=> 1743419049191-create-passkeys-table.ts} | 0 ...ts => 1743419049191-create-users-table.ts} | 0 ...ts => 1743419049212-create-posts-table.ts} | 0 ... 1743419049234-create-categories-table.ts} | 0 ...=> 1743419049253-create-payments-table.ts} | 0 ... => 1743419049273-create-drivers-table.ts} | 0 ...9049296-create-waitlist_products-table.ts} | 0 ...049319-create-digital_deliveries-table.ts} | 0 ...43419049340-create-manufacturers-table.ts} | 0 ...1743419049362-create-order_items-table.ts} | 0 ...3419049384-create-shipping_zones-table.ts} | 0 ...> 1743419049402-create-customers-table.ts} | 0 ...=> 1743419049497-create-products-table.ts} | 0 ...=> 1743419049531-create-receipts-table.ts} | 2 +- ...19049595-create-product_variants-table.ts} | 0 ...743419049828-create-license_keys-table.ts} | 0 ...9897-create-waitlist_restaurants-table.ts} | 0 ... => 1743419049954-create-reviews-table.ts} | 0 ...43419049975-create-product_units-table.ts} | 0 ... 1743419049995-create-gift_cards-table.ts} | 0 ...s => 1743419050016-create-orders-table.ts} | 0 ... => 1743419050048-create-coupons-table.ts} | 0 ...> 1743419050071-create-tax_rates-table.ts} | 0 ...743419050100-create-transactions-table.ts} | 0 ...3419050127-create-loyalty_points-table.ts} | 0 ...43419050150-create-product_items-table.ts} | 0 ...419050180-create-loyalty_rewards-table.ts} | 0 ...19050203-create-shipping_methods-table.ts} | 0 ...3419050227-create-shipping_rates-table.ts} | 0 ...419050255-create-delivery_routes-table.ts} | 0 ...1743419050276-create-failed_jobs-table.ts} | 0 ...419050296-create-payment_methods-table.ts} | 0 ...0317-create-payment_transactions-table.ts} | 0 ...=> 1743419050337-create-requests-table.ts} | 0 ....ts => 1743419050357-create-jobs-table.ts} | 0 ...43419050379-create-subscriptions-table.ts} | 0 ...19050401-create-payment_products-table.ts} | 0 ...s => 1743419050421-create-errors-table.ts} | 0 .../actions/src/PrintLogDestroyOrmAction.ts | 20 - .../actions/src/PrintLogShowOrmAction.ts | 18 - .../actions/src/PrintLogStoreOrmAction.ts | 17 - .../actions/src/ReceiptDestroyOrmAction.ts | 20 + ...xOrmAction.ts => ReceiptIndexOrmAction.ts} | 6 +- .../actions/src/ReceiptShowOrmAction.ts | 18 + .../actions/src/ReceiptStoreOrmAction.ts | 17 + ...OrmAction.ts => ReceiptUpdateOrmAction.ts} | 12 +- .../framework/core/types/src/model-names.ts | 2 +- .../framework/core/types/src/table-names.ts | 2 +- .../ecommerce/{PrintLog.ts => Receipt.ts} | 4 +- .../models/{PrintLog.ts => Receipt.ts} | 4 +- storage/framework/orm/routes.ts | 20 +- storage/framework/orm/src/index.ts | 4 +- storage/framework/orm/src/models/PrintLog.ts | 1032 ----------------- storage/framework/orm/src/models/Receipt.ts | 1032 +++++++++++++++++ storage/framework/orm/src/types.ts | 4 +- .../{PrintLogRequest.ts => ReceiptRequest.ts} | 10 +- storage/framework/server-auto-imports.json | 18 +- storage/framework/types/attributes.ts | 12 +- .../framework/types/browser-auto-imports.d.ts | 1 + storage/framework/types/events.ts | 8 +- storage/framework/types/requests.d.ts | 58 +- .../framework/types/server-auto-imports.d.ts | 18 +- .../views/dashboard/storage/logs/stacks.log | 1 + 71 files changed, 1181 insertions(+), 1179 deletions(-) rename database/migrations/{1743417329388-create-projects-table.ts => 1743419049037-create-projects-table.ts} (100%) rename database/migrations/{1743417329412-create-subscriber_emails-table.ts => 1743419049064-create-subscriber_emails-table.ts} (100%) rename database/migrations/{1743417329434-create-personal_access_tokens-table.ts => 1743419049086-create-personal_access_tokens-table.ts} (100%) rename database/migrations/{1743417329437-create-team_users-table.ts => 1743419049090-create-team_users-table.ts} (100%) rename database/migrations/{1743417329455-create-teams-table.ts => 1743419049109-create-teams-table.ts} (100%) rename database/migrations/{1743417329475-create-subscribers-table.ts => 1743419049130-create-subscribers-table.ts} (100%) rename database/migrations/{1743417329495-create-deployments-table.ts => 1743419049150-create-deployments-table.ts} (100%) rename database/migrations/{1743417329513-create-releases-table.ts => 1743419049172-create-releases-table.ts} (100%) rename database/migrations/{1743417329531-create-passkeys-table.ts => 1743419049191-create-passkeys-table.ts} (100%) rename database/migrations/{1743417329532-create-users-table.ts => 1743419049191-create-users-table.ts} (100%) rename database/migrations/{1743417329552-create-posts-table.ts => 1743419049212-create-posts-table.ts} (100%) rename database/migrations/{1743417329572-create-categories-table.ts => 1743419049234-create-categories-table.ts} (100%) rename database/migrations/{1743417329591-create-payments-table.ts => 1743419049253-create-payments-table.ts} (100%) rename database/migrations/{1743417329611-create-drivers-table.ts => 1743419049273-create-drivers-table.ts} (100%) rename database/migrations/{1743417329630-create-waitlist_products-table.ts => 1743419049296-create-waitlist_products-table.ts} (100%) rename database/migrations/{1743417329650-create-digital_deliveries-table.ts => 1743419049319-create-digital_deliveries-table.ts} (100%) rename database/migrations/{1743417329669-create-manufacturers-table.ts => 1743419049340-create-manufacturers-table.ts} (100%) rename database/migrations/{1743417329688-create-order_items-table.ts => 1743419049362-create-order_items-table.ts} (100%) rename database/migrations/{1743417329707-create-shipping_zones-table.ts => 1743419049384-create-shipping_zones-table.ts} (100%) rename database/migrations/{1743417329724-create-customers-table.ts => 1743419049402-create-customers-table.ts} (100%) rename database/migrations/{1743417329743-create-products-table.ts => 1743419049497-create-products-table.ts} (100%) rename database/migrations/{1743417329940-create-print_logs-table.ts => 1743419049531-create-receipts-table.ts} (96%) rename database/migrations/{1743417329762-create-product_variants-table.ts => 1743419049595-create-product_variants-table.ts} (100%) rename database/migrations/{1743417329783-create-license_keys-table.ts => 1743419049828-create-license_keys-table.ts} (100%) rename database/migrations/{1743417329802-create-waitlist_restaurants-table.ts => 1743419049897-create-waitlist_restaurants-table.ts} (100%) rename database/migrations/{1743417329821-create-reviews-table.ts => 1743419049954-create-reviews-table.ts} (100%) rename database/migrations/{1743417329841-create-product_units-table.ts => 1743419049975-create-product_units-table.ts} (100%) rename database/migrations/{1743417329862-create-gift_cards-table.ts => 1743419049995-create-gift_cards-table.ts} (100%) rename database/migrations/{1743417329881-create-orders-table.ts => 1743419050016-create-orders-table.ts} (100%) rename database/migrations/{1743417329901-create-coupons-table.ts => 1743419050048-create-coupons-table.ts} (100%) rename database/migrations/{1743417329921-create-tax_rates-table.ts => 1743419050071-create-tax_rates-table.ts} (100%) rename database/migrations/{1743417329962-create-transactions-table.ts => 1743419050100-create-transactions-table.ts} (100%) rename database/migrations/{1743417329982-create-loyalty_points-table.ts => 1743419050127-create-loyalty_points-table.ts} (100%) rename database/migrations/{1743417330003-create-product_items-table.ts => 1743419050150-create-product_items-table.ts} (100%) rename database/migrations/{1743417330023-create-loyalty_rewards-table.ts => 1743419050180-create-loyalty_rewards-table.ts} (100%) rename database/migrations/{1743417330044-create-shipping_methods-table.ts => 1743419050203-create-shipping_methods-table.ts} (100%) rename database/migrations/{1743417330064-create-shipping_rates-table.ts => 1743419050227-create-shipping_rates-table.ts} (100%) rename database/migrations/{1743417330084-create-delivery_routes-table.ts => 1743419050255-create-delivery_routes-table.ts} (100%) rename database/migrations/{1743417330103-create-failed_jobs-table.ts => 1743419050276-create-failed_jobs-table.ts} (100%) rename database/migrations/{1743417330123-create-payment_methods-table.ts => 1743419050296-create-payment_methods-table.ts} (100%) rename database/migrations/{1743417330142-create-payment_transactions-table.ts => 1743419050317-create-payment_transactions-table.ts} (100%) rename database/migrations/{1743417330162-create-requests-table.ts => 1743419050337-create-requests-table.ts} (100%) rename database/migrations/{1743417330181-create-jobs-table.ts => 1743419050357-create-jobs-table.ts} (100%) rename database/migrations/{1743417330201-create-subscriptions-table.ts => 1743419050379-create-subscriptions-table.ts} (100%) rename database/migrations/{1743417330222-create-payment_products-table.ts => 1743419050401-create-payment_products-table.ts} (100%) rename database/migrations/{1743417330241-create-errors-table.ts => 1743419050421-create-errors-table.ts} (100%) delete mode 100644 storage/framework/actions/src/PrintLogDestroyOrmAction.ts delete mode 100644 storage/framework/actions/src/PrintLogShowOrmAction.ts delete mode 100644 storage/framework/actions/src/PrintLogStoreOrmAction.ts create mode 100644 storage/framework/actions/src/ReceiptDestroyOrmAction.ts rename storage/framework/actions/src/{PrintLogIndexOrmAction.ts => ReceiptIndexOrmAction.ts} (65%) create mode 100644 storage/framework/actions/src/ReceiptShowOrmAction.ts create mode 100644 storage/framework/actions/src/ReceiptStoreOrmAction.ts rename storage/framework/actions/src/{PrintLogUpdateOrmAction.ts => ReceiptUpdateOrmAction.ts} (51%) rename storage/framework/defaults/models/ecommerce/{PrintLog.ts => Receipt.ts} (98%) rename storage/framework/models/{PrintLog.ts => Receipt.ts} (98%) delete mode 100644 storage/framework/orm/src/models/PrintLog.ts create mode 100644 storage/framework/orm/src/models/Receipt.ts rename storage/framework/requests/{PrintLogRequest.ts => ReceiptRequest.ts} (76%) diff --git a/database/migrations/1743417329388-create-projects-table.ts b/database/migrations/1743419049037-create-projects-table.ts similarity index 100% rename from database/migrations/1743417329388-create-projects-table.ts rename to database/migrations/1743419049037-create-projects-table.ts diff --git a/database/migrations/1743417329412-create-subscriber_emails-table.ts b/database/migrations/1743419049064-create-subscriber_emails-table.ts similarity index 100% rename from database/migrations/1743417329412-create-subscriber_emails-table.ts rename to database/migrations/1743419049064-create-subscriber_emails-table.ts diff --git a/database/migrations/1743417329434-create-personal_access_tokens-table.ts b/database/migrations/1743419049086-create-personal_access_tokens-table.ts similarity index 100% rename from database/migrations/1743417329434-create-personal_access_tokens-table.ts rename to database/migrations/1743419049086-create-personal_access_tokens-table.ts diff --git a/database/migrations/1743417329437-create-team_users-table.ts b/database/migrations/1743419049090-create-team_users-table.ts similarity index 100% rename from database/migrations/1743417329437-create-team_users-table.ts rename to database/migrations/1743419049090-create-team_users-table.ts diff --git a/database/migrations/1743417329455-create-teams-table.ts b/database/migrations/1743419049109-create-teams-table.ts similarity index 100% rename from database/migrations/1743417329455-create-teams-table.ts rename to database/migrations/1743419049109-create-teams-table.ts diff --git a/database/migrations/1743417329475-create-subscribers-table.ts b/database/migrations/1743419049130-create-subscribers-table.ts similarity index 100% rename from database/migrations/1743417329475-create-subscribers-table.ts rename to database/migrations/1743419049130-create-subscribers-table.ts diff --git a/database/migrations/1743417329495-create-deployments-table.ts b/database/migrations/1743419049150-create-deployments-table.ts similarity index 100% rename from database/migrations/1743417329495-create-deployments-table.ts rename to database/migrations/1743419049150-create-deployments-table.ts diff --git a/database/migrations/1743417329513-create-releases-table.ts b/database/migrations/1743419049172-create-releases-table.ts similarity index 100% rename from database/migrations/1743417329513-create-releases-table.ts rename to database/migrations/1743419049172-create-releases-table.ts diff --git a/database/migrations/1743417329531-create-passkeys-table.ts b/database/migrations/1743419049191-create-passkeys-table.ts similarity index 100% rename from database/migrations/1743417329531-create-passkeys-table.ts rename to database/migrations/1743419049191-create-passkeys-table.ts diff --git a/database/migrations/1743417329532-create-users-table.ts b/database/migrations/1743419049191-create-users-table.ts similarity index 100% rename from database/migrations/1743417329532-create-users-table.ts rename to database/migrations/1743419049191-create-users-table.ts diff --git a/database/migrations/1743417329552-create-posts-table.ts b/database/migrations/1743419049212-create-posts-table.ts similarity index 100% rename from database/migrations/1743417329552-create-posts-table.ts rename to database/migrations/1743419049212-create-posts-table.ts diff --git a/database/migrations/1743417329572-create-categories-table.ts b/database/migrations/1743419049234-create-categories-table.ts similarity index 100% rename from database/migrations/1743417329572-create-categories-table.ts rename to database/migrations/1743419049234-create-categories-table.ts diff --git a/database/migrations/1743417329591-create-payments-table.ts b/database/migrations/1743419049253-create-payments-table.ts similarity index 100% rename from database/migrations/1743417329591-create-payments-table.ts rename to database/migrations/1743419049253-create-payments-table.ts diff --git a/database/migrations/1743417329611-create-drivers-table.ts b/database/migrations/1743419049273-create-drivers-table.ts similarity index 100% rename from database/migrations/1743417329611-create-drivers-table.ts rename to database/migrations/1743419049273-create-drivers-table.ts diff --git a/database/migrations/1743417329630-create-waitlist_products-table.ts b/database/migrations/1743419049296-create-waitlist_products-table.ts similarity index 100% rename from database/migrations/1743417329630-create-waitlist_products-table.ts rename to database/migrations/1743419049296-create-waitlist_products-table.ts diff --git a/database/migrations/1743417329650-create-digital_deliveries-table.ts b/database/migrations/1743419049319-create-digital_deliveries-table.ts similarity index 100% rename from database/migrations/1743417329650-create-digital_deliveries-table.ts rename to database/migrations/1743419049319-create-digital_deliveries-table.ts diff --git a/database/migrations/1743417329669-create-manufacturers-table.ts b/database/migrations/1743419049340-create-manufacturers-table.ts similarity index 100% rename from database/migrations/1743417329669-create-manufacturers-table.ts rename to database/migrations/1743419049340-create-manufacturers-table.ts diff --git a/database/migrations/1743417329688-create-order_items-table.ts b/database/migrations/1743419049362-create-order_items-table.ts similarity index 100% rename from database/migrations/1743417329688-create-order_items-table.ts rename to database/migrations/1743419049362-create-order_items-table.ts diff --git a/database/migrations/1743417329707-create-shipping_zones-table.ts b/database/migrations/1743419049384-create-shipping_zones-table.ts similarity index 100% rename from database/migrations/1743417329707-create-shipping_zones-table.ts rename to database/migrations/1743419049384-create-shipping_zones-table.ts diff --git a/database/migrations/1743417329724-create-customers-table.ts b/database/migrations/1743419049402-create-customers-table.ts similarity index 100% rename from database/migrations/1743417329724-create-customers-table.ts rename to database/migrations/1743419049402-create-customers-table.ts diff --git a/database/migrations/1743417329743-create-products-table.ts b/database/migrations/1743419049497-create-products-table.ts similarity index 100% rename from database/migrations/1743417329743-create-products-table.ts rename to database/migrations/1743419049497-create-products-table.ts diff --git a/database/migrations/1743417329940-create-print_logs-table.ts b/database/migrations/1743419049531-create-receipts-table.ts similarity index 96% rename from database/migrations/1743417329940-create-print_logs-table.ts rename to database/migrations/1743419049531-create-receipts-table.ts index cbb29f4818..c887e6e8d0 100644 --- a/database/migrations/1743417329940-create-print_logs-table.ts +++ b/database/migrations/1743419049531-create-receipts-table.ts @@ -3,7 +3,7 @@ import { sql } from '@stacksjs/database' export async function up(db: Database) { await db.schema - .createTable('print_logs') + .createTable('receipts') .addColumn('id', 'integer', col => col.primaryKey().autoIncrement()) .addColumn('uuid', 'text') .addColumn('printer', 'text', col => col.notNull()) diff --git a/database/migrations/1743417329762-create-product_variants-table.ts b/database/migrations/1743419049595-create-product_variants-table.ts similarity index 100% rename from database/migrations/1743417329762-create-product_variants-table.ts rename to database/migrations/1743419049595-create-product_variants-table.ts diff --git a/database/migrations/1743417329783-create-license_keys-table.ts b/database/migrations/1743419049828-create-license_keys-table.ts similarity index 100% rename from database/migrations/1743417329783-create-license_keys-table.ts rename to database/migrations/1743419049828-create-license_keys-table.ts diff --git a/database/migrations/1743417329802-create-waitlist_restaurants-table.ts b/database/migrations/1743419049897-create-waitlist_restaurants-table.ts similarity index 100% rename from database/migrations/1743417329802-create-waitlist_restaurants-table.ts rename to database/migrations/1743419049897-create-waitlist_restaurants-table.ts diff --git a/database/migrations/1743417329821-create-reviews-table.ts b/database/migrations/1743419049954-create-reviews-table.ts similarity index 100% rename from database/migrations/1743417329821-create-reviews-table.ts rename to database/migrations/1743419049954-create-reviews-table.ts diff --git a/database/migrations/1743417329841-create-product_units-table.ts b/database/migrations/1743419049975-create-product_units-table.ts similarity index 100% rename from database/migrations/1743417329841-create-product_units-table.ts rename to database/migrations/1743419049975-create-product_units-table.ts diff --git a/database/migrations/1743417329862-create-gift_cards-table.ts b/database/migrations/1743419049995-create-gift_cards-table.ts similarity index 100% rename from database/migrations/1743417329862-create-gift_cards-table.ts rename to database/migrations/1743419049995-create-gift_cards-table.ts diff --git a/database/migrations/1743417329881-create-orders-table.ts b/database/migrations/1743419050016-create-orders-table.ts similarity index 100% rename from database/migrations/1743417329881-create-orders-table.ts rename to database/migrations/1743419050016-create-orders-table.ts diff --git a/database/migrations/1743417329901-create-coupons-table.ts b/database/migrations/1743419050048-create-coupons-table.ts similarity index 100% rename from database/migrations/1743417329901-create-coupons-table.ts rename to database/migrations/1743419050048-create-coupons-table.ts diff --git a/database/migrations/1743417329921-create-tax_rates-table.ts b/database/migrations/1743419050071-create-tax_rates-table.ts similarity index 100% rename from database/migrations/1743417329921-create-tax_rates-table.ts rename to database/migrations/1743419050071-create-tax_rates-table.ts diff --git a/database/migrations/1743417329962-create-transactions-table.ts b/database/migrations/1743419050100-create-transactions-table.ts similarity index 100% rename from database/migrations/1743417329962-create-transactions-table.ts rename to database/migrations/1743419050100-create-transactions-table.ts diff --git a/database/migrations/1743417329982-create-loyalty_points-table.ts b/database/migrations/1743419050127-create-loyalty_points-table.ts similarity index 100% rename from database/migrations/1743417329982-create-loyalty_points-table.ts rename to database/migrations/1743419050127-create-loyalty_points-table.ts diff --git a/database/migrations/1743417330003-create-product_items-table.ts b/database/migrations/1743419050150-create-product_items-table.ts similarity index 100% rename from database/migrations/1743417330003-create-product_items-table.ts rename to database/migrations/1743419050150-create-product_items-table.ts diff --git a/database/migrations/1743417330023-create-loyalty_rewards-table.ts b/database/migrations/1743419050180-create-loyalty_rewards-table.ts similarity index 100% rename from database/migrations/1743417330023-create-loyalty_rewards-table.ts rename to database/migrations/1743419050180-create-loyalty_rewards-table.ts diff --git a/database/migrations/1743417330044-create-shipping_methods-table.ts b/database/migrations/1743419050203-create-shipping_methods-table.ts similarity index 100% rename from database/migrations/1743417330044-create-shipping_methods-table.ts rename to database/migrations/1743419050203-create-shipping_methods-table.ts diff --git a/database/migrations/1743417330064-create-shipping_rates-table.ts b/database/migrations/1743419050227-create-shipping_rates-table.ts similarity index 100% rename from database/migrations/1743417330064-create-shipping_rates-table.ts rename to database/migrations/1743419050227-create-shipping_rates-table.ts diff --git a/database/migrations/1743417330084-create-delivery_routes-table.ts b/database/migrations/1743419050255-create-delivery_routes-table.ts similarity index 100% rename from database/migrations/1743417330084-create-delivery_routes-table.ts rename to database/migrations/1743419050255-create-delivery_routes-table.ts diff --git a/database/migrations/1743417330103-create-failed_jobs-table.ts b/database/migrations/1743419050276-create-failed_jobs-table.ts similarity index 100% rename from database/migrations/1743417330103-create-failed_jobs-table.ts rename to database/migrations/1743419050276-create-failed_jobs-table.ts diff --git a/database/migrations/1743417330123-create-payment_methods-table.ts b/database/migrations/1743419050296-create-payment_methods-table.ts similarity index 100% rename from database/migrations/1743417330123-create-payment_methods-table.ts rename to database/migrations/1743419050296-create-payment_methods-table.ts diff --git a/database/migrations/1743417330142-create-payment_transactions-table.ts b/database/migrations/1743419050317-create-payment_transactions-table.ts similarity index 100% rename from database/migrations/1743417330142-create-payment_transactions-table.ts rename to database/migrations/1743419050317-create-payment_transactions-table.ts diff --git a/database/migrations/1743417330162-create-requests-table.ts b/database/migrations/1743419050337-create-requests-table.ts similarity index 100% rename from database/migrations/1743417330162-create-requests-table.ts rename to database/migrations/1743419050337-create-requests-table.ts diff --git a/database/migrations/1743417330181-create-jobs-table.ts b/database/migrations/1743419050357-create-jobs-table.ts similarity index 100% rename from database/migrations/1743417330181-create-jobs-table.ts rename to database/migrations/1743419050357-create-jobs-table.ts diff --git a/database/migrations/1743417330201-create-subscriptions-table.ts b/database/migrations/1743419050379-create-subscriptions-table.ts similarity index 100% rename from database/migrations/1743417330201-create-subscriptions-table.ts rename to database/migrations/1743419050379-create-subscriptions-table.ts diff --git a/database/migrations/1743417330222-create-payment_products-table.ts b/database/migrations/1743419050401-create-payment_products-table.ts similarity index 100% rename from database/migrations/1743417330222-create-payment_products-table.ts rename to database/migrations/1743419050401-create-payment_products-table.ts diff --git a/database/migrations/1743417330241-create-errors-table.ts b/database/migrations/1743419050421-create-errors-table.ts similarity index 100% rename from database/migrations/1743417330241-create-errors-table.ts rename to database/migrations/1743419050421-create-errors-table.ts diff --git a/storage/framework/actions/src/PrintLogDestroyOrmAction.ts b/storage/framework/actions/src/PrintLogDestroyOrmAction.ts deleted file mode 100644 index 6474d72e9a..0000000000 --- a/storage/framework/actions/src/PrintLogDestroyOrmAction.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { PrintLogRequestType } from '@stacksjs/orm' -import { Action } from '@stacksjs/actions' - -import { PrintLog } from '@stacksjs/orm' -import { response } from '@stacksjs/router' - -export default new Action({ - name: 'PrintLog Destroy', - description: 'PrintLog Destroy ORM Action', - method: 'DELETE', - async handle(request: PrintLogRequestType) { - const id = request.getParam('id') - - const model = await PrintLog.findOrFail(Number(id)) - - model.delete() - - return response.json({ message: 'Model deleted!' }) - }, -}) diff --git a/storage/framework/actions/src/PrintLogShowOrmAction.ts b/storage/framework/actions/src/PrintLogShowOrmAction.ts deleted file mode 100644 index 8cf535d32e..0000000000 --- a/storage/framework/actions/src/PrintLogShowOrmAction.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { PrintLogRequestType } from '@stacksjs/orm' -import { Action } from '@stacksjs/actions' - -import { PrintLog } from '@stacksjs/orm' -import { response } from '@stacksjs/router' - -export default new Action({ - name: 'PrintLog Show', - description: 'PrintLog Show ORM Action', - method: 'GET', - async handle(request: PrintLogRequestType) { - const id = request.getParam('id') - - const model = await PrintLog.findOrFail(Number(id)) - - return response.json(model) - }, -}) diff --git a/storage/framework/actions/src/PrintLogStoreOrmAction.ts b/storage/framework/actions/src/PrintLogStoreOrmAction.ts deleted file mode 100644 index 5e0dfe1843..0000000000 --- a/storage/framework/actions/src/PrintLogStoreOrmAction.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { PrintLogRequestType } from '@stacksjs/orm' -import { Action } from '@stacksjs/actions' - -import { PrintLog } from '@stacksjs/orm' -import { response } from '@stacksjs/router' - -export default new Action({ - name: 'PrintLog Store', - description: 'PrintLog Store ORM Action', - method: 'POST', - async handle(request: PrintLogRequestType) { - await request.validate() - const model = await PrintLog.create(request.all()) - - return response.json(model) - }, -}) diff --git a/storage/framework/actions/src/ReceiptDestroyOrmAction.ts b/storage/framework/actions/src/ReceiptDestroyOrmAction.ts new file mode 100644 index 0000000000..0fe0ef08b2 --- /dev/null +++ b/storage/framework/actions/src/ReceiptDestroyOrmAction.ts @@ -0,0 +1,20 @@ +import type { ReceiptRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { Receipt } from '@stacksjs/orm' +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'Receipt Destroy', + description: 'Receipt Destroy ORM Action', + method: 'DELETE', + async handle(request: ReceiptRequestType) { + const id = request.getParam('id') + + const model = await Receipt.findOrFail(Number(id)) + + model.delete() + + return response.json({ message: 'Model deleted!' }) + }, +}) diff --git a/storage/framework/actions/src/PrintLogIndexOrmAction.ts b/storage/framework/actions/src/ReceiptIndexOrmAction.ts similarity index 65% rename from storage/framework/actions/src/PrintLogIndexOrmAction.ts rename to storage/framework/actions/src/ReceiptIndexOrmAction.ts index b1618b8251..5c642c0d47 100644 --- a/storage/framework/actions/src/PrintLogIndexOrmAction.ts +++ b/storage/framework/actions/src/ReceiptIndexOrmAction.ts @@ -2,11 +2,11 @@ import { Action } from '@stacksjs/actions' import { response } from '@stacksjs/router' export default new Action({ - name: 'PrintLog Index', - description: 'PrintLog Index ORM Action', + name: 'Receipt Index', + description: 'Receipt Index ORM Action', method: 'GET', async handle() { - const results = PrintLog.all() + const results = Receipt.all() return response.json(results) }, diff --git a/storage/framework/actions/src/ReceiptShowOrmAction.ts b/storage/framework/actions/src/ReceiptShowOrmAction.ts new file mode 100644 index 0000000000..0d31f8a10c --- /dev/null +++ b/storage/framework/actions/src/ReceiptShowOrmAction.ts @@ -0,0 +1,18 @@ +import type { ReceiptRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { Receipt } from '@stacksjs/orm' +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'Receipt Show', + description: 'Receipt Show ORM Action', + method: 'GET', + async handle(request: ReceiptRequestType) { + const id = request.getParam('id') + + const model = await Receipt.findOrFail(Number(id)) + + return response.json(model) + }, +}) diff --git a/storage/framework/actions/src/ReceiptStoreOrmAction.ts b/storage/framework/actions/src/ReceiptStoreOrmAction.ts new file mode 100644 index 0000000000..6b183051e4 --- /dev/null +++ b/storage/framework/actions/src/ReceiptStoreOrmAction.ts @@ -0,0 +1,17 @@ +import type { ReceiptRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { Receipt } from '@stacksjs/orm' +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'Receipt Store', + description: 'Receipt Store ORM Action', + method: 'POST', + async handle(request: ReceiptRequestType) { + await request.validate() + const model = await Receipt.create(request.all()) + + return response.json(model) + }, +}) diff --git a/storage/framework/actions/src/PrintLogUpdateOrmAction.ts b/storage/framework/actions/src/ReceiptUpdateOrmAction.ts similarity index 51% rename from storage/framework/actions/src/PrintLogUpdateOrmAction.ts rename to storage/framework/actions/src/ReceiptUpdateOrmAction.ts index 4f6d8f1794..7e15edfa1f 100644 --- a/storage/framework/actions/src/PrintLogUpdateOrmAction.ts +++ b/storage/framework/actions/src/ReceiptUpdateOrmAction.ts @@ -1,18 +1,18 @@ -import type { PrintLogRequestType } from '@stacksjs/orm' +import type { ReceiptRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { PrintLog } from '@stacksjs/orm' +import { Receipt } from '@stacksjs/orm' import { response } from '@stacksjs/router' export default new Action({ - name: 'PrintLog Update', - description: 'PrintLog Update ORM Action', + name: 'Receipt Update', + description: 'Receipt Update ORM Action', method: 'PATCH', - async handle(request: PrintLogRequestType) { + async handle(request: ReceiptRequestType) { await request.validate() const id = request.getParam('id') - const model = await PrintLog.findOrFail(Number(id)) + const model = await Receipt.findOrFail(Number(id)) const result = model.update(request.all()) diff --git a/storage/framework/core/types/src/model-names.ts b/storage/framework/core/types/src/model-names.ts index 7df19c9f47..c66192070b 100644 --- a/storage/framework/core/types/src/model-names.ts +++ b/storage/framework/core/types/src/model-names.ts @@ -1 +1 @@ -export type ModelNames = 'Project' | 'SubscriberEmail' | 'AccessToken' | 'Team' | 'Subscriber' | 'Deployment' | 'Release' | 'User' | 'Post' | 'Category' | 'Payment' | 'Driver' | 'WaitlistProduct' | 'DigitalDelivery' | 'Manufacturer' | 'OrderItem' | 'ShippingZone' | 'Customer' | 'Product' | 'ProductVariant' | 'LicenseKey' | 'WaitlistRestaurant' | 'Review' | 'ProductUnit' | 'GiftCard' | 'Order' | 'Coupon' | 'TaxRate' | 'PrintLog' | 'Transaction' | 'LoyaltyPoint' | 'ProductItem' | 'LoyaltyReward' | 'ShippingMethod' | 'ShippingRate' | 'DeliveryRoute' | 'FailedJob' | 'PaymentMethod' | 'PaymentTransaction' | 'Request' | 'Job' | 'Subscription' | 'PaymentProduct' | 'Error' +export type ModelNames = 'Project' | 'SubscriberEmail' | 'AccessToken' | 'Team' | 'Subscriber' | 'Deployment' | 'Release' | 'User' | 'Post' | 'Category' | 'Payment' | 'Driver' | 'WaitlistProduct' | 'DigitalDelivery' | 'Manufacturer' | 'OrderItem' | 'ShippingZone' | 'Customer' | 'Product' | 'Receipt' | 'ProductVariant' | 'LicenseKey' | 'WaitlistRestaurant' | 'Review' | 'ProductUnit' | 'GiftCard' | 'Order' | 'Coupon' | 'TaxRate' | 'Transaction' | 'LoyaltyPoint' | 'ProductItem' | 'LoyaltyReward' | 'ShippingMethod' | 'ShippingRate' | 'DeliveryRoute' | 'FailedJob' | 'PaymentMethod' | 'PaymentTransaction' | 'Request' | 'Job' | 'Subscription' | 'PaymentProduct' | 'Error' diff --git a/storage/framework/core/types/src/table-names.ts b/storage/framework/core/types/src/table-names.ts index d3f37d486c..dab9d91908 100644 --- a/storage/framework/core/types/src/table-names.ts +++ b/storage/framework/core/types/src/table-names.ts @@ -1 +1 @@ -export type TableNames = 'projects' | 'subscriber_emails' | 'personal_access_tokens' | 'team_users' | 'teams' | 'subscribers' | 'deployments' | 'releases' | 'team_users' | 'users' | 'posts' | 'categories' | 'payments' | 'drivers' | 'waitlist_products' | 'digital_deliveries' | 'manufacturers' | 'order_items' | 'shipping_zones' | 'customers' | 'products' | 'product_variants' | 'license_keys' | 'waitlist_restaurants' | 'reviews' | 'product_units' | 'gift_cards' | 'orders' | 'coupons' | 'tax_rates' | 'print_logs' | 'transactions' | 'loyalty_points' | 'product_items' | 'loyalty_rewards' | 'shipping_methods' | 'shipping_rates' | 'delivery_routes' | 'failed_jobs' | 'payment_methods' | 'payment_transactions' | 'requests' | 'jobs' | 'subscriptions' | 'payment_products' | 'errors' +export type TableNames = 'projects' | 'subscriber_emails' | 'personal_access_tokens' | 'team_users' | 'teams' | 'subscribers' | 'deployments' | 'releases' | 'team_users' | 'users' | 'posts' | 'categories' | 'payments' | 'drivers' | 'waitlist_products' | 'digital_deliveries' | 'manufacturers' | 'order_items' | 'shipping_zones' | 'customers' | 'products' | 'receipts' | 'product_variants' | 'license_keys' | 'waitlist_restaurants' | 'reviews' | 'product_units' | 'gift_cards' | 'orders' | 'coupons' | 'tax_rates' | 'transactions' | 'loyalty_points' | 'product_items' | 'loyalty_rewards' | 'shipping_methods' | 'shipping_rates' | 'delivery_routes' | 'failed_jobs' | 'payment_methods' | 'payment_transactions' | 'requests' | 'jobs' | 'subscriptions' | 'payment_products' | 'errors' diff --git a/storage/framework/defaults/models/ecommerce/PrintLog.ts b/storage/framework/defaults/models/ecommerce/Receipt.ts similarity index 98% rename from storage/framework/defaults/models/ecommerce/PrintLog.ts rename to storage/framework/defaults/models/ecommerce/Receipt.ts index 6c2b90123e..ac78ff6075 100644 --- a/storage/framework/defaults/models/ecommerce/PrintLog.ts +++ b/storage/framework/defaults/models/ecommerce/Receipt.ts @@ -2,8 +2,8 @@ import type { Model } from '@stacksjs/types' import { schema } from '@stacksjs/validation' export default { - name: 'PrintLog', - table: 'print_logs', + name: 'Receipt', + table: 'receipts', primaryKey: 'id', autoIncrement: true, diff --git a/storage/framework/models/PrintLog.ts b/storage/framework/models/Receipt.ts similarity index 98% rename from storage/framework/models/PrintLog.ts rename to storage/framework/models/Receipt.ts index 6c2b90123e..ac78ff6075 100644 --- a/storage/framework/models/PrintLog.ts +++ b/storage/framework/models/Receipt.ts @@ -2,8 +2,8 @@ import type { Model } from '@stacksjs/types' import { schema } from '@stacksjs/validation' export default { - name: 'PrintLog', - table: 'print_logs', + name: 'Receipt', + table: 'receipts', primaryKey: 'id', autoIncrement: true, diff --git a/storage/framework/orm/routes.ts b/storage/framework/orm/routes.ts index 9d243617dc..de893fe930 100644 --- a/storage/framework/orm/routes.ts +++ b/storage/framework/orm/routes.ts @@ -80,6 +80,16 @@ route.post('products', 'ProductStoreOrmAction') route.get('products/{id}', 'ProductShowOrmAction') +route.get('print-logs', 'ReceiptIndexOrmAction') + +route.post('print-logs', 'ReceiptStoreOrmAction') + +route.get('print-logs/{id}', 'ReceiptShowOrmAction') + +route.patch('print-logs/{id}', 'ReceiptUpdateOrmAction') + +route.delete('print-logs/{id}', 'ReceiptDestroyOrmAction') + route.get('product-variants', 'ProductVariantIndexOrmAction') route.post('product-variants', 'ProductVariantStoreOrmAction') @@ -150,16 +160,6 @@ route.patch('tax-rates/{id}', 'TaxRateUpdateOrmAction') route.delete('tax-rates/{id}', 'TaxRateDestroyOrmAction') -route.get('print-logs', 'PrintLogIndexOrmAction') - -route.post('print-logs', 'PrintLogStoreOrmAction') - -route.get('print-logs/{id}', 'PrintLogShowOrmAction') - -route.patch('print-logs/{id}', 'PrintLogUpdateOrmAction') - -route.delete('print-logs/{id}', 'PrintLogDestroyOrmAction') - route.get('transactions', 'TransactionIndexOrmAction') route.post('transactions', 'TransactionStoreOrmAction') diff --git a/storage/framework/orm/src/index.ts b/storage/framework/orm/src/index.ts index 5dd80d5b17..96d9758a3d 100644 --- a/storage/framework/orm/src/index.ts +++ b/storage/framework/orm/src/index.ts @@ -44,8 +44,6 @@ export { type NewPaymentTransaction, default as PaymentTransaction, type Payment export { type NewPost, default as Post, type PostJsonResponse, type PostUpdate } from './models/Post' -export { type NewPrintLog, default as PrintLog, type PrintLogJsonResponse, type PrintLogUpdate } from './models/PrintLog' - export { type NewProduct, default as Product, type ProductJsonResponse, type ProductUpdate } from './models/Product' export { type NewProductItem, default as ProductItem, type ProductItemJsonResponse, type ProductItemUpdate } from './models/ProductItem' @@ -56,6 +54,8 @@ export { type NewProductVariant, default as ProductVariant, type ProductVariantJ export { type NewProject, default as Project, type ProjectJsonResponse, type ProjectUpdate } from './models/Project' +export { type NewReceipt, default as Receipt, type ReceiptJsonResponse, type ReceiptUpdate } from './models/Receipt' + export { type NewRelease, default as Release, type ReleaseJsonResponse, type ReleaseUpdate } from './models/Release' export { type NewRequest, default as Request, type RequestJsonResponse, type RequestUpdate } from './models/Request' diff --git a/storage/framework/orm/src/models/PrintLog.ts b/storage/framework/orm/src/models/PrintLog.ts deleted file mode 100644 index 44aa3c98ca..0000000000 --- a/storage/framework/orm/src/models/PrintLog.ts +++ /dev/null @@ -1,1032 +0,0 @@ -import type { Generated, Insertable, RawBuilder, Selectable, Updateable } from '@stacksjs/database' -import type { Operator } from '@stacksjs/orm' -import { randomUUIDv7 } from 'bun' -import { sql } from '@stacksjs/database' -import { HttpError } from '@stacksjs/error-handling' -import { dispatch } from '@stacksjs/events' -import { DB } from '@stacksjs/orm' -import { BaseOrm } from '../utils/base' - -export interface PrintLogsTable { - id: Generated - printer: string - document: string - timestamp: number - status: string | string[] - size?: number - pages?: number - duration?: number - uuid?: string - - created_at?: string - - updated_at?: string - -} - -export interface PrintLogResponse { - data: PrintLogJsonResponse[] - paging: { - total_records: number - page: number - total_pages: number - } - next_cursor: number | null -} - -export interface PrintLogJsonResponse extends Omit, 'password'> { - [key: string]: any -} - -export type NewPrintLog = Insertable -export type PrintLogUpdate = Updateable - -export class PrintLogModel extends BaseOrm { - private readonly hidden: Array = [] - private readonly fillable: Array = ['printer', 'document', 'timestamp', 'status', 'size', 'pages', 'duration', 'uuid'] - private readonly guarded: Array = [] - protected attributes = {} as PrintLogJsonResponse - protected originalAttributes = {} as PrintLogJsonResponse - - protected selectFromQuery: any - protected updateFromQuery: any - protected deleteFromQuery: any - protected hasSelect: boolean - private customColumns: Record = {} - - /** - * This model inherits many query methods from BaseOrm: - * - pluck, chunk, whereExists, has, doesntHave, whereHas, whereDoesntHave - * - inRandomOrder, max, min, avg, paginate, get, and more - * - * See BaseOrm class for the full list of inherited methods. - */ - - constructor(printLog: PrintLogJsonResponse | undefined) { - super('print_logs') - if (printLog) { - this.attributes = { ...printLog } - this.originalAttributes = { ...printLog } - - Object.keys(printLog).forEach((key) => { - if (!(key in this)) { - this.customColumns[key] = (printLog as PrintLogJsonResponse)[key] - } - }) - } - - this.withRelations = [] - this.selectFromQuery = DB.instance.selectFrom('print_logs') - this.updateFromQuery = DB.instance.updateTable('print_logs') - this.deleteFromQuery = DB.instance.deleteFrom('print_logs') - this.hasSelect = false - this.hasSaved = false - } - - protected async loadRelations(models: PrintLogJsonResponse | PrintLogJsonResponse[]): Promise { - // Handle both single model and array of models - const modelArray = Array.isArray(models) ? models : [models] - if (!modelArray.length) - return - - const modelIds = modelArray.map(model => model.id) - - for (const relation of this.withRelations) { - const relatedRecords = await DB.instance - .selectFrom(relation) - .where('printLog_id', 'in', modelIds) - .selectAll() - .execute() - - if (Array.isArray(models)) { - models.map((model: PrintLogJsonResponse) => { - const records = relatedRecords.filter((record: { printLog_id: number }) => { - return record.printLog_id === model.id - }) - - model[relation] = records.length === 1 ? records[0] : records - return model - }) - } - else { - const records = relatedRecords.filter((record: { printLog_id: number }) => { - return record.printLog_id === models.id - }) - - models[relation] = records.length === 1 ? records[0] : records - } - } - } - - static with(relations: string[]): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyWith(relations) - } - - protected mapCustomGetters(models: PrintLogJsonResponse | PrintLogJsonResponse[]): void { - const data = models - - if (Array.isArray(data)) { - data.map((model: PrintLogJsonResponse) => { - const customGetter = { - default: () => { - }, - - } - - for (const [key, fn] of Object.entries(customGetter)) { - (model as any)[key] = fn() - } - - return model - }) - } - else { - const model = data - - const customGetter = { - default: () => { - }, - - } - - for (const [key, fn] of Object.entries(customGetter)) { - (model as any)[key] = fn() - } - } - } - - async mapCustomSetters(model: NewPrintLog | PrintLogUpdate): Promise { - const customSetter = { - default: () => { - }, - - } - - for (const [key, fn] of Object.entries(customSetter)) { - (model as any)[key] = await fn() - } - } - - get id(): number { - return this.attributes.id - } - - get uuid(): string | undefined { - return this.attributes.uuid - } - - get printer(): string { - return this.attributes.printer - } - - get document(): string { - return this.attributes.document - } - - get timestamp(): number { - return this.attributes.timestamp - } - - get status(): string | string[] { - return this.attributes.status - } - - get size(): number | undefined { - return this.attributes.size - } - - get pages(): number | undefined { - return this.attributes.pages - } - - get duration(): number | undefined { - return this.attributes.duration - } - - get created_at(): string | undefined { - return this.attributes.created_at - } - - get updated_at(): string | undefined { - return this.attributes.updated_at - } - - set uuid(value: string) { - this.attributes.uuid = value - } - - set printer(value: string) { - this.attributes.printer = value - } - - set document(value: string) { - this.attributes.document = value - } - - set timestamp(value: number) { - this.attributes.timestamp = value - } - - set status(value: string | string[]) { - this.attributes.status = value - } - - set size(value: number) { - this.attributes.size = value - } - - set pages(value: number) { - this.attributes.pages = value - } - - set duration(value: number) { - this.attributes.duration = value - } - - set updated_at(value: string) { - this.attributes.updated_at = value - } - - static select(params: (keyof PrintLogJsonResponse)[] | RawBuilder | string): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applySelect(params) - } - - // Method to find a PrintLog by ID - static async find(id: number): Promise { - const query = DB.instance.selectFrom('print_logs').where('id', '=', id).selectAll() - - const model = await query.executeTakeFirst() - - if (!model) - return undefined - - const instance = new PrintLogModel(undefined) - return instance.createInstance(model) - } - - static async first(): Promise { - const instance = new PrintLogModel(undefined) - - const model = await instance.applyFirst() - - const data = new PrintLogModel(model) - - return data - } - - static async last(): Promise { - const instance = new PrintLogModel(undefined) - - const model = await instance.applyLast() - - if (!model) - return undefined - - return new PrintLogModel(model) - } - - static async firstOrFail(): Promise { - const instance = new PrintLogModel(undefined) - - return await instance.applyFirstOrFail() - } - - static async all(): Promise { - const instance = new PrintLogModel(undefined) - - const models = await DB.instance.selectFrom('print_logs').selectAll().execute() - - instance.mapCustomGetters(models) - - const data = await Promise.all(models.map(async (model: PrintLogJsonResponse) => { - return new PrintLogModel(model) - })) - - return data - } - - static async findOrFail(id: number): Promise { - const instance = new PrintLogModel(undefined) - - return await instance.applyFindOrFail(id) - } - - static async findMany(ids: number[]): Promise { - const instance = new PrintLogModel(undefined) - - const models = await instance.applyFindMany(ids) - - return models.map((modelItem: PrintLogJsonResponse) => instance.parseResult(new PrintLogModel(modelItem))) - } - - static async latest(column: keyof PrintLogsTable = 'created_at'): Promise { - const instance = new PrintLogModel(undefined) - - const model = await instance.selectFromQuery - .selectAll() - .orderBy(column, 'desc') - .limit(1) - .executeTakeFirst() - - if (!model) - return undefined - - return new PrintLogModel(model) - } - - static async oldest(column: keyof PrintLogsTable = 'created_at'): Promise { - const instance = new PrintLogModel(undefined) - - const model = await instance.selectFromQuery - .selectAll() - .orderBy(column, 'asc') - .limit(1) - .executeTakeFirst() - - if (!model) - return undefined - - return new PrintLogModel(model) - } - - static skip(count: number): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applySkip(count) - } - - static take(count: number): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyTake(count) - } - - static where(column: keyof PrintLogsTable, ...args: [V] | [Operator, V]): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyWhere(column, ...args) - } - - static orWhere(...conditions: [string, any][]): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyOrWhere(...conditions) - } - - static whereNotIn(column: keyof PrintLogsTable, values: V[]): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyWhereNotIn(column, values) - } - - static whereBetween(column: keyof PrintLogsTable, range: [V, V]): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyWhereBetween(column, range) - } - - static whereRef(column: keyof PrintLogsTable, ...args: string[]): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyWhereRef(column, ...args) - } - - static when(condition: boolean, callback: (query: PrintLogModel) => PrintLogModel): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyWhen(condition, callback as any) - } - - static whereNull(column: keyof PrintLogsTable): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyWhereNull(column) - } - - static whereNotNull(column: keyof PrintLogsTable): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyWhereNotNull(column) - } - - static whereLike(column: keyof PrintLogsTable, value: string): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyWhereLike(column, value) - } - - static orderBy(column: keyof PrintLogsTable, order: 'asc' | 'desc'): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyOrderBy(column, order) - } - - static orderByAsc(column: keyof PrintLogsTable): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyOrderByAsc(column) - } - - static orderByDesc(column: keyof PrintLogsTable): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyOrderByDesc(column) - } - - static groupBy(column: keyof PrintLogsTable): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyGroupBy(column) - } - - static having(column: keyof PrintLogsTable, operator: Operator, value: V): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyHaving(column, operator, value) - } - - static inRandomOrder(): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyInRandomOrder() - } - - static whereColumn(first: keyof PrintLogsTable, operator: Operator, second: keyof PrintLogsTable): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyWhereColumn(first, operator, second) - } - - static async max(field: keyof PrintLogsTable): Promise { - const instance = new PrintLogModel(undefined) - - return await instance.applyMax(field) - } - - static async min(field: keyof PrintLogsTable): Promise { - const instance = new PrintLogModel(undefined) - - return await instance.applyMin(field) - } - - static async avg(field: keyof PrintLogsTable): Promise { - const instance = new PrintLogModel(undefined) - - return await instance.applyAvg(field) - } - - static async sum(field: keyof PrintLogsTable): Promise { - const instance = new PrintLogModel(undefined) - - return await instance.applySum(field) - } - - static async count(): Promise { - const instance = new PrintLogModel(undefined) - - return instance.applyCount() - } - - static async get(): Promise { - const instance = new PrintLogModel(undefined) - - const results = await instance.applyGet() - - return results.map((item: PrintLogJsonResponse) => instance.createInstance(item)) - } - - static async pluck(field: K): Promise { - const instance = new PrintLogModel(undefined) - - return await instance.applyPluck(field) - } - - static async chunk(size: number, callback: (models: PrintLogModel[]) => Promise): Promise { - const instance = new PrintLogModel(undefined) - - await instance.applyChunk(size, async (models) => { - const modelInstances = models.map((item: PrintLogJsonResponse) => instance.createInstance(item)) - await callback(modelInstances) - }) - } - - static async paginate(options: { limit?: number, offset?: number, page?: number } = { limit: 10, offset: 0, page: 1 }): Promise<{ - data: PrintLogModel[] - paging: { - total_records: number - page: number - total_pages: number - } - next_cursor: number | null - }> { - const instance = new PrintLogModel(undefined) - - const result = await instance.applyPaginate(options) - - return { - data: result.data.map((item: PrintLogJsonResponse) => instance.createInstance(item)), - paging: result.paging, - next_cursor: result.next_cursor, - } - } - - // Instance method for creating model instances - createInstance(data: PrintLogJsonResponse): PrintLogModel { - return new PrintLogModel(data) - } - - async applyCreate(newPrintLog: NewPrintLog): Promise { - const filteredValues = Object.fromEntries( - Object.entries(newPrintLog).filter(([key]) => - !this.guarded.includes(key) && this.fillable.includes(key), - ), - ) as NewPrintLog - - await this.mapCustomSetters(filteredValues) - - filteredValues.uuid = randomUUIDv7() - - const result = await DB.instance.insertInto('print_logs') - .values(filteredValues) - .executeTakeFirst() - - const model = await DB.instance.selectFrom('print_logs') - .where('id', '=', Number(result.insertId || result.numInsertedOrUpdatedRows)) - .selectAll() - .executeTakeFirst() - - if (!model) { - throw new HttpError(500, 'Failed to retrieve created PrintLog') - } - - if (model) - dispatch('printLog:created', model) - return this.createInstance(model) - } - - async create(newPrintLog: NewPrintLog): Promise { - return await this.applyCreate(newPrintLog) - } - - static async create(newPrintLog: NewPrintLog): Promise { - const instance = new PrintLogModel(undefined) - return await instance.applyCreate(newPrintLog) - } - - static async firstOrCreate(search: Partial, values: NewPrintLog = {} as NewPrintLog): Promise { - // First try to find a record matching the search criteria - const instance = new PrintLogModel(undefined) - - // Apply all search conditions - for (const [key, value] of Object.entries(search)) { - instance.selectFromQuery = instance.selectFromQuery.where(key, '=', value) - } - - // Try to find the record - const existingRecord = await instance.applyFirst() - - if (existingRecord) { - return instance.createInstance(existingRecord) - } - - // If no record exists, create a new one with combined search criteria and values - const createData = { ...search, ...values } as NewPrintLog - return await PrintLogModel.create(createData) - } - - static async updateOrCreate(search: Partial, values: NewPrintLog = {} as NewPrintLog): Promise { - // First try to find a record matching the search criteria - const instance = new PrintLogModel(undefined) - - // Apply all search conditions - for (const [key, value] of Object.entries(search)) { - instance.selectFromQuery = instance.selectFromQuery.where(key, '=', value) - } - - // Try to find the record - const existingRecord = await instance.applyFirst() - - if (existingRecord) { - // If record exists, update it with the new values - const model = instance.createInstance(existingRecord) - const updatedModel = await model.update(values as PrintLogUpdate) - - // Return the updated model instance - if (updatedModel) { - return updatedModel - } - - // If update didn't return a model, fetch it again to ensure we have latest data - const refreshedModel = await instance.applyFirst() - return instance.createInstance(refreshedModel!) - } - - // If no record exists, create a new one with combined search criteria and values - const createData = { ...search, ...values } as NewPrintLog - return await PrintLogModel.create(createData) - } - - async update(newPrintLog: PrintLogUpdate): Promise { - const filteredValues = Object.fromEntries( - Object.entries(newPrintLog).filter(([key]) => - !this.guarded.includes(key) && this.fillable.includes(key), - ), - ) as PrintLogUpdate - - await this.mapCustomSetters(filteredValues) - - filteredValues.updated_at = new Date().toISOString() - - await DB.instance.updateTable('print_logs') - .set(filteredValues) - .where('id', '=', this.id) - .executeTakeFirst() - - if (this.id) { - // Get the updated data - const model = await DB.instance.selectFrom('print_logs') - .where('id', '=', this.id) - .selectAll() - .executeTakeFirst() - - if (!model) { - throw new HttpError(500, 'Failed to retrieve updated PrintLog') - } - - if (model) - dispatch('printLog:updated', model) - return this.createInstance(model) - } - - this.hasSaved = true - - return undefined - } - - async forceUpdate(newPrintLog: PrintLogUpdate): Promise { - await DB.instance.updateTable('print_logs') - .set(newPrintLog) - .where('id', '=', this.id) - .executeTakeFirst() - - if (this.id) { - // Get the updated data - const model = await DB.instance.selectFrom('print_logs') - .where('id', '=', this.id) - .selectAll() - .executeTakeFirst() - - if (!model) { - throw new HttpError(500, 'Failed to retrieve updated PrintLog') - } - - if (this) - dispatch('printLog:updated', model) - return this.createInstance(model) - } - - return undefined - } - - async save(): Promise { - // If the model has an ID, update it; otherwise, create a new record - if (this.id) { - // Update existing record - await DB.instance.updateTable('print_logs') - .set(this.attributes as PrintLogUpdate) - .where('id', '=', this.id) - .executeTakeFirst() - - // Get the updated data - const model = await DB.instance.selectFrom('print_logs') - .where('id', '=', this.id) - .selectAll() - .executeTakeFirst() - - if (!model) { - throw new HttpError(500, 'Failed to retrieve updated PrintLog') - } - - if (this) - dispatch('printLog:updated', model) - return this.createInstance(model) - } - else { - // Create new record - const result = await DB.instance.insertInto('print_logs') - .values(this.attributes as NewPrintLog) - .executeTakeFirst() - - // Get the created data - const model = await DB.instance.selectFrom('print_logs') - .where('id', '=', Number(result.insertId || result.numInsertedOrUpdatedRows)) - .selectAll() - .executeTakeFirst() - - if (!model) { - throw new HttpError(500, 'Failed to retrieve created PrintLog') - } - - if (this) - dispatch('printLog:created', model) - return this.createInstance(model) - } - } - - static async createMany(newPrintLog: NewPrintLog[]): Promise { - const instance = new PrintLogModel(undefined) - - const valuesFiltered = newPrintLog.map((newPrintLog: NewPrintLog) => { - const filteredValues = Object.fromEntries( - Object.entries(newPrintLog).filter(([key]) => - !instance.guarded.includes(key) && instance.fillable.includes(key), - ), - ) as NewPrintLog - - filteredValues.uuid = randomUUIDv7() - - return filteredValues - }) - - await DB.instance.insertInto('print_logs') - .values(valuesFiltered) - .executeTakeFirst() - } - - static async forceCreate(newPrintLog: NewPrintLog): Promise { - const result = await DB.instance.insertInto('print_logs') - .values(newPrintLog) - .executeTakeFirst() - - const instance = new PrintLogModel(undefined) - const model = await DB.instance.selectFrom('print_logs') - .where('id', '=', Number(result.insertId || result.numInsertedOrUpdatedRows)) - .selectAll() - .executeTakeFirst() - - if (!model) { - throw new HttpError(500, 'Failed to retrieve created PrintLog') - } - - if (model) - dispatch('printLog:created', model) - - return instance.createInstance(model) - } - - // Method to remove a PrintLog - async delete(): Promise { - if (this.id === undefined) - this.deleteFromQuery.execute() - const model = await this.find(Number(this.id)) - - if (model) - dispatch('printLog:deleted', model) - - const deleted = await DB.instance.deleteFrom('print_logs') - .where('id', '=', this.id) - .execute() - - return deleted.numDeletedRows - } - - static async remove(id: number): Promise { - const instance = new PrintLogModel(undefined) - - const model = await instance.find(Number(id)) - - if (model) - dispatch('printLog:deleted', model) - - return await DB.instance.deleteFrom('print_logs') - .where('id', '=', id) - .execute() - } - - static wherePrinter(value: string): PrintLogModel { - const instance = new PrintLogModel(undefined) - - instance.selectFromQuery = instance.selectFromQuery.where('printer', '=', value) - - return instance - } - - static whereDocument(value: string): PrintLogModel { - const instance = new PrintLogModel(undefined) - - instance.selectFromQuery = instance.selectFromQuery.where('document', '=', value) - - return instance - } - - static whereTimestamp(value: string): PrintLogModel { - const instance = new PrintLogModel(undefined) - - instance.selectFromQuery = instance.selectFromQuery.where('timestamp', '=', value) - - return instance - } - - static whereStatus(value: string): PrintLogModel { - const instance = new PrintLogModel(undefined) - - instance.selectFromQuery = instance.selectFromQuery.where('status', '=', value) - - return instance - } - - static whereSize(value: string): PrintLogModel { - const instance = new PrintLogModel(undefined) - - instance.selectFromQuery = instance.selectFromQuery.where('size', '=', value) - - return instance - } - - static wherePages(value: string): PrintLogModel { - const instance = new PrintLogModel(undefined) - - instance.selectFromQuery = instance.selectFromQuery.where('pages', '=', value) - - return instance - } - - static whereDuration(value: string): PrintLogModel { - const instance = new PrintLogModel(undefined) - - instance.selectFromQuery = instance.selectFromQuery.where('duration', '=', value) - - return instance - } - - static whereIn(column: keyof PrintLogsTable, values: V[]): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyWhereIn(column, values) - } - - toSearchableObject(): Partial { - return { - id: this.id, - printer: this.printer, - document: this.document, - timestamp: this.timestamp, - status: this.status, - size: this.size, - pages: this.pages, - duration: this.duration, - } - } - - static distinct(column: keyof PrintLogJsonResponse): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyDistinct(column) - } - - static join(table: string, firstCol: string, secondCol: string): PrintLogModel { - const instance = new PrintLogModel(undefined) - - return instance.applyJoin(table, firstCol, secondCol) - } - - toJSON(): PrintLogJsonResponse { - const output = { - - uuid: this.uuid, - - id: this.id, - printer: this.printer, - document: this.document, - timestamp: this.timestamp, - status: this.status, - size: this.size, - pages: this.pages, - duration: this.duration, - - created_at: this.created_at, - - updated_at: this.updated_at, - - ...this.customColumns, - } - - return output - } - - parseResult(model: PrintLogModel): PrintLogModel { - for (const hiddenAttribute of this.hidden) { - delete model[hiddenAttribute as keyof PrintLogModel] - } - - return model - } - - // Add a protected applyFind implementation - protected async applyFind(id: number): Promise { - const model = await DB.instance.selectFrom(this.tableName) - .where('id', '=', id) - .selectAll() - .executeTakeFirst() - - if (!model) - return undefined - - this.mapCustomGetters(model) - - await this.loadRelations(model) - - // Return a proper instance using the factory method - return this.createInstance(model) - } -} - -export async function find(id: number): Promise { - const query = DB.instance.selectFrom('print_logs').where('id', '=', id).selectAll() - - const model = await query.executeTakeFirst() - - if (!model) - return undefined - - const instance = new PrintLogModel(undefined) - return instance.createInstance(model) -} - -export async function count(): Promise { - const results = await PrintLogModel.count() - - return results -} - -export async function create(newPrintLog: NewPrintLog): Promise { - const instance = new PrintLogModel(undefined) - return await instance.applyCreate(newPrintLog) -} - -export async function rawQuery(rawQuery: string): Promise { - return await sql`${rawQuery}`.execute(DB.instance) -} - -export async function remove(id: number): Promise { - await DB.instance.deleteFrom('print_logs') - .where('id', '=', id) - .execute() -} - -export async function wherePrinter(value: string): Promise { - const query = DB.instance.selectFrom('print_logs').where('printer', '=', value) - const results: PrintLogJsonResponse = await query.execute() - - return results.map((modelItem: PrintLogJsonResponse) => new PrintLogModel(modelItem)) -} - -export async function whereDocument(value: string): Promise { - const query = DB.instance.selectFrom('print_logs').where('document', '=', value) - const results: PrintLogJsonResponse = await query.execute() - - return results.map((modelItem: PrintLogJsonResponse) => new PrintLogModel(modelItem)) -} - -export async function whereTimestamp(value: number): Promise { - const query = DB.instance.selectFrom('print_logs').where('timestamp', '=', value) - const results: PrintLogJsonResponse = await query.execute() - - return results.map((modelItem: PrintLogJsonResponse) => new PrintLogModel(modelItem)) -} - -export async function whereStatus(value: string | string[]): Promise { - const query = DB.instance.selectFrom('print_logs').where('status', '=', value) - const results: PrintLogJsonResponse = await query.execute() - - return results.map((modelItem: PrintLogJsonResponse) => new PrintLogModel(modelItem)) -} - -export async function whereSize(value: number): Promise { - const query = DB.instance.selectFrom('print_logs').where('size', '=', value) - const results: PrintLogJsonResponse = await query.execute() - - return results.map((modelItem: PrintLogJsonResponse) => new PrintLogModel(modelItem)) -} - -export async function wherePages(value: number): Promise { - const query = DB.instance.selectFrom('print_logs').where('pages', '=', value) - const results: PrintLogJsonResponse = await query.execute() - - return results.map((modelItem: PrintLogJsonResponse) => new PrintLogModel(modelItem)) -} - -export async function whereDuration(value: number): Promise { - const query = DB.instance.selectFrom('print_logs').where('duration', '=', value) - const results: PrintLogJsonResponse = await query.execute() - - return results.map((modelItem: PrintLogJsonResponse) => new PrintLogModel(modelItem)) -} - -export const PrintLog = PrintLogModel - -export default PrintLog diff --git a/storage/framework/orm/src/models/Receipt.ts b/storage/framework/orm/src/models/Receipt.ts new file mode 100644 index 0000000000..e1480f1dcd --- /dev/null +++ b/storage/framework/orm/src/models/Receipt.ts @@ -0,0 +1,1032 @@ +import type { Generated, Insertable, RawBuilder, Selectable, Updateable } from '@stacksjs/database' +import type { Operator } from '@stacksjs/orm' +import { randomUUIDv7 } from 'bun' +import { sql } from '@stacksjs/database' +import { HttpError } from '@stacksjs/error-handling' +import { dispatch } from '@stacksjs/events' +import { DB } from '@stacksjs/orm' +import { BaseOrm } from '../utils/base' + +export interface ReceiptsTable { + id: Generated + printer: string + document: string + timestamp: number + status: string | string[] + size?: number + pages?: number + duration?: number + uuid?: string + + created_at?: string + + updated_at?: string + +} + +export interface ReceiptResponse { + data: ReceiptJsonResponse[] + paging: { + total_records: number + page: number + total_pages: number + } + next_cursor: number | null +} + +export interface ReceiptJsonResponse extends Omit, 'password'> { + [key: string]: any +} + +export type NewReceipt = Insertable +export type ReceiptUpdate = Updateable + +export class ReceiptModel extends BaseOrm { + private readonly hidden: Array = [] + private readonly fillable: Array = ['printer', 'document', 'timestamp', 'status', 'size', 'pages', 'duration', 'uuid'] + private readonly guarded: Array = [] + protected attributes = {} as ReceiptJsonResponse + protected originalAttributes = {} as ReceiptJsonResponse + + protected selectFromQuery: any + protected updateFromQuery: any + protected deleteFromQuery: any + protected hasSelect: boolean + private customColumns: Record = {} + + /** + * This model inherits many query methods from BaseOrm: + * - pluck, chunk, whereExists, has, doesntHave, whereHas, whereDoesntHave + * - inRandomOrder, max, min, avg, paginate, get, and more + * + * See BaseOrm class for the full list of inherited methods. + */ + + constructor(receipt: ReceiptJsonResponse | undefined) { + super('receipts') + if (receipt) { + this.attributes = { ...receipt } + this.originalAttributes = { ...receipt } + + Object.keys(receipt).forEach((key) => { + if (!(key in this)) { + this.customColumns[key] = (receipt as ReceiptJsonResponse)[key] + } + }) + } + + this.withRelations = [] + this.selectFromQuery = DB.instance.selectFrom('receipts') + this.updateFromQuery = DB.instance.updateTable('receipts') + this.deleteFromQuery = DB.instance.deleteFrom('receipts') + this.hasSelect = false + this.hasSaved = false + } + + protected async loadRelations(models: ReceiptJsonResponse | ReceiptJsonResponse[]): Promise { + // Handle both single model and array of models + const modelArray = Array.isArray(models) ? models : [models] + if (!modelArray.length) + return + + const modelIds = modelArray.map(model => model.id) + + for (const relation of this.withRelations) { + const relatedRecords = await DB.instance + .selectFrom(relation) + .where('receipt_id', 'in', modelIds) + .selectAll() + .execute() + + if (Array.isArray(models)) { + models.map((model: ReceiptJsonResponse) => { + const records = relatedRecords.filter((record: { receipt_id: number }) => { + return record.receipt_id === model.id + }) + + model[relation] = records.length === 1 ? records[0] : records + return model + }) + } + else { + const records = relatedRecords.filter((record: { receipt_id: number }) => { + return record.receipt_id === models.id + }) + + models[relation] = records.length === 1 ? records[0] : records + } + } + } + + static with(relations: string[]): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyWith(relations) + } + + protected mapCustomGetters(models: ReceiptJsonResponse | ReceiptJsonResponse[]): void { + const data = models + + if (Array.isArray(data)) { + data.map((model: ReceiptJsonResponse) => { + const customGetter = { + default: () => { + }, + + } + + for (const [key, fn] of Object.entries(customGetter)) { + (model as any)[key] = fn() + } + + return model + }) + } + else { + const model = data + + const customGetter = { + default: () => { + }, + + } + + for (const [key, fn] of Object.entries(customGetter)) { + (model as any)[key] = fn() + } + } + } + + async mapCustomSetters(model: NewReceipt | ReceiptUpdate): Promise { + const customSetter = { + default: () => { + }, + + } + + for (const [key, fn] of Object.entries(customSetter)) { + (model as any)[key] = await fn() + } + } + + get id(): number { + return this.attributes.id + } + + get uuid(): string | undefined { + return this.attributes.uuid + } + + get printer(): string { + return this.attributes.printer + } + + get document(): string { + return this.attributes.document + } + + get timestamp(): number { + return this.attributes.timestamp + } + + get status(): string | string[] { + return this.attributes.status + } + + get size(): number | undefined { + return this.attributes.size + } + + get pages(): number | undefined { + return this.attributes.pages + } + + get duration(): number | undefined { + return this.attributes.duration + } + + get created_at(): string | undefined { + return this.attributes.created_at + } + + get updated_at(): string | undefined { + return this.attributes.updated_at + } + + set uuid(value: string) { + this.attributes.uuid = value + } + + set printer(value: string) { + this.attributes.printer = value + } + + set document(value: string) { + this.attributes.document = value + } + + set timestamp(value: number) { + this.attributes.timestamp = value + } + + set status(value: string | string[]) { + this.attributes.status = value + } + + set size(value: number) { + this.attributes.size = value + } + + set pages(value: number) { + this.attributes.pages = value + } + + set duration(value: number) { + this.attributes.duration = value + } + + set updated_at(value: string) { + this.attributes.updated_at = value + } + + static select(params: (keyof ReceiptJsonResponse)[] | RawBuilder | string): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applySelect(params) + } + + // Method to find a Receipt by ID + static async find(id: number): Promise { + const query = DB.instance.selectFrom('receipts').where('id', '=', id).selectAll() + + const model = await query.executeTakeFirst() + + if (!model) + return undefined + + const instance = new ReceiptModel(undefined) + return instance.createInstance(model) + } + + static async first(): Promise { + const instance = new ReceiptModel(undefined) + + const model = await instance.applyFirst() + + const data = new ReceiptModel(model) + + return data + } + + static async last(): Promise { + const instance = new ReceiptModel(undefined) + + const model = await instance.applyLast() + + if (!model) + return undefined + + return new ReceiptModel(model) + } + + static async firstOrFail(): Promise { + const instance = new ReceiptModel(undefined) + + return await instance.applyFirstOrFail() + } + + static async all(): Promise { + const instance = new ReceiptModel(undefined) + + const models = await DB.instance.selectFrom('receipts').selectAll().execute() + + instance.mapCustomGetters(models) + + const data = await Promise.all(models.map(async (model: ReceiptJsonResponse) => { + return new ReceiptModel(model) + })) + + return data + } + + static async findOrFail(id: number): Promise { + const instance = new ReceiptModel(undefined) + + return await instance.applyFindOrFail(id) + } + + static async findMany(ids: number[]): Promise { + const instance = new ReceiptModel(undefined) + + const models = await instance.applyFindMany(ids) + + return models.map((modelItem: ReceiptJsonResponse) => instance.parseResult(new ReceiptModel(modelItem))) + } + + static async latest(column: keyof ReceiptsTable = 'created_at'): Promise { + const instance = new ReceiptModel(undefined) + + const model = await instance.selectFromQuery + .selectAll() + .orderBy(column, 'desc') + .limit(1) + .executeTakeFirst() + + if (!model) + return undefined + + return new ReceiptModel(model) + } + + static async oldest(column: keyof ReceiptsTable = 'created_at'): Promise { + const instance = new ReceiptModel(undefined) + + const model = await instance.selectFromQuery + .selectAll() + .orderBy(column, 'asc') + .limit(1) + .executeTakeFirst() + + if (!model) + return undefined + + return new ReceiptModel(model) + } + + static skip(count: number): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applySkip(count) + } + + static take(count: number): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyTake(count) + } + + static where(column: keyof ReceiptsTable, ...args: [V] | [Operator, V]): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyWhere(column, ...args) + } + + static orWhere(...conditions: [string, any][]): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyOrWhere(...conditions) + } + + static whereNotIn(column: keyof ReceiptsTable, values: V[]): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyWhereNotIn(column, values) + } + + static whereBetween(column: keyof ReceiptsTable, range: [V, V]): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyWhereBetween(column, range) + } + + static whereRef(column: keyof ReceiptsTable, ...args: string[]): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyWhereRef(column, ...args) + } + + static when(condition: boolean, callback: (query: ReceiptModel) => ReceiptModel): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyWhen(condition, callback as any) + } + + static whereNull(column: keyof ReceiptsTable): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyWhereNull(column) + } + + static whereNotNull(column: keyof ReceiptsTable): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyWhereNotNull(column) + } + + static whereLike(column: keyof ReceiptsTable, value: string): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyWhereLike(column, value) + } + + static orderBy(column: keyof ReceiptsTable, order: 'asc' | 'desc'): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyOrderBy(column, order) + } + + static orderByAsc(column: keyof ReceiptsTable): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyOrderByAsc(column) + } + + static orderByDesc(column: keyof ReceiptsTable): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyOrderByDesc(column) + } + + static groupBy(column: keyof ReceiptsTable): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyGroupBy(column) + } + + static having(column: keyof ReceiptsTable, operator: Operator, value: V): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyHaving(column, operator, value) + } + + static inRandomOrder(): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyInRandomOrder() + } + + static whereColumn(first: keyof ReceiptsTable, operator: Operator, second: keyof ReceiptsTable): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyWhereColumn(first, operator, second) + } + + static async max(field: keyof ReceiptsTable): Promise { + const instance = new ReceiptModel(undefined) + + return await instance.applyMax(field) + } + + static async min(field: keyof ReceiptsTable): Promise { + const instance = new ReceiptModel(undefined) + + return await instance.applyMin(field) + } + + static async avg(field: keyof ReceiptsTable): Promise { + const instance = new ReceiptModel(undefined) + + return await instance.applyAvg(field) + } + + static async sum(field: keyof ReceiptsTable): Promise { + const instance = new ReceiptModel(undefined) + + return await instance.applySum(field) + } + + static async count(): Promise { + const instance = new ReceiptModel(undefined) + + return instance.applyCount() + } + + static async get(): Promise { + const instance = new ReceiptModel(undefined) + + const results = await instance.applyGet() + + return results.map((item: ReceiptJsonResponse) => instance.createInstance(item)) + } + + static async pluck(field: K): Promise { + const instance = new ReceiptModel(undefined) + + return await instance.applyPluck(field) + } + + static async chunk(size: number, callback: (models: ReceiptModel[]) => Promise): Promise { + const instance = new ReceiptModel(undefined) + + await instance.applyChunk(size, async (models) => { + const modelInstances = models.map((item: ReceiptJsonResponse) => instance.createInstance(item)) + await callback(modelInstances) + }) + } + + static async paginate(options: { limit?: number, offset?: number, page?: number } = { limit: 10, offset: 0, page: 1 }): Promise<{ + data: ReceiptModel[] + paging: { + total_records: number + page: number + total_pages: number + } + next_cursor: number | null + }> { + const instance = new ReceiptModel(undefined) + + const result = await instance.applyPaginate(options) + + return { + data: result.data.map((item: ReceiptJsonResponse) => instance.createInstance(item)), + paging: result.paging, + next_cursor: result.next_cursor, + } + } + + // Instance method for creating model instances + createInstance(data: ReceiptJsonResponse): ReceiptModel { + return new ReceiptModel(data) + } + + async applyCreate(newReceipt: NewReceipt): Promise { + const filteredValues = Object.fromEntries( + Object.entries(newReceipt).filter(([key]) => + !this.guarded.includes(key) && this.fillable.includes(key), + ), + ) as NewReceipt + + await this.mapCustomSetters(filteredValues) + + filteredValues.uuid = randomUUIDv7() + + const result = await DB.instance.insertInto('receipts') + .values(filteredValues) + .executeTakeFirst() + + const model = await DB.instance.selectFrom('receipts') + .where('id', '=', Number(result.insertId || result.numInsertedOrUpdatedRows)) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve created Receipt') + } + + if (model) + dispatch('receipt:created', model) + return this.createInstance(model) + } + + async create(newReceipt: NewReceipt): Promise { + return await this.applyCreate(newReceipt) + } + + static async create(newReceipt: NewReceipt): Promise { + const instance = new ReceiptModel(undefined) + return await instance.applyCreate(newReceipt) + } + + static async firstOrCreate(search: Partial, values: NewReceipt = {} as NewReceipt): Promise { + // First try to find a record matching the search criteria + const instance = new ReceiptModel(undefined) + + // Apply all search conditions + for (const [key, value] of Object.entries(search)) { + instance.selectFromQuery = instance.selectFromQuery.where(key, '=', value) + } + + // Try to find the record + const existingRecord = await instance.applyFirst() + + if (existingRecord) { + return instance.createInstance(existingRecord) + } + + // If no record exists, create a new one with combined search criteria and values + const createData = { ...search, ...values } as NewReceipt + return await ReceiptModel.create(createData) + } + + static async updateOrCreate(search: Partial, values: NewReceipt = {} as NewReceipt): Promise { + // First try to find a record matching the search criteria + const instance = new ReceiptModel(undefined) + + // Apply all search conditions + for (const [key, value] of Object.entries(search)) { + instance.selectFromQuery = instance.selectFromQuery.where(key, '=', value) + } + + // Try to find the record + const existingRecord = await instance.applyFirst() + + if (existingRecord) { + // If record exists, update it with the new values + const model = instance.createInstance(existingRecord) + const updatedModel = await model.update(values as ReceiptUpdate) + + // Return the updated model instance + if (updatedModel) { + return updatedModel + } + + // If update didn't return a model, fetch it again to ensure we have latest data + const refreshedModel = await instance.applyFirst() + return instance.createInstance(refreshedModel!) + } + + // If no record exists, create a new one with combined search criteria and values + const createData = { ...search, ...values } as NewReceipt + return await ReceiptModel.create(createData) + } + + async update(newReceipt: ReceiptUpdate): Promise { + const filteredValues = Object.fromEntries( + Object.entries(newReceipt).filter(([key]) => + !this.guarded.includes(key) && this.fillable.includes(key), + ), + ) as ReceiptUpdate + + await this.mapCustomSetters(filteredValues) + + filteredValues.updated_at = new Date().toISOString() + + await DB.instance.updateTable('receipts') + .set(filteredValues) + .where('id', '=', this.id) + .executeTakeFirst() + + if (this.id) { + // Get the updated data + const model = await DB.instance.selectFrom('receipts') + .where('id', '=', this.id) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve updated Receipt') + } + + if (model) + dispatch('receipt:updated', model) + return this.createInstance(model) + } + + this.hasSaved = true + + return undefined + } + + async forceUpdate(newReceipt: ReceiptUpdate): Promise { + await DB.instance.updateTable('receipts') + .set(newReceipt) + .where('id', '=', this.id) + .executeTakeFirst() + + if (this.id) { + // Get the updated data + const model = await DB.instance.selectFrom('receipts') + .where('id', '=', this.id) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve updated Receipt') + } + + if (this) + dispatch('receipt:updated', model) + return this.createInstance(model) + } + + return undefined + } + + async save(): Promise { + // If the model has an ID, update it; otherwise, create a new record + if (this.id) { + // Update existing record + await DB.instance.updateTable('receipts') + .set(this.attributes as ReceiptUpdate) + .where('id', '=', this.id) + .executeTakeFirst() + + // Get the updated data + const model = await DB.instance.selectFrom('receipts') + .where('id', '=', this.id) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve updated Receipt') + } + + if (this) + dispatch('receipt:updated', model) + return this.createInstance(model) + } + else { + // Create new record + const result = await DB.instance.insertInto('receipts') + .values(this.attributes as NewReceipt) + .executeTakeFirst() + + // Get the created data + const model = await DB.instance.selectFrom('receipts') + .where('id', '=', Number(result.insertId || result.numInsertedOrUpdatedRows)) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve created Receipt') + } + + if (this) + dispatch('receipt:created', model) + return this.createInstance(model) + } + } + + static async createMany(newReceipt: NewReceipt[]): Promise { + const instance = new ReceiptModel(undefined) + + const valuesFiltered = newReceipt.map((newReceipt: NewReceipt) => { + const filteredValues = Object.fromEntries( + Object.entries(newReceipt).filter(([key]) => + !instance.guarded.includes(key) && instance.fillable.includes(key), + ), + ) as NewReceipt + + filteredValues.uuid = randomUUIDv7() + + return filteredValues + }) + + await DB.instance.insertInto('receipts') + .values(valuesFiltered) + .executeTakeFirst() + } + + static async forceCreate(newReceipt: NewReceipt): Promise { + const result = await DB.instance.insertInto('receipts') + .values(newReceipt) + .executeTakeFirst() + + const instance = new ReceiptModel(undefined) + const model = await DB.instance.selectFrom('receipts') + .where('id', '=', Number(result.insertId || result.numInsertedOrUpdatedRows)) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve created Receipt') + } + + if (model) + dispatch('receipt:created', model) + + return instance.createInstance(model) + } + + // Method to remove a Receipt + async delete(): Promise { + if (this.id === undefined) + this.deleteFromQuery.execute() + const model = await this.find(Number(this.id)) + + if (model) + dispatch('receipt:deleted', model) + + const deleted = await DB.instance.deleteFrom('receipts') + .where('id', '=', this.id) + .execute() + + return deleted.numDeletedRows + } + + static async remove(id: number): Promise { + const instance = new ReceiptModel(undefined) + + const model = await instance.find(Number(id)) + + if (model) + dispatch('receipt:deleted', model) + + return await DB.instance.deleteFrom('receipts') + .where('id', '=', id) + .execute() + } + + static wherePrinter(value: string): ReceiptModel { + const instance = new ReceiptModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('printer', '=', value) + + return instance + } + + static whereDocument(value: string): ReceiptModel { + const instance = new ReceiptModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('document', '=', value) + + return instance + } + + static whereTimestamp(value: string): ReceiptModel { + const instance = new ReceiptModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('timestamp', '=', value) + + return instance + } + + static whereStatus(value: string): ReceiptModel { + const instance = new ReceiptModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('status', '=', value) + + return instance + } + + static whereSize(value: string): ReceiptModel { + const instance = new ReceiptModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('size', '=', value) + + return instance + } + + static wherePages(value: string): ReceiptModel { + const instance = new ReceiptModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('pages', '=', value) + + return instance + } + + static whereDuration(value: string): ReceiptModel { + const instance = new ReceiptModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('duration', '=', value) + + return instance + } + + static whereIn(column: keyof ReceiptsTable, values: V[]): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyWhereIn(column, values) + } + + toSearchableObject(): Partial { + return { + id: this.id, + printer: this.printer, + document: this.document, + timestamp: this.timestamp, + status: this.status, + size: this.size, + pages: this.pages, + duration: this.duration, + } + } + + static distinct(column: keyof ReceiptJsonResponse): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyDistinct(column) + } + + static join(table: string, firstCol: string, secondCol: string): ReceiptModel { + const instance = new ReceiptModel(undefined) + + return instance.applyJoin(table, firstCol, secondCol) + } + + toJSON(): ReceiptJsonResponse { + const output = { + + uuid: this.uuid, + + id: this.id, + printer: this.printer, + document: this.document, + timestamp: this.timestamp, + status: this.status, + size: this.size, + pages: this.pages, + duration: this.duration, + + created_at: this.created_at, + + updated_at: this.updated_at, + + ...this.customColumns, + } + + return output + } + + parseResult(model: ReceiptModel): ReceiptModel { + for (const hiddenAttribute of this.hidden) { + delete model[hiddenAttribute as keyof ReceiptModel] + } + + return model + } + + // Add a protected applyFind implementation + protected async applyFind(id: number): Promise { + const model = await DB.instance.selectFrom(this.tableName) + .where('id', '=', id) + .selectAll() + .executeTakeFirst() + + if (!model) + return undefined + + this.mapCustomGetters(model) + + await this.loadRelations(model) + + // Return a proper instance using the factory method + return this.createInstance(model) + } +} + +export async function find(id: number): Promise { + const query = DB.instance.selectFrom('receipts').where('id', '=', id).selectAll() + + const model = await query.executeTakeFirst() + + if (!model) + return undefined + + const instance = new ReceiptModel(undefined) + return instance.createInstance(model) +} + +export async function count(): Promise { + const results = await ReceiptModel.count() + + return results +} + +export async function create(newReceipt: NewReceipt): Promise { + const instance = new ReceiptModel(undefined) + return await instance.applyCreate(newReceipt) +} + +export async function rawQuery(rawQuery: string): Promise { + return await sql`${rawQuery}`.execute(DB.instance) +} + +export async function remove(id: number): Promise { + await DB.instance.deleteFrom('receipts') + .where('id', '=', id) + .execute() +} + +export async function wherePrinter(value: string): Promise { + const query = DB.instance.selectFrom('receipts').where('printer', '=', value) + const results: ReceiptJsonResponse = await query.execute() + + return results.map((modelItem: ReceiptJsonResponse) => new ReceiptModel(modelItem)) +} + +export async function whereDocument(value: string): Promise { + const query = DB.instance.selectFrom('receipts').where('document', '=', value) + const results: ReceiptJsonResponse = await query.execute() + + return results.map((modelItem: ReceiptJsonResponse) => new ReceiptModel(modelItem)) +} + +export async function whereTimestamp(value: number): Promise { + const query = DB.instance.selectFrom('receipts').where('timestamp', '=', value) + const results: ReceiptJsonResponse = await query.execute() + + return results.map((modelItem: ReceiptJsonResponse) => new ReceiptModel(modelItem)) +} + +export async function whereStatus(value: string | string[]): Promise { + const query = DB.instance.selectFrom('receipts').where('status', '=', value) + const results: ReceiptJsonResponse = await query.execute() + + return results.map((modelItem: ReceiptJsonResponse) => new ReceiptModel(modelItem)) +} + +export async function whereSize(value: number): Promise { + const query = DB.instance.selectFrom('receipts').where('size', '=', value) + const results: ReceiptJsonResponse = await query.execute() + + return results.map((modelItem: ReceiptJsonResponse) => new ReceiptModel(modelItem)) +} + +export async function wherePages(value: number): Promise { + const query = DB.instance.selectFrom('receipts').where('pages', '=', value) + const results: ReceiptJsonResponse = await query.execute() + + return results.map((modelItem: ReceiptJsonResponse) => new ReceiptModel(modelItem)) +} + +export async function whereDuration(value: number): Promise { + const query = DB.instance.selectFrom('receipts').where('duration', '=', value) + const results: ReceiptJsonResponse = await query.execute() + + return results.map((modelItem: ReceiptJsonResponse) => new ReceiptModel(modelItem)) +} + +export const Receipt = ReceiptModel + +export default Receipt diff --git a/storage/framework/orm/src/types.ts b/storage/framework/orm/src/types.ts index 00c42753ee..eb1078f745 100644 --- a/storage/framework/orm/src/types.ts +++ b/storage/framework/orm/src/types.ts @@ -21,12 +21,12 @@ import type { PaymentMethodsTable } from '../src/models/PaymentMethod' import type { PaymentProductsTable } from '../src/models/PaymentProduct' import type { PaymentTransactionsTable } from '../src/models/PaymentTransaction' import type { PostsTable } from '../src/models/Post' -import type { PrintLogsTable } from '../src/models/PrintLog' import type { ProductsTable } from '../src/models/Product' import type { ProductItemsTable } from '../src/models/ProductItem' import type { ProductUnitsTable } from '../src/models/ProductUnit' import type { ProductVariantsTable } from '../src/models/ProductVariant' import type { ProjectsTable } from '../src/models/Project' +import type { ReceiptsTable } from '../src/models/Receipt' import type { ReleasesTable } from '../src/models/Release' import type { RequestsTable } from '../src/models/Request' import type { ReviewsTable } from '../src/models/Review' @@ -95,6 +95,7 @@ export interface Database { shipping_zones: ShippingZonesTable customers: CustomersTable products: ProductsTable + receipts: ReceiptsTable product_variants: ProductVariantsTable license_keys: LicenseKeysTable waitlist_restaurants: WaitlistRestaurantsTable @@ -104,7 +105,6 @@ export interface Database { orders: OrdersTable coupons: CouponsTable tax_rates: TaxRatesTable - print_logs: PrintLogsTable transactions: TransactionsTable loyalty_points: LoyaltyPointsTable product_items: ProductItemsTable diff --git a/storage/framework/requests/PrintLogRequest.ts b/storage/framework/requests/ReceiptRequest.ts similarity index 76% rename from storage/framework/requests/PrintLogRequest.ts rename to storage/framework/requests/ReceiptRequest.ts index c93e19d1e1..1e6d26de2f 100644 --- a/storage/framework/requests/PrintLogRequest.ts +++ b/storage/framework/requests/ReceiptRequest.ts @@ -1,5 +1,5 @@ import type { schema } from '@stacksjs/validation' -import type { PrintLogRequestType } from '../types/requests' +import type { ReceiptRequestType } from '../types/requests' import { Request } from '@stacksjs/router' import { customValidate, validateField } from '@stacksjs/validation' @@ -11,7 +11,7 @@ interface ValidationField { interface CustomAttributes { [key: string]: ValidationField } -interface RequestDataPrintLog { +interface RequestDataReceipt { id: number printer: string document: string @@ -23,7 +23,7 @@ interface RequestDataPrintLog { created_at?: Date updated_at?: Date } -export class PrintLogRequest extends Request implements PrintLogRequestType { +export class ReceiptRequest extends Request implements ReceiptRequestType { public id = 1 public printer = '' public document = '' @@ -37,7 +37,7 @@ export class PrintLogRequest extends Request implements Pri public uuid = '' public async validate(attributes?: CustomAttributes): Promise { if (attributes === undefined || attributes === null) { - await validateField('PrintLog', this.all()) + await validateField('Receipt', this.all()) } else { await customValidate(attributes, this.all()) @@ -45,4 +45,4 @@ export class PrintLogRequest extends Request implements Pri } } -export const printLogRequest = new PrintLogRequest() +export const receiptRequest = new ReceiptRequest() diff --git a/storage/framework/server-auto-imports.json b/storage/framework/server-auto-imports.json index d3c68b0f3e..2271751399 100644 --- a/storage/framework/server-auto-imports.json +++ b/storage/framework/server-auto-imports.json @@ -134,12 +134,12 @@ "NewPaymentProduct": true, "NewPaymentTransaction": true, "NewPost": true, - "NewPrintLog": true, "NewProduct": true, "NewProductItem": true, "NewProductUnit": true, "NewProductVariant": true, "NewProject": true, + "NewReceipt": true, "NewRelease": true, "NewRequest": true, "NewReview": true, @@ -205,13 +205,6 @@ "PostResponse": true, "PostUpdate": true, "PostsTable": true, - "PrintLog": true, - "PrintLogJsonResponse": true, - "PrintLogModel": true, - "PrintLogRequest": true, - "PrintLogResponse": true, - "PrintLogUpdate": true, - "PrintLogsTable": true, "Product": true, "ProductItem": true, "ProductItemJsonResponse": true, @@ -247,6 +240,13 @@ "ProjectResponse": true, "ProjectUpdate": true, "ProjectsTable": true, + "Receipt": true, + "ReceiptJsonResponse": true, + "ReceiptModel": true, + "ReceiptRequest": true, + "ReceiptResponse": true, + "ReceiptUpdate": true, + "ReceiptsTable": true, "Release": true, "ReleaseJsonResponse": true, "ReleaseModel": true, @@ -375,12 +375,12 @@ "paymentRequest": true, "paymentTransactionRequest": true, "postRequest": true, - "printLogRequest": true, "productItemRequest": true, "productRequest": true, "productUnitRequest": true, "productVariantRequest": true, "projectRequest": true, + "receiptRequest": true, "releaseRequest": true, "requestRequest": true, "reviewRequest": true, diff --git a/storage/framework/types/attributes.ts b/storage/framework/types/attributes.ts index f6d956a842..de5d67a7f7 100644 --- a/storage/framework/types/attributes.ts +++ b/storage/framework/types/attributes.ts @@ -73,6 +73,12 @@ export interface Attributes { preparation_time: number allergens: string nutritional_info: string + printer: string + document: string + timestamp: number + size: number + pages: number + duration: number variant: string type: string options: string @@ -130,12 +136,6 @@ export interface Attributes { applicable_categories: string rate: number region: string | string[] - printer: string - document: string - timestamp: number - size: number - pages: number - duration: number payment_method: string payment_details: string transaction_reference: string diff --git a/storage/framework/types/browser-auto-imports.d.ts b/storage/framework/types/browser-auto-imports.d.ts index 5d3f6d0a2e..043b3a8d66 100644 --- a/storage/framework/types/browser-auto-imports.d.ts +++ b/storage/framework/types/browser-auto-imports.d.ts @@ -536,6 +536,7 @@ declare module 'vue' { readonly extendRef: UnwrapRef readonly format: UnwrapRef readonly formatTimeAgo: UnwrapRef + readonly getActiveHead: UnwrapRef readonly getActivePinia: UnwrapRef readonly getCurrentInstance: UnwrapRef readonly getCurrentScope: UnwrapRef diff --git a/storage/framework/types/events.ts b/storage/framework/types/events.ts index f6efa66311..72e0a104d6 100644 --- a/storage/framework/types/events.ts +++ b/storage/framework/types/events.ts @@ -11,11 +11,11 @@ import type { LoyaltyRewardModel } from '../orm/src/models/LoyaltyReward' import type { ManufacturerModel } from '../orm/src/models/Manufacturer' import type { OrderModel } from '../orm/src/models/Order' import type { PaymentModel } from '../orm/src/models/Payment' -import type { PrintLogModel } from '../orm/src/models/PrintLog' import type { ProductModel } from '../orm/src/models/Product' import type { ProductItemModel } from '../orm/src/models/ProductItem' import type { ProductUnitModel } from '../orm/src/models/ProductUnit' import type { ProductVariantModel } from '../orm/src/models/ProductVariant' +import type { ReceiptModel } from '../orm/src/models/Receipt' import type { ReviewModel } from '../orm/src/models/Review' import type { ShippingMethodModel } from '../orm/src/models/ShippingMethod' import type { ShippingRateModel } from '../orm/src/models/ShippingRate' @@ -58,6 +58,9 @@ export interface ModelEvents { 'product:created': ProductModel 'product:updated': ProductModel 'product:deleted': ProductModel + 'receipt:created': ReceiptModel + 'receipt:updated': ReceiptModel + 'receipt:deleted': ReceiptModel 'product-variant:created': ProductVariantModel 'product-variant:updated': ProductVariantModel 'product-variant:deleted': ProductVariantModel @@ -85,9 +88,6 @@ export interface ModelEvents { 'tax-rate:created': TaxRateModel 'tax-rate:updated': TaxRateModel 'tax-rate:deleted': TaxRateModel - 'print-log:created': PrintLogModel - 'print-log:updated': PrintLogModel - 'print-log:deleted': PrintLogModel 'transaction:created': TransactionModel 'transaction:updated': TransactionModel 'transaction:deleted': TransactionModel diff --git a/storage/framework/types/requests.d.ts b/storage/framework/types/requests.d.ts index 551ac8567e..92939f6319 100644 --- a/storage/framework/types/requests.d.ts +++ b/storage/framework/types/requests.d.ts @@ -526,6 +526,34 @@ export interface ProductRequestType extends Request { updated_at?: Date } +interface RequestDataReceipt { + id: number + printer: string + document: string + timestamp: number + status: string[] + size: number + pages: number + duration: number + created_at?: Date + updated_at?: Date +} +export interface ReceiptRequestType extends Request { + validate: (attributes?: CustomAttributes) => void + get: (key: string, defaultValue?: T) => T + all: () => RequestDataReceipt + id: number + printer: string + document: string + timestamp: number + status: string[] + size: number + pages: number + duration: number + created_at?: Date + updated_at?: Date +} + interface RequestDataProductVariant { id: number variant: string @@ -846,34 +874,6 @@ export interface TaxRateRequestType extends Request { updated_at?: Date } -interface RequestDataPrintLog { - id: number - printer: string - document: string - timestamp: number - status: string[] - size: number - pages: number - duration: number - created_at?: Date - updated_at?: Date -} -export interface PrintLogRequestType extends Request { - validate: (attributes?: CustomAttributes) => void - get: (key: string, defaultValue?: T) => T - all: () => RequestDataPrintLog - id: number - printer: string - document: string - timestamp: number - status: string[] - size: number - pages: number - duration: number - created_at?: Date - updated_at?: Date -} - interface RequestDataTransaction { id: number amount: number @@ -1298,4 +1298,4 @@ export interface ErrorRequestType extends Request { updated_at?: Date } -export type ModelRequest = ProjectRequestType | SubscriberEmailRequestType | AccessTokenRequestType | TeamRequestType | SubscriberRequestType | DeploymentRequestType | ReleaseRequestType | UserRequestType | PostRequestType | CategoryRequestType | PaymentRequestType | DriverRequestType | WaitlistProductRequestType | DigitalDeliveryRequestType | ManufacturerRequestType | OrderItemRequestType | ShippingZoneRequestType | CustomerRequestType | ProductRequestType | ProductVariantRequestType | LicenseKeyRequestType | WaitlistRestaurantRequestType | ReviewRequestType | ProductUnitRequestType | GiftCardRequestType | OrderRequestType | CouponRequestType | TaxRateRequestType | PrintLogRequestType | TransactionRequestType | LoyaltyPointRequestType | ProductItemRequestType | LoyaltyRewardRequestType | ShippingMethodRequestType | ShippingRateRequestType | DeliveryRouteRequestType | FailedJobRequestType | PaymentMethodRequestType | PaymentTransactionRequestType | RequestRequestType | JobRequestType | SubscriptionRequestType | PaymentProductRequestType | ErrorRequestType +export type ModelRequest = ProjectRequestType | SubscriberEmailRequestType | AccessTokenRequestType | TeamRequestType | SubscriberRequestType | DeploymentRequestType | ReleaseRequestType | UserRequestType | PostRequestType | CategoryRequestType | PaymentRequestType | DriverRequestType | WaitlistProductRequestType | DigitalDeliveryRequestType | ManufacturerRequestType | OrderItemRequestType | ShippingZoneRequestType | CustomerRequestType | ProductRequestType | ReceiptRequestType | ProductVariantRequestType | LicenseKeyRequestType | WaitlistRestaurantRequestType | ReviewRequestType | ProductUnitRequestType | GiftCardRequestType | OrderRequestType | CouponRequestType | TaxRateRequestType | TransactionRequestType | LoyaltyPointRequestType | ProductItemRequestType | LoyaltyRewardRequestType | ShippingMethodRequestType | ShippingRateRequestType | DeliveryRouteRequestType | FailedJobRequestType | PaymentMethodRequestType | PaymentTransactionRequestType | RequestRequestType | JobRequestType | SubscriptionRequestType | PaymentProductRequestType | ErrorRequestType diff --git a/storage/framework/types/server-auto-imports.d.ts b/storage/framework/types/server-auto-imports.d.ts index 57f0f6504b..2fd2114cc1 100644 --- a/storage/framework/types/server-auto-imports.d.ts +++ b/storage/framework/types/server-auto-imports.d.ts @@ -135,12 +135,12 @@ declare global { const NewPaymentProduct: typeof import('./../orm/src/models')['NewPaymentProduct'] const NewPaymentTransaction: typeof import('./../orm/src/models')['NewPaymentTransaction'] const NewPost: typeof import('./../orm/src/models')['NewPost'] - const NewPrintLog: typeof import('./../orm/src/models')['NewPrintLog'] const NewProduct: typeof import('./../orm/src/models')['NewProduct'] const NewProductItem: typeof import('./../orm/src/models')['NewProductItem'] const NewProductUnit: typeof import('./../orm/src/models')['NewProductUnit'] const NewProductVariant: typeof import('./../orm/src/models')['NewProductVariant'] const NewProject: typeof import('./../orm/src/models')['NewProject'] + const NewReceipt: typeof import('./../orm/src/models')['NewReceipt'] const NewRelease: typeof import('./../orm/src/models')['NewRelease'] const NewRequest: typeof import('./../orm/src/models')['NewRequest'] const NewReview: typeof import('./../orm/src/models')['NewReview'] @@ -206,13 +206,6 @@ declare global { const PostResponse: typeof import('./../orm/src/models')['PostResponse'] const PostUpdate: typeof import('./../orm/src/models')['PostUpdate'] const PostsTable: typeof import('./../orm/src/models')['PostsTable'] - const PrintLog: typeof import('./../orm/src/models')['PrintLog'] - const PrintLogJsonResponse: typeof import('./../orm/src/models')['PrintLogJsonResponse'] - const PrintLogModel: typeof import('./../orm/src/models')['PrintLogModel'] - const PrintLogRequest: typeof import('./../requests')['PrintLogRequest'] - const PrintLogResponse: typeof import('./../orm/src/models')['PrintLogResponse'] - const PrintLogUpdate: typeof import('./../orm/src/models')['PrintLogUpdate'] - const PrintLogsTable: typeof import('./../orm/src/models')['PrintLogsTable'] const Product: typeof import('./../orm/src/models')['Product'] const ProductItem: typeof import('./../orm/src/models')['ProductItem'] const ProductItemJsonResponse: typeof import('./../orm/src/models')['ProductItemJsonResponse'] @@ -248,6 +241,13 @@ declare global { const ProjectResponse: typeof import('./../orm/src/models')['ProjectResponse'] const ProjectUpdate: typeof import('./../orm/src/models')['ProjectUpdate'] const ProjectsTable: typeof import('./../orm/src/models')['ProjectsTable'] + const Receipt: typeof import('./../orm/src/models')['Receipt'] + const ReceiptJsonResponse: typeof import('./../orm/src/models')['ReceiptJsonResponse'] + const ReceiptModel: typeof import('./../orm/src/models')['ReceiptModel'] + const ReceiptRequest: typeof import('./../requests')['ReceiptRequest'] + const ReceiptResponse: typeof import('./../orm/src/models')['ReceiptResponse'] + const ReceiptUpdate: typeof import('./../orm/src/models')['ReceiptUpdate'] + const ReceiptsTable: typeof import('./../orm/src/models')['ReceiptsTable'] const Release: typeof import('./../orm/src/models')['Release'] const ReleaseJsonResponse: typeof import('./../orm/src/models')['ReleaseJsonResponse'] const ReleaseModel: typeof import('./../orm/src/models')['ReleaseModel'] @@ -376,12 +376,12 @@ declare global { const paymentRequest: typeof import('./../requests')['paymentRequest'] const paymentTransactionRequest: typeof import('./../requests')['paymentTransactionRequest'] const postRequest: typeof import('./../requests')['postRequest'] - const printLogRequest: typeof import('./../requests')['printLogRequest'] const productItemRequest: typeof import('./../requests')['productItemRequest'] const productRequest: typeof import('./../requests')['productRequest'] const productUnitRequest: typeof import('./../requests')['productUnitRequest'] const productVariantRequest: typeof import('./../requests')['productVariantRequest'] const projectRequest: typeof import('./../requests')['projectRequest'] + const receiptRequest: typeof import('./../requests')['receiptRequest'] const releaseRequest: typeof import('./../requests')['releaseRequest'] const requestRequest: typeof import('./../requests')['requestRequest'] const reviewRequest: typeof import('./../requests')['reviewRequest'] diff --git a/storage/framework/views/dashboard/storage/logs/stacks.log b/storage/framework/views/dashboard/storage/logs/stacks.log index 3e5aaaec38..b70b8422c4 100644 --- a/storage/framework/views/dashboard/storage/logs/stacks.log +++ b/storage/framework/views/dashboard/storage/logs/stacks.log @@ -7,3 +7,4 @@ [2025-03-29T17:20:59.643Z] DEBUG: Using database driver: sqlite [2025-03-29T17:21:36.402Z] DEBUG: Using database driver: sqlite [2025-03-29T17:21:36.423Z] DEBUG: Using database driver: sqlite +[2025-03-31T10:59:22.638Z] DEBUG: Using database driver: sqlite From b86661042af3a706ede0257b4eabb8e67be28665 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Mon, 31 Mar 2025 19:06:40 +0800 Subject: [PATCH 23/78] chore: wip --- .../core/commerce/src/prints/store.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/storage/framework/core/commerce/src/prints/store.ts b/storage/framework/core/commerce/src/prints/store.ts index 649b809542..97e9a6e0ed 100644 --- a/storage/framework/core/commerce/src/prints/store.ts +++ b/storage/framework/core/commerce/src/prints/store.ts @@ -1,4 +1,4 @@ -import type { NewPrintLog, PrintLogJsonResponse, PrintLogRequestType } from '@stacksjs/orm' +import type { NewReceipt, ReceiptJsonResponse, ReceiptRequestType } from '@stacksjs/orm' import { randomUUIDv7 } from 'bun' import { db } from '@stacksjs/database' @@ -8,13 +8,13 @@ import { db } from '@stacksjs/database' * @param request Print log data to store * @returns The newly created print log record */ -export async function store(request: PrintLogRequestType): Promise { +export async function store(request: ReceiptRequestType): Promise { // Validate the request data await request.validate() try { // Prepare print log data - const printData: NewPrintLog = { + const printData: NewReceipt = { printer: request.get('printer'), document: request.get('document'), timestamp: request.get('timestamp'), @@ -28,7 +28,7 @@ export async function store(request: PrintLogRequestType): Promise('timestamp'), @@ -86,7 +86,7 @@ export async function bulkStore(requests: PrintLogRequestType[]): Promise Date: Mon, 31 Mar 2025 19:08:58 +0800 Subject: [PATCH 24/78] chore: wip --- .../core/commerce/src/prints/destroy.ts | 6 ++-- .../core/commerce/src/prints/fetch.ts | 14 ++++---- .../core/commerce/src/prints/store.ts | 22 ++++++------ .../core/commerce/src/prints/update.ts | 36 +++++++++---------- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/storage/framework/core/commerce/src/prints/destroy.ts b/storage/framework/core/commerce/src/prints/destroy.ts index 51ae46150e..3f8220a561 100644 --- a/storage/framework/core/commerce/src/prints/destroy.ts +++ b/storage/framework/core/commerce/src/prints/destroy.ts @@ -9,7 +9,7 @@ import { db } from '@stacksjs/database' export async function destroy(id: number): Promise { try { const result = await db - .deleteFrom('print_logs') + .deleteFrom('receipts') .where('id', '=', id) .executeTakeFirst() @@ -37,7 +37,7 @@ export async function bulkDestroy(ids: number[]): Promise { try { // Perform the delete operation const result = await db - .deleteFrom('print_logs') + .deleteFrom('receipts') .where('id', 'in', ids) .executeTakeFirst() @@ -46,7 +46,7 @@ export async function bulkDestroy(ids: number[]): Promise { } catch (error) { if (error instanceof Error) { - throw new TypeError(`Failed to delete print logs: ${error.message}`) + throw new TypeError(`Failed to delete receipts: ${error.message}`) } throw error diff --git a/storage/framework/core/commerce/src/prints/fetch.ts b/storage/framework/core/commerce/src/prints/fetch.ts index 752d4da7e6..c7a2a7e223 100644 --- a/storage/framework/core/commerce/src/prints/fetch.ts +++ b/storage/framework/core/commerce/src/prints/fetch.ts @@ -1,12 +1,12 @@ -import type { PrintLogJsonResponse } from '@stacksjs/orm' +import type { ReceiptJsonResponse } from '@stacksjs/orm' import { db } from '@stacksjs/database' /** * Fetch a print log by ID */ -export async function fetchById(id: number): Promise { +export async function fetchById(id: number): Promise { return await db - .selectFrom('print_logs') + .selectFrom('receipts') .where('id', '=', id) .selectAll() .executeTakeFirst() @@ -15,8 +15,8 @@ export async function fetchById(id: number): Promise { - return await db.selectFrom('print_logs').selectAll().execute() +export async function fetchAll(): Promise { + return await db.selectFrom('receipts').selectAll().execute() } /** @@ -39,7 +39,7 @@ export async function fetchPrintJobStats( averageDuration: number }> { const stats = await db - .selectFrom('print_logs') + .selectFrom('receipts') .where('timestamp', '>=', startDate) .where('timestamp', '<=', endDate) .select([ @@ -82,7 +82,7 @@ export async function fetchSuccessRate( warning: number }> { const stats = await db - .selectFrom('print_logs') + .selectFrom('receipts') .where('timestamp', '>=', startDate) .where('timestamp', '<=', endDate) .select([ diff --git a/storage/framework/core/commerce/src/prints/store.ts b/storage/framework/core/commerce/src/prints/store.ts index 97e9a6e0ed..627c329493 100644 --- a/storage/framework/core/commerce/src/prints/store.ts +++ b/storage/framework/core/commerce/src/prints/store.ts @@ -14,7 +14,7 @@ export async function store(request: ReceiptRequestType): Promise('timestamp'), @@ -24,28 +24,28 @@ export async function store(request: ReceiptRequestType): Promise('timestamp'), @@ -82,12 +82,12 @@ export async function bulkStore(requests: ReceiptRequestType[]): Promise duration: request.get('duration'), } - printData.uuid = randomUUIDv7() + receiptData.uuid = randomUUIDv7() // Insert the print log await trx .insertInto('receipts') - .values(printData) + .values(receiptData) .execute() createdCount++ diff --git a/storage/framework/core/commerce/src/prints/update.ts b/storage/framework/core/commerce/src/prints/update.ts index 583ca19e6d..53add5cee6 100644 --- a/storage/framework/core/commerce/src/prints/update.ts +++ b/storage/framework/core/commerce/src/prints/update.ts @@ -1,4 +1,4 @@ -import type { PrintLogJsonResponse, PrintLogRequestType } from '@stacksjs/orm' +import type { ReceiptJsonResponse, ReceiptRequestType } from '@stacksjs/orm' import { db } from '@stacksjs/database' import { formatDate } from '@stacksjs/orm' import { fetchById } from './fetch' @@ -10,7 +10,7 @@ import { fetchById } from './fetch' * @param request The updated print log data * @returns The updated print log record */ -export async function update(id: number, request: PrintLogRequestType): Promise { +export async function update(id: number, request: ReceiptRequestType): Promise { // Validate the request data await request.validate() @@ -18,7 +18,7 @@ export async function update(id: number, request: PrintLogRequestType): Promise< const existingLog = await fetchById(id) if (!existingLog) { - throw new Error(`Print log with ID ${id} not found`) + throw new Error(`Receipt with ID ${id} not found`) } // Create update data object using request fields @@ -41,7 +41,7 @@ export async function update(id: number, request: PrintLogRequestType): Promise< try { // Update the print log await db - .updateTable('print_logs') + .updateTable('receipts') .set(updateData) .where('id', '=', id) .execute() @@ -51,7 +51,7 @@ export async function update(id: number, request: PrintLogRequestType): Promise< } catch (error) { if (error instanceof Error) { - throw new TypeError(`Failed to update print log: ${error.message}`) + throw new TypeError(`Failed to update receipt: ${error.message}`) } throw error @@ -68,18 +68,18 @@ export async function update(id: number, request: PrintLogRequestType): Promise< export async function updateStatus( id: number, status: 'success' | 'failed' | 'warning', -): Promise { +): Promise { // Check if print log exists - const printLog = await fetchById(id) + const receipt = await fetchById(id) - if (!printLog) { - throw new Error(`Print log with ID ${id} not found`) + if (!receipt) { + throw new Error(`Receipt with ID ${id} not found`) } try { // Update the print log status await db - .updateTable('print_logs') + .updateTable('receipts') .set({ status, updated_at: formatDate(new Date()), @@ -92,7 +92,7 @@ export async function updateStatus( } catch (error) { if (error instanceof Error) { - throw new TypeError(`Failed to update print log status: ${error.message}`) + throw new TypeError(`Failed to update receipt status: ${error.message}`) } throw error @@ -113,12 +113,12 @@ export async function updatePrintJob( size?: number, pages?: number, duration?: number, -): Promise { +): Promise { // Check if print log exists - const printLog = await fetchById(id) + const receipt = await fetchById(id) - if (!printLog) { - throw new Error(`Print log with ID ${id} not found`) + if (!receipt) { + throw new Error(`Receipt with ID ${id} not found`) } // Create update data with only provided fields @@ -138,13 +138,13 @@ export async function updatePrintJob( // If no fields to update, just return the existing print log if (Object.keys(updateData).length === 1) { // Only updated_at was set - return printLog + return receipt } try { // Update the print log await db - .updateTable('print_logs') + .updateTable('receipts') .set(updateData) .where('id', '=', id) .execute() @@ -154,7 +154,7 @@ export async function updatePrintJob( } catch (error) { if (error instanceof Error) { - throw new TypeError(`Failed to update print job information: ${error.message}`) + throw new TypeError(`Failed to update receipt job information: ${error.message}`) } throw error From ff11f3cf95c704e48902d96b0b6de48e114f2367 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Mon, 31 Mar 2025 19:12:30 +0800 Subject: [PATCH 25/78] chore: wip --- .../core/commerce/src/tests/prints.test.ts | 184 +++++++++--------- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/storage/framework/core/commerce/src/tests/prints.test.ts b/storage/framework/core/commerce/src/tests/prints.test.ts index 9b84ab8e2c..79620e63c1 100644 --- a/storage/framework/core/commerce/src/tests/prints.test.ts +++ b/storage/framework/core/commerce/src/tests/prints.test.ts @@ -1,4 +1,4 @@ -import type { PrintLogJsonResponse } from '@stacksjs/orm' +import type { ReceiptJsonResponse } from '@stacksjs/orm' import { beforeEach, describe, expect, it } from 'bun:test' import { refreshDatabase } from '@stacksjs/testing' import { bulkDestroy, destroy } from '../prints/destroy' @@ -41,25 +41,25 @@ describe('Print Log Module', () => { } const request = new TestRequest(requestData) - const printLog = await store(request as any) + const receipt = await store(request as any) - expect(printLog).toBeDefined() - expect(printLog?.printer).toBe('HP LaserJet') - expect(printLog?.document).toBe('invoice.pdf') - expect(printLog?.status).toBe('success') - expect(printLog?.size).toBe(1024) - expect(printLog?.pages).toBe(5) - expect(printLog?.duration).toBe(30) - expect(printLog?.uuid).toBeDefined() + expect(receipt).toBeDefined() + expect(receipt?.printer).toBe('HP LaserJet') + expect(receipt?.document).toBe('invoice.pdf') + expect(receipt?.status).toBe('success') + expect(receipt?.size).toBe(1024) + expect(receipt?.pages).toBe(5) + expect(receipt?.duration).toBe(30) + expect(receipt?.uuid).toBeDefined() // Save the ID for further testing - const printId = printLog?.id !== undefined ? Number(printLog.id) : undefined + const receiptId = receipt?.id !== undefined ? Number(receipt.id) : undefined // Verify we can fetch the print log we just created - if (printId) { - const fetchedPrint = await fetchById(printId) - expect(fetchedPrint).toBeDefined() - expect(fetchedPrint?.id).toBe(printId) + if (receiptId) { + const fetchedReceipt = await fetchById(receiptId) + expect(fetchedReceipt).toBeDefined() + expect(fetchedReceipt?.id).toBe(receiptId) } }) @@ -72,16 +72,16 @@ describe('Print Log Module', () => { } const request = new TestRequest(minimalRequestData) - const printLog = await store(request as any) - - expect(printLog).toBeDefined() - expect(printLog?.printer).toBe('Epson Printer') - expect(printLog?.document).toBe('report.pdf') - expect(printLog?.status).toBe('success') - expect(printLog?.size).toBeNull() - expect(printLog?.pages).toBeNull() - expect(printLog?.duration).toBeNull() - expect(printLog?.uuid).toBeDefined() + const receipt = await store(request as any) + + expect(receipt).toBeDefined() + expect(receipt?.printer).toBe('Epson Printer') + expect(receipt?.document).toBe('report.pdf') + expect(receipt?.status).toBe('success') + expect(receipt?.size).toBeNull() + expect(receipt?.pages).toBeNull() + expect(receipt?.duration).toBeNull() + expect(receipt?.uuid).toBeDefined() }) it('should create multiple print logs with bulk store', async () => { @@ -119,8 +119,8 @@ describe('Print Log Module', () => { expect(count).toBe(3) // Verify print logs can be fetched - const allPrintLogs = await fetchAll() - expect(allPrintLogs.length).toBeGreaterThanOrEqual(3) + const allReceipts = await fetchAll() + expect(allReceipts.length).toBeGreaterThanOrEqual(3) }) it('should return 0 when trying to bulk store an empty array', async () => { @@ -144,13 +144,13 @@ describe('Print Log Module', () => { // Create the print log const createRequest = new TestRequest(requestData) - const printLog = await store(createRequest as any) - const printId = printLog?.id !== undefined ? Number(printLog.id) : undefined + const receipt = await store(createRequest as any) + const receiptId = receipt?.id !== undefined ? Number(receipt.id) : undefined // Make sure we have a valid print ID before proceeding - expect(printId).toBeDefined() - if (!printId) { - throw new Error('Failed to create test print log') + expect(receiptId).toBeDefined() + if (!receiptId) { + throw new Error('Failed to create test receipt') } // Update the print log with new data @@ -165,17 +165,17 @@ describe('Print Log Module', () => { } const updateRequest = new TestRequest(updateData) - const updatedPrint = await update(printId, updateRequest as any) + const updatedReceipt = await update(receiptId, updateRequest as any) // Verify the update was successful - expect(updatedPrint).toBeDefined() - expect(updatedPrint?.id).toBe(printId) - expect(updatedPrint?.printer).toBe('HP LaserJet Pro') - expect(updatedPrint?.document).toBe('updated_invoice.pdf') - expect(updatedPrint?.status).toBe('warning') - expect(updatedPrint?.size).toBe(2048) - expect(updatedPrint?.pages).toBe(10) - expect(updatedPrint?.duration).toBe(45) + expect(updatedReceipt).toBeDefined() + expect(updatedReceipt?.id).toBe(receiptId) + expect(updatedReceipt?.printer).toBe('HP LaserJet Pro') + expect(updatedReceipt?.document).toBe('updated_invoice.pdf') + expect(updatedReceipt?.status).toBe('warning') + expect(updatedReceipt?.size).toBe(2048) + expect(updatedReceipt?.pages).toBe(10) + expect(updatedReceipt?.duration).toBe(45) }) it('should update a print log\'s status', async () => { @@ -191,24 +191,24 @@ describe('Print Log Module', () => { } const request = new TestRequest(requestData) - const printLog = await store(request as any) - const printId = printLog?.id !== undefined ? Number(printLog.id) : undefined + const receipt = await store(request as any) + const receiptId = receipt?.id !== undefined ? Number(receipt.id) : undefined // Make sure we have a valid print ID before proceeding - expect(printId).toBeDefined() - if (!printId) { - throw new Error('Failed to create test print log') + expect(receiptId).toBeDefined() + if (!receiptId) { + throw new Error('Failed to create test receipt') } // Update status to warning - const updatedPrint = await updateStatus(printId, 'warning') - expect(updatedPrint).toBeDefined() - expect(updatedPrint?.status).toBe('warning') + const updatedReceipt = await updateStatus(receiptId, 'warning') + expect(updatedReceipt).toBeDefined() + expect(updatedReceipt?.status).toBe('warning') // Update status to failed - const failedPrint = await updateStatus(printId, 'failed') - expect(failedPrint).toBeDefined() - expect(failedPrint?.status).toBe('failed') + const failedReceipt = await updateStatus(receiptId, 'failed') + expect(failedReceipt).toBeDefined() + expect(failedReceipt?.status).toBe('failed') }) it('should update print job information', async () => { @@ -224,21 +224,21 @@ describe('Print Log Module', () => { } const request = new TestRequest(requestData) - const printLog = await store(request as any) - const printId = printLog?.id !== undefined ? Number(printLog.id) : undefined + const receipt = await store(request as any) + const receiptId = receipt?.id !== undefined ? Number(receipt.id) : undefined - expect(printId).toBeDefined() - if (!printId) { - throw new Error('Failed to create test print log') + expect(receiptId).toBeDefined() + if (!receiptId) { + throw new Error('Failed to create test receipt') } // Update print job information - const updatedPrint = await updatePrintJob(printId, 2048, 10, 45) + const updatedReceipt = await updatePrintJob(receiptId, 2048, 10, 45) - expect(updatedPrint).toBeDefined() - expect(updatedPrint?.size).toBe(2048) - expect(updatedPrint?.pages).toBe(10) - expect(updatedPrint?.duration).toBe(45) + expect(updatedReceipt).toBeDefined() + expect(updatedReceipt?.size).toBe(2048) + expect(updatedReceipt?.pages).toBe(10) + expect(updatedReceipt?.duration).toBe(45) }) }) @@ -257,26 +257,26 @@ describe('Print Log Module', () => { // Create the print log const request = new TestRequest(requestData) - const printLog = await store(request as any) - const printId = printLog?.id !== undefined ? Number(printLog.id) : undefined + const receipt = await store(request as any) + const receiptId = receipt?.id !== undefined ? Number(receipt.id) : undefined // Make sure we have a valid print ID before proceeding - expect(printId).toBeDefined() - if (!printId) { - throw new Error('Failed to create test print log') + expect(receiptId).toBeDefined() + if (!receiptId) { + throw new Error('Failed to create test receipt') } // Verify the print log exists - let fetchedPrint = await fetchById(printId) - expect(fetchedPrint).toBeDefined() + let fetchedReceipt = await fetchById(receiptId) + expect(fetchedReceipt).toBeDefined() // Delete the print log - const deleted = await destroy(printId) + const deleted = await destroy(receiptId) expect(deleted).toBe(true) // Verify the print log no longer exists - fetchedPrint = await fetchById(printId) - expect(fetchedPrint).toBeUndefined() + fetchedReceipt = await fetchById(receiptId) + expect(fetchedReceipt).toBeUndefined() }) it('should return 0 when trying to delete an empty array of print logs', async () => { @@ -323,12 +323,12 @@ describe('Print Log Module', () => { await bulkStore(requests as any) // Fetch all print logs - const allPrintLogs = await fetchAll() - expect(allPrintLogs).toBeDefined() - expect(allPrintLogs.length).toBe(3) - expect(allPrintLogs.map((p: PrintLogJsonResponse) => p.printer)).toContain('HP LaserJet') - expect(allPrintLogs.map((p: PrintLogJsonResponse) => p.printer)).toContain('Epson Printer') - expect(allPrintLogs.map((p: PrintLogJsonResponse) => p.printer)).toContain('Canon Printer') + const allReceipts = await fetchAll() + expect(allReceipts).toBeDefined() + expect(allReceipts.length).toBe(3) + expect(allReceipts.map((p: ReceiptJsonResponse) => p.printer)).toContain('HP LaserJet') + expect(allReceipts.map((p: ReceiptJsonResponse) => p.printer)).toContain('Epson Printer') + expect(allReceipts.map((p: ReceiptJsonResponse) => p.printer)).toContain('Canon Printer') }) it('should fetch a print log by ID', async () => { @@ -344,24 +344,24 @@ describe('Print Log Module', () => { } const request = new TestRequest(requestData) - const printLog = await store(request as any) - const printId = printLog?.id !== undefined ? Number(printLog.id) : undefined + const receipt = await store(request as any) + const receiptId = receipt?.id !== undefined ? Number(receipt.id) : undefined - expect(printId).toBeDefined() - if (!printId) { - throw new Error('Failed to create test print log') + expect(receiptId).toBeDefined() + if (!receiptId) { + throw new Error('Failed to create test receipt') } // Fetch the print log by ID - const fetchedPrint = await fetchById(printId) - expect(fetchedPrint).toBeDefined() - expect(fetchedPrint?.id).toBe(printId) - expect(fetchedPrint?.printer).toBe('HP LaserJet') - expect(fetchedPrint?.document).toBe('invoice.pdf') - expect(fetchedPrint?.status).toBe('success') - expect(fetchedPrint?.size).toBe(1024) - expect(fetchedPrint?.pages).toBe(5) - expect(fetchedPrint?.duration).toBe(30) + const fetchedReceipt = await fetchById(receiptId) + expect(fetchedReceipt).toBeDefined() + expect(fetchedReceipt?.id).toBe(receiptId) + expect(fetchedReceipt?.printer).toBe('HP LaserJet') + expect(fetchedReceipt?.document).toBe('invoice.pdf') + expect(fetchedReceipt?.status).toBe('success') + expect(fetchedReceipt?.size).toBe(1024) + expect(fetchedReceipt?.pages).toBe(5) + expect(fetchedReceipt?.duration).toBe(30) }) it('should fetch print job statistics within a date range', async () => { From 2ede514b981964e0f63893d2a264d8877e703a66 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Mon, 31 Mar 2025 19:34:40 +0800 Subject: [PATCH 26/78] chore: wip --- .../src/{prints => receipts}/destroy.ts | 0 .../src/{prints => receipts}/fetch.ts | 118 ++++ .../src/{prints => receipts}/index.ts | 0 .../src/{prints => receipts}/store.ts | 51 +- .../src/{prints => receipts}/update.ts | 0 .../{prints.test.ts => receipts.test.ts} | 526 +++++++++++++++++- .../src/tests/storage/logs/stacks.log | 289 ++++++++++ 7 files changed, 951 insertions(+), 33 deletions(-) rename storage/framework/core/commerce/src/{prints => receipts}/destroy.ts (100%) rename storage/framework/core/commerce/src/{prints => receipts}/fetch.ts (50%) rename storage/framework/core/commerce/src/{prints => receipts}/index.ts (100%) rename storage/framework/core/commerce/src/{prints => receipts}/store.ts (69%) rename storage/framework/core/commerce/src/{prints => receipts}/update.ts (100%) rename storage/framework/core/commerce/src/tests/{prints.test.ts => receipts.test.ts} (55%) diff --git a/storage/framework/core/commerce/src/prints/destroy.ts b/storage/framework/core/commerce/src/receipts/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/prints/destroy.ts rename to storage/framework/core/commerce/src/receipts/destroy.ts diff --git a/storage/framework/core/commerce/src/prints/fetch.ts b/storage/framework/core/commerce/src/receipts/fetch.ts similarity index 50% rename from storage/framework/core/commerce/src/prints/fetch.ts rename to storage/framework/core/commerce/src/receipts/fetch.ts index c7a2a7e223..79a5818cf2 100644 --- a/storage/framework/core/commerce/src/prints/fetch.ts +++ b/storage/framework/core/commerce/src/receipts/fetch.ts @@ -109,3 +109,121 @@ export async function fetchSuccessRate( warning, } } + +/** + * Calculate total pages and average pages per receipt within a date range + * + * @param startDate Start date for the range + * @param endDate End date for the range + * @returns Object containing total pages and average pages per receipt + */ +export async function fetchPageStats( + startDate: number, + endDate: number, +): Promise<{ + totalPages: number + averagePagesPerReceipt: number + totalReceipts: number + }> { + const stats = await db + .selectFrom('receipts') + .where('timestamp', '>=', startDate) + .where('timestamp', '<=', endDate) + .select([ + db.fn.count('id').as('totalReceipts'), + db.fn.sum('pages').as('totalPages'), + db.fn.avg('pages').as('averagePagesPerReceipt'), + ]) + .executeTakeFirst() + + return { + totalPages: stats?.totalPages || 0, + averagePagesPerReceipt: Math.round(stats?.averagePagesPerReceipt || 0), + totalReceipts: stats?.totalReceipts || 0, + } +} + +/** + * Calculate average print time statistics within a date range + * + * @param startDate Start date for the range + * @param endDate End date for the range + * @returns Object containing average print time and related statistics + */ +export async function fetchPrintTimeStats( + startDate: number, + endDate: number, +): Promise<{ + averageDuration: number + minDuration: number + maxDuration: number + totalJobs: number + }> { + const stats = await db + .selectFrom('receipts') + .where('timestamp', '>=', startDate) + .where('timestamp', '<=', endDate) + .select([ + db.fn.count('id').as('totalJobs'), + db.fn.avg('duration').as('averageDuration'), + db.fn.min('duration').as('minDuration'), + db.fn.max('duration').as('maxDuration'), + ]) + .executeTakeFirst() + + return { + averageDuration: Math.round(stats?.averageDuration || 0), + minDuration: stats?.minDuration || 0, + maxDuration: stats?.maxDuration || 0, + totalJobs: stats?.totalJobs || 0, + } +} + +/** + * Calculate prints per hour statistics within a date range + * + * @param startDate Start date for the range + * @param endDate End date for the range + * @returns Object containing prints per hour statistics + */ +export async function fetchPrintsPerHour( + startDate: number, + endDate: number, +): Promise<{ + totalPrints: number + totalHours: number + printsPerHour: number + hourlyBreakdown: Array<{ + hour: number + count: number + }> + }> { + const receipts = await db + .selectFrom('receipts') + .where('timestamp', '>=', startDate) + .where('timestamp', '<=', endDate) + .selectAll() + .execute() + + const totalPrints = receipts.length + const totalHours = Math.ceil((endDate - startDate) / (1000 * 60 * 60)) + const printsPerHour = totalHours > 0 ? Math.round(totalPrints / totalHours) : 0 + + const hourlyBreakdown = Array.from({ length: 24 }, (_, i) => ({ + hour: i, + count: 0, + })) + + receipts.forEach((receipt) => { + const date = new Date(receipt.timestamp) + const hour = date.getHours() + hourlyBreakdown[hour].count++ + }) + + return { + totalPrints, + totalHours, + printsPerHour, + hourlyBreakdown, + } +} diff --git a/storage/framework/core/commerce/src/prints/index.ts b/storage/framework/core/commerce/src/receipts/index.ts similarity index 100% rename from storage/framework/core/commerce/src/prints/index.ts rename to storage/framework/core/commerce/src/receipts/index.ts diff --git a/storage/framework/core/commerce/src/prints/store.ts b/storage/framework/core/commerce/src/receipts/store.ts similarity index 69% rename from storage/framework/core/commerce/src/prints/store.ts rename to storage/framework/core/commerce/src/receipts/store.ts index 627c329493..8580476aeb 100644 --- a/storage/framework/core/commerce/src/prints/store.ts +++ b/storage/framework/core/commerce/src/receipts/store.ts @@ -62,39 +62,32 @@ export async function bulkStore(requests: ReceiptRequestType[]): Promise if (!requests.length) return 0 - let createdCount = 0 - try { - // Process each print log - await db.transaction().execute(async (trx) => { - for (const request of requests) { - // Validate request data - request.validate() - - // Prepare print log data - const receiptData: NewReceipt = { - printer: request.get('printer'), - document: request.get('document'), - timestamp: request.get('timestamp'), - status: request.get('status'), - size: request.get('size'), - pages: request.get('pages'), - duration: request.get('duration'), - } - - receiptData.uuid = randomUUIDv7() - - // Insert the print log - await trx - .insertInto('receipts') - .values(receiptData) - .execute() - - createdCount++ + // Prepare all print log data + const receiptDataArray = requests.map((request) => { + // Validate request data + request.validate() + + // Prepare print log data + return { + printer: request.get('printer'), + document: request.get('document'), + timestamp: request.get('timestamp'), + status: request.get('status'), + size: request.get('size'), + pages: request.get('pages'), + duration: request.get('duration'), + uuid: randomUUIDv7(), } }) - return createdCount + // Insert all print logs in a single statement + const result = await db + .insertInto('receipts') + .values(receiptDataArray) + .executeTakeFirst() + + return Number(result.numInsertedOrUpdatedRows) } catch (error) { if (error instanceof Error) { diff --git a/storage/framework/core/commerce/src/prints/update.ts b/storage/framework/core/commerce/src/receipts/update.ts similarity index 100% rename from storage/framework/core/commerce/src/prints/update.ts rename to storage/framework/core/commerce/src/receipts/update.ts diff --git a/storage/framework/core/commerce/src/tests/prints.test.ts b/storage/framework/core/commerce/src/tests/receipts.test.ts similarity index 55% rename from storage/framework/core/commerce/src/tests/prints.test.ts rename to storage/framework/core/commerce/src/tests/receipts.test.ts index 79620e63c1..5e8bafd900 100644 --- a/storage/framework/core/commerce/src/tests/prints.test.ts +++ b/storage/framework/core/commerce/src/tests/receipts.test.ts @@ -1,10 +1,10 @@ import type { ReceiptJsonResponse } from '@stacksjs/orm' import { beforeEach, describe, expect, it } from 'bun:test' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, destroy } from '../prints/destroy' -import { fetchAll, fetchById, fetchPrintJobStats, fetchSuccessRate } from '../prints/fetch' -import { bulkStore, store } from '../prints/store' -import { update, updatePrintJob, updateStatus } from '../prints/update' +import { bulkDestroy, destroy } from '../receipts/destroy' +import { fetchAll, fetchById, fetchPageStats, fetchPrintJobStats, fetchPrintsPerHour, fetchPrintTimeStats, fetchSuccessRate } from '../receipts/fetch' +import { bulkStore, store } from '../receipts/store' +import { update, updatePrintJob, updateStatus } from '../receipts/update' // Create a request-like object for testing class TestRequest { @@ -669,5 +669,523 @@ describe('Print Log Module', () => { expect(stats.failed).toBe(0) expect(stats.successRate).toBe(100) // Only today's job was successful }) + + it('should calculate total pages and average pages per receipt within a date range', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + // Create test receipts with different page counts + const requests = [ + new TestRequest({ + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: startDate, + status: 'success', + size: 1024, + pages: 5, + duration: 30, + }), + new TestRequest({ + printer: 'Epson Printer', + document: 'report.pdf', + timestamp: startDate, + status: 'success', + size: 2048, + pages: 10, + duration: 45, + }), + new TestRequest({ + printer: 'Canon Printer', + document: 'document.pdf', + timestamp: startDate, + status: 'warning', + size: 512, + pages: 2, + duration: 15, + }), + new TestRequest({ + printer: 'Brother Printer', + document: 'error.pdf', + timestamp: startDate, + status: 'failed', + size: 256, + pages: 1, + duration: 5, + }), + ] + + await bulkStore(requests as any) + + // Fetch page statistics + const stats = await fetchPageStats(startDate, endDate) + + // Verify the statistics + expect(stats).toBeDefined() + expect(stats.totalReceipts).toBe(4) + expect(stats.totalPages).toBe(18) // 5 + 10 + 2 + 1 + expect(stats.averagePagesPerReceipt).toBe(5) // 18 / 4 rounded + }) + + it('should return zero statistics when no receipts exist in date range', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + const stats = await fetchPageStats(startDate, endDate) + + expect(stats).toBeDefined() + expect(stats.totalReceipts).toBe(0) + expect(stats.totalPages).toBe(0) + expect(stats.averagePagesPerReceipt).toBe(0) + }) + + it('should calculate correct average when all receipts have same page count', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + // Create test receipts with same page count + const requests = [ + new TestRequest({ + printer: 'HP LaserJet', + document: 'invoice1.pdf', + timestamp: startDate, + status: 'success', + size: 1024, + pages: 1, + duration: 30, + }), + new TestRequest({ + printer: 'Epson Printer', + document: 'invoice2.pdf', + timestamp: startDate, + status: 'success', + size: 2048, + pages: 1, + duration: 45, + }), + new TestRequest({ + printer: 'Canon Printer', + document: 'invoice3.pdf', + timestamp: startDate, + status: 'success', + size: 512, + pages: 1, + duration: 15, + }), + ] + + await bulkStore(requests as any) + + const stats = await fetchPageStats(startDate, endDate) + + expect(stats).toBeDefined() + expect(stats.totalReceipts).toBe(3) + expect(stats.totalPages).toBe(3) + expect(stats.averagePagesPerReceipt).toBe(1) // 3 / 3 = 1 + }) + + it('should only count receipts within the specified date range for page statistics', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + // Create receipts with different dates + const requests = [ + new TestRequest({ + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: startDate, + status: 'success', + size: 1024, + pages: 5, + duration: 30, + }), + new TestRequest({ + printer: 'Epson Printer', + document: 'report.pdf', + timestamp: startDate - 86400000, // Yesterday + status: 'success', + size: 2048, + pages: 10, + duration: 45, + }), + new TestRequest({ + printer: 'Canon Printer', + document: 'document.pdf', + timestamp: endDate + 1, // Tomorrow + status: 'warning', + size: 512, + pages: 2, + duration: 15, + }), + ] + + await bulkStore(requests as any) + + const stats = await fetchPageStats(startDate, endDate) + + // Verify only today's receipt is counted + expect(stats).toBeDefined() + expect(stats.totalReceipts).toBe(1) + expect(stats.totalPages).toBe(5) + expect(stats.averagePagesPerReceipt).toBe(5) // 5 / 1 = 5 + }) + + it('should calculate print time statistics within a date range', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + // Create test receipts with different durations + const requests = [ + new TestRequest({ + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: startDate, + status: 'success', + size: 1024, + pages: 5, + duration: 30, + }), + new TestRequest({ + printer: 'Epson Printer', + document: 'report.pdf', + timestamp: startDate, + status: 'success', + size: 2048, + pages: 10, + duration: 45, + }), + new TestRequest({ + printer: 'Canon Printer', + document: 'document.pdf', + timestamp: startDate, + status: 'warning', + size: 512, + pages: 2, + duration: 15, + }), + new TestRequest({ + printer: 'Brother Printer', + document: 'error.pdf', + timestamp: startDate, + status: 'failed', + size: 256, + pages: 1, + duration: 5, + }), + ] + + await bulkStore(requests as any) + + // Fetch print time statistics + const stats = await fetchPrintTimeStats(startDate, endDate) + + // Verify the statistics + expect(stats).toBeDefined() + expect(stats.totalJobs).toBe(4) + expect(stats.averageDuration).toBe(24) // (30 + 45 + 15 + 5) / 4 rounded + expect(stats.minDuration).toBe(5) + expect(stats.maxDuration).toBe(45) + }) + + it('should return zero statistics when no receipts exist in date range', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + const stats = await fetchPrintTimeStats(startDate, endDate) + + expect(stats).toBeDefined() + expect(stats.totalJobs).toBe(0) + expect(stats.averageDuration).toBe(0) + expect(stats.minDuration).toBe(0) + expect(stats.maxDuration).toBe(0) + }) + + it('should calculate correct statistics when all receipts have same duration', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + // Create test receipts with same duration + const requests = [ + new TestRequest({ + printer: 'HP LaserJet', + document: 'invoice1.pdf', + timestamp: startDate, + status: 'success', + size: 1024, + pages: 1, + duration: 30, + }), + new TestRequest({ + printer: 'Epson Printer', + document: 'invoice2.pdf', + timestamp: startDate, + status: 'success', + size: 2048, + pages: 1, + duration: 30, + }), + new TestRequest({ + printer: 'Canon Printer', + document: 'invoice3.pdf', + timestamp: startDate, + status: 'success', + size: 512, + pages: 1, + duration: 30, + }), + ] + + await bulkStore(requests as any) + + const stats = await fetchPrintTimeStats(startDate, endDate) + + expect(stats).toBeDefined() + expect(stats.totalJobs).toBe(3) + expect(stats.averageDuration).toBe(30) + expect(stats.minDuration).toBe(30) + expect(stats.maxDuration).toBe(30) + }) + + it('should only count receipts within the specified date range for print time statistics', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + // Create receipts with different dates + const requests = [ + new TestRequest({ + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: startDate, + status: 'success', + size: 1024, + pages: 5, + duration: 30, + }), + new TestRequest({ + printer: 'Epson Printer', + document: 'report.pdf', + timestamp: startDate - 86400000, // Yesterday + status: 'success', + size: 2048, + pages: 10, + duration: 45, + }), + new TestRequest({ + printer: 'Canon Printer', + document: 'document.pdf', + timestamp: endDate + 1, // Tomorrow + status: 'warning', + size: 512, + pages: 2, + duration: 15, + }), + ] + + await bulkStore(requests as any) + + const stats = await fetchPrintTimeStats(startDate, endDate) + + // Verify only today's receipt is counted + expect(stats).toBeDefined() + expect(stats.totalJobs).toBe(1) + expect(stats.averageDuration).toBe(30) + expect(stats.minDuration).toBe(30) + expect(stats.maxDuration).toBe(30) + }) + + it('should calculate prints per hour statistics within a date range', async () => { + // Use a fixed timestamp for today at midnight + const today = new Date() + today.setHours(0, 0, 0, 0) + const startDate = today.getTime() + const endDate = startDate + 86399999 // End of today + + // Create test receipts with different timestamps + const requests = [ + new TestRequest({ + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: startDate + (2 * 3600000), // 2 AM + status: 'success', + size: 1024, + pages: 5, + duration: 30, + }), + new TestRequest({ + printer: 'Epson Printer', + document: 'report.pdf', + timestamp: startDate + (2 * 3600000), // 2 AM + status: 'success', + size: 2048, + pages: 10, + duration: 45, + }), + new TestRequest({ + printer: 'Canon Printer', + document: 'document.pdf', + timestamp: startDate + (14 * 3600000), // 2 PM + status: 'warning', + size: 512, + pages: 2, + duration: 15, + }), + new TestRequest({ + printer: 'Brother Printer', + document: 'error.pdf', + timestamp: startDate + (14 * 3600000), // 2 PM + status: 'failed', + size: 256, + pages: 1, + duration: 5, + }), + ] + + await bulkStore(requests as any) + + // Fetch prints per hour statistics + const stats = await fetchPrintsPerHour(startDate, endDate) + + // Verify the statistics + expect(stats).toBeDefined() + expect(stats.totalPrints).toBe(4) + expect(stats.totalHours).toBe(24) + + // Verify hourly breakdown + expect(stats.hourlyBreakdown).toHaveLength(24) + expect(stats.hourlyBreakdown[2].count).toBe(2) // 2 prints at 2 AM + expect(stats.hourlyBreakdown[14].count).toBe(2) // 2 prints at 2 PM + // All other hours should have 0 prints + stats.hourlyBreakdown.forEach((hour: { hour: number, count: number }, index: number) => { + if (index !== 2 && index !== 14) { + expect(hour.count).toBe(0) + } + }) + }) + + it('should return zero statistics when no receipts exist in date range', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + const stats = await fetchPrintsPerHour(startDate, endDate) + + expect(stats).toBeDefined() + expect(stats.totalPrints).toBe(0) + expect(stats.totalHours).toBe(24) + expect(stats.printsPerHour).toBe(0) + expect(stats.hourlyBreakdown).toHaveLength(24) + stats.hourlyBreakdown.forEach((hour: { hour: number, count: number }) => { + expect(hour.count).toBe(0) + }) + }) + + it('should calculate correct statistics for a single hour', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 3600000 // One hour later + + // Create test receipts all in the same hour + const requests = [ + new TestRequest({ + printer: 'HP LaserJet', + document: 'invoice1.pdf', + timestamp: startDate, + status: 'success', + size: 1024, + pages: 1, + duration: 30, + }), + new TestRequest({ + printer: 'Epson Printer', + document: 'invoice2.pdf', + timestamp: startDate + 1800000, // 30 minutes later + status: 'success', + size: 2048, + pages: 1, + duration: 45, + }), + new TestRequest({ + printer: 'Canon Printer', + document: 'invoice3.pdf', + timestamp: startDate + 3000000, // 50 minutes later + status: 'success', + size: 512, + pages: 1, + duration: 15, + }), + ] + + await bulkStore(requests as any) + + const stats = await fetchPrintsPerHour(startDate, endDate) + + expect(stats).toBeDefined() + expect(stats.totalPrints).toBe(3) + expect(stats.totalHours).toBe(1) + expect(stats.printsPerHour).toBe(3) // 3 prints / 1 hour + expect(stats.hourlyBreakdown).toHaveLength(24) + // Only the first hour should have prints + stats.hourlyBreakdown.forEach((hour: { hour: number, count: number }, index: number) => { + expect(hour.count).toBe(index === 0 ? 3 : 0) + }) + }) + + it('should only count receipts within the specified date range for hourly statistics', async () => { + const now = Date.now() + const startDate = now - (now % 86400000) // Start of today + const endDate = startDate + 86399999 // End of today + + // Create receipts with different dates + const requests = [ + new TestRequest({ + printer: 'HP LaserJet', + document: 'invoice.pdf', + timestamp: startDate, + status: 'success', + size: 1024, + pages: 5, + duration: 30, + }), + new TestRequest({ + printer: 'Epson Printer', + document: 'report.pdf', + timestamp: startDate - 86400000, // Yesterday + status: 'success', + size: 2048, + pages: 10, + duration: 45, + }), + new TestRequest({ + printer: 'Canon Printer', + document: 'document.pdf', + timestamp: endDate + 1, // Tomorrow + status: 'warning', + size: 512, + pages: 2, + duration: 15, + }), + ] + + await bulkStore(requests as any) + + const stats = await fetchPrintsPerHour(startDate, endDate) + + // Verify only today's receipt is counted + expect(stats).toBeDefined() + expect(stats.totalPrints).toBe(1) + expect(stats.totalHours).toBe(24) + expect(stats.hourlyBreakdown).toHaveLength(24) + // Only the first hour should have prints + stats.hourlyBreakdown.forEach((hour: { hour: number, count: number }, index: number) => { + expect(hour.count).toBe(index === 0 ? 1 : 0) + }) + }) }) }) diff --git a/storage/framework/core/commerce/src/tests/storage/logs/stacks.log b/storage/framework/core/commerce/src/tests/storage/logs/stacks.log index 4a9ec87994..4eb993a930 100644 --- a/storage/framework/core/commerce/src/tests/storage/logs/stacks.log +++ b/storage/framework/core/commerce/src/tests/storage/logs/stacks.log @@ -854,3 +854,292 @@ [2025-03-27T12:26:47.910Z] INFO: Migrating database... [2025-03-27T12:26:48.063Z] INFO: Migrating database... [2025-03-27T12:26:48.204Z] INFO: Migrating database... +[2025-03-31T11:22:08.668Z] DEBUG: Using database driver: sqlite +[2025-03-31T11:22:08.880Z] INFO: Migrating database... +[2025-03-31T11:22:09.076Z] INFO: Migrating database... +[2025-03-31T11:22:09.248Z] INFO: Migrating database... +[2025-03-31T11:22:09.410Z] INFO: Migrating database... +[2025-03-31T11:22:09.567Z] INFO: Migrating database... +[2025-03-31T11:22:09.729Z] INFO: Migrating database... +[2025-03-31T11:22:09.907Z] INFO: Migrating database... +[2025-03-31T11:22:10.074Z] INFO: Migrating database... +[2025-03-31T11:22:10.249Z] INFO: Migrating database... +[2025-03-31T11:22:10.404Z] INFO: Migrating database... +[2025-03-31T11:22:10.560Z] INFO: Migrating database... +[2025-03-31T11:22:10.720Z] INFO: Migrating database... +[2025-03-31T11:22:10.896Z] INFO: Migrating database... +[2025-03-31T11:22:11.055Z] INFO: Migrating database... +[2025-03-31T11:22:11.220Z] INFO: Migrating database... +[2025-03-31T11:22:11.383Z] INFO: Migrating database... +[2025-03-31T11:22:11.552Z] INFO: Migrating database... +[2025-03-31T11:22:11.711Z] INFO: Migrating database... +[2025-03-31T11:22:11.883Z] INFO: Migrating database... +[2025-03-31T11:22:12.047Z] INFO: Migrating database... +[2025-03-31T11:22:12.199Z] INFO: Migrating database... +[2025-03-31T11:22:12.364Z] INFO: Migrating database... +[2025-03-31T11:22:12.526Z] INFO: Migrating database... +[2025-03-31T11:22:12.692Z] INFO: Migrating database... +[2025-03-31T11:22:12.848Z] INFO: Migrating database... +[2025-03-31T11:22:13.007Z] INFO: Migrating database... +[2025-03-31T11:22:13.155Z] INFO: Migrating database... +[2025-03-31T11:22:13.316Z] INFO: Migrating database... +[2025-03-31T11:22:13.472Z] INFO: Migrating database... +[2025-03-31T11:22:13.632Z] INFO: Migrating database... +[2025-03-31T11:23:48.371Z] DEBUG: Using database driver: sqlite +[2025-03-31T11:23:48.566Z] INFO: Migrating database... +[2025-03-31T11:23:48.732Z] INFO: Migrating database... +[2025-03-31T11:23:48.878Z] INFO: Migrating database... +[2025-03-31T11:23:49.030Z] INFO: Migrating database... +[2025-03-31T11:23:49.171Z] INFO: Migrating database... +[2025-03-31T11:23:49.319Z] INFO: Migrating database... +[2025-03-31T11:23:49.466Z] INFO: Migrating database... +[2025-03-31T11:23:49.614Z] INFO: Migrating database... +[2025-03-31T11:23:49.756Z] INFO: Migrating database... +[2025-03-31T11:23:49.907Z] INFO: Migrating database... +[2025-03-31T11:23:50.074Z] INFO: Migrating database... +[2025-03-31T11:23:50.319Z] INFO: Migrating database... +[2025-03-31T11:23:50.469Z] INFO: Migrating database... +[2025-03-31T11:23:50.618Z] INFO: Migrating database... +[2025-03-31T11:23:50.755Z] INFO: Migrating database... +[2025-03-31T11:23:50.905Z] INFO: Migrating database... +[2025-03-31T11:23:51.069Z] INFO: Migrating database... +[2025-03-31T11:23:51.226Z] INFO: Migrating database... +[2025-03-31T11:23:51.377Z] INFO: Migrating database... +[2025-03-31T11:23:51.533Z] INFO: Migrating database... +[2025-03-31T11:23:51.675Z] INFO: Migrating database... +[2025-03-31T11:23:51.819Z] INFO: Migrating database... +[2025-03-31T11:23:51.971Z] INFO: Migrating database... +[2025-03-31T11:23:52.122Z] INFO: Migrating database... +[2025-03-31T11:23:52.274Z] INFO: Migrating database... +[2025-03-31T11:23:52.426Z] INFO: Migrating database... +[2025-03-31T11:23:52.576Z] INFO: Migrating database... +[2025-03-31T11:23:52.717Z] INFO: Migrating database... +[2025-03-31T11:23:52.854Z] INFO: Migrating database... +[2025-03-31T11:23:53.013Z] INFO: Migrating database... +[2025-03-31T11:25:10.536Z] DEBUG: Using database driver: sqlite +[2025-03-31T11:25:10.828Z] INFO: Migrating database... +[2025-03-31T11:25:11.011Z] INFO: Migrating database... +[2025-03-31T11:25:11.178Z] INFO: Migrating database... +[2025-03-31T11:25:11.353Z] INFO: Migrating database... +[2025-03-31T11:25:11.515Z] INFO: Migrating database... +[2025-03-31T11:25:11.714Z] INFO: Migrating database... +[2025-03-31T11:25:11.891Z] INFO: Migrating database... +[2025-03-31T11:25:12.061Z] INFO: Migrating database... +[2025-03-31T11:25:12.238Z] INFO: Migrating database... +[2025-03-31T11:25:32.643Z] DEBUG: Using database driver: sqlite +[2025-03-31T11:25:32.816Z] INFO: Migrating database... +[2025-03-31T11:25:32.983Z] INFO: Migrating database... +[2025-03-31T11:25:33.128Z] INFO: Migrating database... +[2025-03-31T11:25:33.276Z] INFO: Migrating database... +[2025-03-31T11:25:33.428Z] INFO: Migrating database... +[2025-03-31T11:25:33.566Z] INFO: Migrating database... +[2025-03-31T11:25:33.712Z] INFO: Migrating database... +[2025-03-31T11:25:33.870Z] INFO: Migrating database... +[2025-03-31T11:25:34.022Z] INFO: Migrating database... +[2025-03-31T11:25:34.181Z] INFO: Migrating database... +[2025-03-31T11:25:34.360Z] INFO: Migrating database... +[2025-03-31T11:25:34.559Z] INFO: Migrating database... +[2025-03-31T11:25:34.708Z] INFO: Migrating database... +[2025-03-31T11:25:34.908Z] INFO: Migrating database... +[2025-03-31T11:25:35.102Z] INFO: Migrating database... +[2025-03-31T11:25:35.291Z] INFO: Migrating database... +[2025-03-31T11:25:35.488Z] INFO: Migrating database... +[2025-03-31T11:25:35.684Z] INFO: Migrating database... +[2025-03-31T11:25:35.971Z] INFO: Migrating database... +[2025-03-31T11:25:36.125Z] INFO: Migrating database... +[2025-03-31T11:25:36.306Z] INFO: Migrating database... +[2025-03-31T11:25:36.512Z] INFO: Migrating database... +[2025-03-31T11:25:36.713Z] INFO: Migrating database... +[2025-03-31T11:25:36.884Z] INFO: Migrating database... +[2025-03-31T11:25:37.044Z] INFO: Migrating database... +[2025-03-31T11:25:37.187Z] INFO: Migrating database... +[2025-03-31T11:25:37.331Z] INFO: Migrating database... +[2025-03-31T11:25:37.490Z] INFO: Migrating database... +[2025-03-31T11:25:37.654Z] INFO: Migrating database... +[2025-03-31T11:25:37.818Z] INFO: Migrating database... +[2025-03-31T11:26:38.001Z] DEBUG: Using database driver: sqlite +[2025-03-31T11:26:38.434Z] INFO: Migrating database... +[2025-03-31T11:26:38.601Z] INFO: Migrating database... +[2025-03-31T11:26:38.755Z] INFO: Migrating database... +[2025-03-31T11:26:38.899Z] INFO: Migrating database... +[2025-03-31T11:26:39.040Z] INFO: Migrating database... +[2025-03-31T11:26:39.184Z] INFO: Migrating database... +[2025-03-31T11:26:39.361Z] INFO: Migrating database... +[2025-03-31T11:26:39.500Z] INFO: Migrating database... +[2025-03-31T11:26:39.648Z] INFO: Migrating database... +[2025-03-31T11:26:39.811Z] INFO: Migrating database... +[2025-03-31T11:26:39.967Z] INFO: Migrating database... +[2025-03-31T11:26:40.121Z] INFO: Migrating database... +[2025-03-31T11:26:40.288Z] INFO: Migrating database... +[2025-03-31T11:26:40.434Z] INFO: Migrating database... +[2025-03-31T11:26:40.580Z] INFO: Migrating database... +[2025-03-31T11:26:40.729Z] INFO: Migrating database... +[2025-03-31T11:26:40.870Z] INFO: Migrating database... +[2025-03-31T11:26:41.017Z] INFO: Migrating database... +[2025-03-31T11:26:41.169Z] INFO: Migrating database... +[2025-03-31T11:26:41.329Z] INFO: Migrating database... +[2025-03-31T11:26:41.475Z] INFO: Migrating database... +[2025-03-31T11:26:41.618Z] INFO: Migrating database... +[2025-03-31T11:26:41.780Z] INFO: Migrating database... +[2025-03-31T11:26:41.926Z] INFO: Migrating database... +[2025-03-31T11:26:42.068Z] INFO: Migrating database... +[2025-03-31T11:26:42.220Z] INFO: Migrating database... +[2025-03-31T11:26:42.379Z] INFO: Migrating database... +[2025-03-31T11:26:42.536Z] INFO: Migrating database... +[2025-03-31T11:26:42.730Z] INFO: Migrating database... +[2025-03-31T11:26:42.925Z] INFO: Migrating database... +[2025-03-31T11:27:33.782Z] DEBUG: Using database driver: sqlite +[2025-03-31T11:27:33.978Z] INFO: Migrating database... +[2025-03-31T11:27:34.149Z] INFO: Migrating database... +[2025-03-31T11:27:34.299Z] INFO: Migrating database... +[2025-03-31T11:27:34.446Z] INFO: Migrating database... +[2025-03-31T11:27:34.610Z] INFO: Migrating database... +[2025-03-31T11:27:34.747Z] INFO: Migrating database... +[2025-03-31T11:27:34.893Z] INFO: Migrating database... +[2025-03-31T11:27:35.044Z] INFO: Migrating database... +[2025-03-31T11:27:35.186Z] INFO: Migrating database... +[2025-03-31T11:27:35.341Z] INFO: Migrating database... +[2025-03-31T11:27:35.504Z] INFO: Migrating database... +[2025-03-31T11:27:35.664Z] INFO: Migrating database... +[2025-03-31T11:27:35.819Z] INFO: Migrating database... +[2025-03-31T11:27:35.992Z] INFO: Migrating database... +[2025-03-31T11:27:36.185Z] INFO: Migrating database... +[2025-03-31T11:27:36.392Z] INFO: Migrating database... +[2025-03-31T11:27:36.573Z] INFO: Migrating database... +[2025-03-31T11:27:36.753Z] INFO: Migrating database... +[2025-03-31T11:27:36.904Z] INFO: Migrating database... +[2025-03-31T11:27:37.071Z] INFO: Migrating database... +[2025-03-31T11:27:37.216Z] INFO: Migrating database... +[2025-03-31T11:27:37.358Z] INFO: Migrating database... +[2025-03-31T11:27:37.523Z] INFO: Migrating database... +[2025-03-31T11:27:37.682Z] INFO: Migrating database... +[2025-03-31T11:27:37.902Z] INFO: Migrating database... +[2025-03-31T11:27:38.082Z] INFO: Migrating database... +[2025-03-31T11:27:38.270Z] INFO: Migrating database... +[2025-03-31T11:27:38.464Z] INFO: Migrating database... +[2025-03-31T11:27:38.658Z] INFO: Migrating database... +[2025-03-31T11:27:38.848Z] INFO: Migrating database... +[2025-03-31T11:30:23.988Z] DEBUG: Using database driver: sqlite +[2025-03-31T11:30:24.194Z] INFO: Migrating database... +[2025-03-31T11:30:24.369Z] INFO: Migrating database... +[2025-03-31T11:30:24.527Z] INFO: Migrating database... +[2025-03-31T11:30:24.680Z] INFO: Migrating database... +[2025-03-31T11:30:24.819Z] INFO: Migrating database... +[2025-03-31T11:30:24.955Z] INFO: Migrating database... +[2025-03-31T11:30:25.099Z] INFO: Migrating database... +[2025-03-31T11:30:25.334Z] INFO: Migrating database... +[2025-03-31T11:30:25.514Z] INFO: Migrating database... +[2025-03-31T11:30:25.763Z] INFO: Migrating database... +[2025-03-31T11:30:26.097Z] INFO: Migrating database... +[2025-03-31T11:30:26.362Z] INFO: Migrating database... +[2025-03-31T11:30:26.520Z] INFO: Migrating database... +[2025-03-31T11:30:26.686Z] INFO: Migrating database... +[2025-03-31T11:30:26.854Z] INFO: Migrating database... +[2025-03-31T11:30:27.022Z] INFO: Migrating database... +[2025-03-31T11:30:27.197Z] INFO: Migrating database... +[2025-03-31T11:30:27.517Z] INFO: Migrating database... +[2025-03-31T11:30:27.689Z] INFO: Migrating database... +[2025-03-31T11:30:27.890Z] INFO: Migrating database... +[2025-03-31T11:30:28.174Z] INFO: Migrating database... +[2025-03-31T11:30:28.375Z] INFO: Migrating database... +[2025-03-31T11:30:28.603Z] INFO: Migrating database... +[2025-03-31T11:30:29.075Z] INFO: Migrating database... +[2025-03-31T11:30:29.376Z] INFO: Migrating database... +[2025-03-31T11:30:29.544Z] INFO: Migrating database... +[2025-03-31T11:30:29.706Z] INFO: Migrating database... +[2025-03-31T11:30:29.875Z] INFO: Migrating database... +[2025-03-31T11:30:30.067Z] INFO: Migrating database... +[2025-03-31T11:30:30.275Z] INFO: Migrating database... +[2025-03-31T11:30:50.343Z] DEBUG: Using database driver: sqlite +[2025-03-31T11:30:50.539Z] INFO: Migrating database... +[2025-03-31T11:30:50.724Z] INFO: Migrating database... +[2025-03-31T11:30:50.864Z] INFO: Migrating database... +[2025-03-31T11:30:51.007Z] INFO: Migrating database... +[2025-03-31T11:30:51.144Z] INFO: Migrating database... +[2025-03-31T11:30:51.288Z] INFO: Migrating database... +[2025-03-31T11:30:51.454Z] INFO: Migrating database... +[2025-03-31T11:30:51.663Z] INFO: Migrating database... +[2025-03-31T11:30:51.896Z] INFO: Migrating database... +[2025-03-31T11:30:52.092Z] INFO: Migrating database... +[2025-03-31T11:30:52.282Z] INFO: Migrating database... +[2025-03-31T11:30:52.484Z] INFO: Migrating database... +[2025-03-31T11:30:52.697Z] INFO: Migrating database... +[2025-03-31T11:30:52.846Z] INFO: Migrating database... +[2025-03-31T11:30:53.000Z] INFO: Migrating database... +[2025-03-31T11:30:53.155Z] INFO: Migrating database... +[2025-03-31T11:30:53.297Z] INFO: Migrating database... +[2025-03-31T11:30:53.436Z] INFO: Migrating database... +[2025-03-31T11:30:53.586Z] INFO: Migrating database... +[2025-03-31T11:30:53.734Z] INFO: Migrating database... +[2025-03-31T11:30:53.882Z] INFO: Migrating database... +[2025-03-31T11:30:54.061Z] INFO: Migrating database... +[2025-03-31T11:30:54.221Z] INFO: Migrating database... +[2025-03-31T11:30:54.380Z] INFO: Migrating database... +[2025-03-31T11:30:54.534Z] INFO: Migrating database... +[2025-03-31T11:30:54.688Z] INFO: Migrating database... +[2025-03-31T11:30:54.837Z] INFO: Migrating database... +[2025-03-31T11:30:54.988Z] INFO: Migrating database... +[2025-03-31T11:30:55.144Z] INFO: Migrating database... +[2025-03-31T11:30:55.295Z] INFO: Migrating database... +[2025-03-31T11:33:19.260Z] DEBUG: Using database driver: sqlite +[2025-03-31T11:33:19.458Z] INFO: Migrating database... +[2025-03-31T11:33:19.625Z] INFO: Migrating database... +[2025-03-31T11:33:19.783Z] INFO: Migrating database... +[2025-03-31T11:33:19.938Z] INFO: Migrating database... +[2025-03-31T11:33:20.126Z] INFO: Migrating database... +[2025-03-31T11:33:20.285Z] INFO: Migrating database... +[2025-03-31T11:33:20.489Z] INFO: Migrating database... +[2025-03-31T11:33:20.672Z] INFO: Migrating database... +[2025-03-31T11:33:20.889Z] INFO: Migrating database... +[2025-03-31T11:33:21.078Z] INFO: Migrating database... +[2025-03-31T11:33:21.303Z] INFO: Migrating database... +[2025-03-31T11:33:21.446Z] INFO: Migrating database... +[2025-03-31T11:33:21.591Z] INFO: Migrating database... +[2025-03-31T11:33:21.736Z] INFO: Migrating database... +[2025-03-31T11:33:21.886Z] INFO: Migrating database... +[2025-03-31T11:33:22.046Z] INFO: Migrating database... +[2025-03-31T11:33:22.204Z] INFO: Migrating database... +[2025-03-31T11:33:22.368Z] INFO: Migrating database... +[2025-03-31T11:33:22.528Z] INFO: Migrating database... +[2025-03-31T11:33:22.675Z] INFO: Migrating database... +[2025-03-31T11:33:22.820Z] INFO: Migrating database... +[2025-03-31T11:33:22.980Z] INFO: Migrating database... +[2025-03-31T11:33:23.197Z] INFO: Migrating database... +[2025-03-31T11:33:23.420Z] INFO: Migrating database... +[2025-03-31T11:33:23.631Z] INFO: Migrating database... +[2025-03-31T11:33:23.823Z] INFO: Migrating database... +[2025-03-31T11:33:24.029Z] INFO: Migrating database... +[2025-03-31T11:33:24.252Z] INFO: Migrating database... +[2025-03-31T11:33:24.400Z] INFO: Migrating database... +[2025-03-31T11:33:24.550Z] INFO: Migrating database... +[2025-03-31T11:33:38.546Z] DEBUG: Using database driver: sqlite +[2025-03-31T11:33:38.751Z] INFO: Migrating database... +[2025-03-31T11:33:38.948Z] INFO: Migrating database... +[2025-03-31T11:33:39.105Z] INFO: Migrating database... +[2025-03-31T11:33:39.307Z] INFO: Migrating database... +[2025-03-31T11:33:39.514Z] INFO: Migrating database... +[2025-03-31T11:33:39.731Z] INFO: Migrating database... +[2025-03-31T11:33:39.940Z] INFO: Migrating database... +[2025-03-31T11:33:40.182Z] INFO: Migrating database... +[2025-03-31T11:33:40.350Z] INFO: Migrating database... +[2025-03-31T11:33:40.508Z] INFO: Migrating database... +[2025-03-31T11:33:40.655Z] INFO: Migrating database... +[2025-03-31T11:33:40.907Z] INFO: Migrating database... +[2025-03-31T11:33:41.051Z] INFO: Migrating database... +[2025-03-31T11:33:41.205Z] INFO: Migrating database... +[2025-03-31T11:33:41.359Z] INFO: Migrating database... +[2025-03-31T11:33:41.544Z] INFO: Migrating database... +[2025-03-31T11:33:41.739Z] INFO: Migrating database... +[2025-03-31T11:33:41.983Z] INFO: Migrating database... +[2025-03-31T11:33:42.192Z] INFO: Migrating database... +[2025-03-31T11:33:42.374Z] INFO: Migrating database... +[2025-03-31T11:33:42.572Z] INFO: Migrating database... +[2025-03-31T11:33:42.744Z] INFO: Migrating database... +[2025-03-31T11:33:42.890Z] INFO: Migrating database... +[2025-03-31T11:33:43.033Z] INFO: Migrating database... +[2025-03-31T11:33:43.167Z] INFO: Migrating database... +[2025-03-31T11:33:43.324Z] INFO: Migrating database... +[2025-03-31T11:33:43.479Z] INFO: Migrating database... +[2025-03-31T11:33:43.634Z] INFO: Migrating database... +[2025-03-31T11:33:43.793Z] INFO: Migrating database... +[2025-03-31T11:33:43.943Z] INFO: Migrating database... From fa4b0e038764488f14845efe8967d4ca9f8fccd4 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Mon, 31 Mar 2025 20:03:26 +0800 Subject: [PATCH 27/78] chore: wip --- .../src/PrintDeviceDestroyOrmAction.ts | 20 + .../actions/src/PrintDeviceIndexOrmAction.ts | 13 + .../actions/src/PrintDeviceShowOrmAction.ts | 18 + .../actions/src/PrintDeviceStoreOrmAction.ts | 17 + .../actions/src/PrintDeviceUpdateOrmAction.ts | 21 + .../framework/core/types/src/model-names.ts | 2 +- .../framework/core/types/src/table-names.ts | 2 +- .../defaults/models/ecommerce/PrintDevice.ts | 125 ++ storage/framework/orm/routes.ts | 10 + storage/framework/orm/src/index.ts | 2 + .../framework/orm/src/models/PrintDevice.ts | 1032 +++++++++++++++++ storage/framework/orm/src/types.ts | 2 + .../framework/requests/PrintDeviceRequest.ts | 48 + storage/framework/server-auto-imports.json | 9 + storage/framework/types/attributes.ts | 5 + storage/framework/types/events.ts | 4 + storage/framework/types/requests.d.ts | 30 +- .../framework/types/server-auto-imports.d.ts | 9 + 18 files changed, 1366 insertions(+), 3 deletions(-) create mode 100644 storage/framework/actions/src/PrintDeviceDestroyOrmAction.ts create mode 100644 storage/framework/actions/src/PrintDeviceIndexOrmAction.ts create mode 100644 storage/framework/actions/src/PrintDeviceShowOrmAction.ts create mode 100644 storage/framework/actions/src/PrintDeviceStoreOrmAction.ts create mode 100644 storage/framework/actions/src/PrintDeviceUpdateOrmAction.ts create mode 100644 storage/framework/defaults/models/ecommerce/PrintDevice.ts create mode 100644 storage/framework/orm/src/models/PrintDevice.ts create mode 100644 storage/framework/requests/PrintDeviceRequest.ts diff --git a/storage/framework/actions/src/PrintDeviceDestroyOrmAction.ts b/storage/framework/actions/src/PrintDeviceDestroyOrmAction.ts new file mode 100644 index 0000000000..450c79a75d --- /dev/null +++ b/storage/framework/actions/src/PrintDeviceDestroyOrmAction.ts @@ -0,0 +1,20 @@ +import type { PrintDeviceRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { PrintDevice } from '@stacksjs/orm' +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'PrintDevice Destroy', + description: 'PrintDevice Destroy ORM Action', + method: 'DELETE', + async handle(request: PrintDeviceRequestType) { + const id = request.getParam('id') + + const model = await PrintDevice.findOrFail(Number(id)) + + model.delete() + + return response.json({ message: 'Model deleted!' }) + }, +}) diff --git a/storage/framework/actions/src/PrintDeviceIndexOrmAction.ts b/storage/framework/actions/src/PrintDeviceIndexOrmAction.ts new file mode 100644 index 0000000000..96b441936a --- /dev/null +++ b/storage/framework/actions/src/PrintDeviceIndexOrmAction.ts @@ -0,0 +1,13 @@ +import { Action } from '@stacksjs/actions' +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'PrintDevice Index', + description: 'PrintDevice Index ORM Action', + method: 'GET', + async handle() { + const results = PrintDevice.all() + + return response.json(results) + }, +}) diff --git a/storage/framework/actions/src/PrintDeviceShowOrmAction.ts b/storage/framework/actions/src/PrintDeviceShowOrmAction.ts new file mode 100644 index 0000000000..ffaf530b9c --- /dev/null +++ b/storage/framework/actions/src/PrintDeviceShowOrmAction.ts @@ -0,0 +1,18 @@ +import type { PrintDeviceRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { PrintDevice } from '@stacksjs/orm' +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'PrintDevice Show', + description: 'PrintDevice Show ORM Action', + method: 'GET', + async handle(request: PrintDeviceRequestType) { + const id = request.getParam('id') + + const model = await PrintDevice.findOrFail(Number(id)) + + return response.json(model) + }, +}) diff --git a/storage/framework/actions/src/PrintDeviceStoreOrmAction.ts b/storage/framework/actions/src/PrintDeviceStoreOrmAction.ts new file mode 100644 index 0000000000..715d9c6d31 --- /dev/null +++ b/storage/framework/actions/src/PrintDeviceStoreOrmAction.ts @@ -0,0 +1,17 @@ +import type { PrintDeviceRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { PrintDevice } from '@stacksjs/orm' +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'PrintDevice Store', + description: 'PrintDevice Store ORM Action', + method: 'POST', + async handle(request: PrintDeviceRequestType) { + await request.validate() + const model = await PrintDevice.create(request.all()) + + return response.json(model) + }, +}) diff --git a/storage/framework/actions/src/PrintDeviceUpdateOrmAction.ts b/storage/framework/actions/src/PrintDeviceUpdateOrmAction.ts new file mode 100644 index 0000000000..b4f4f033d2 --- /dev/null +++ b/storage/framework/actions/src/PrintDeviceUpdateOrmAction.ts @@ -0,0 +1,21 @@ +import type { PrintDeviceRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { PrintDevice } from '@stacksjs/orm' +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'PrintDevice Update', + description: 'PrintDevice Update ORM Action', + method: 'PATCH', + async handle(request: PrintDeviceRequestType) { + await request.validate() + + const id = request.getParam('id') + const model = await PrintDevice.findOrFail(Number(id)) + + const result = model.update(request.all()) + + return response.json(result) + }, +}) diff --git a/storage/framework/core/types/src/model-names.ts b/storage/framework/core/types/src/model-names.ts index c66192070b..84f7e31b9b 100644 --- a/storage/framework/core/types/src/model-names.ts +++ b/storage/framework/core/types/src/model-names.ts @@ -1 +1 @@ -export type ModelNames = 'Project' | 'SubscriberEmail' | 'AccessToken' | 'Team' | 'Subscriber' | 'Deployment' | 'Release' | 'User' | 'Post' | 'Category' | 'Payment' | 'Driver' | 'WaitlistProduct' | 'DigitalDelivery' | 'Manufacturer' | 'OrderItem' | 'ShippingZone' | 'Customer' | 'Product' | 'Receipt' | 'ProductVariant' | 'LicenseKey' | 'WaitlistRestaurant' | 'Review' | 'ProductUnit' | 'GiftCard' | 'Order' | 'Coupon' | 'TaxRate' | 'Transaction' | 'LoyaltyPoint' | 'ProductItem' | 'LoyaltyReward' | 'ShippingMethod' | 'ShippingRate' | 'DeliveryRoute' | 'FailedJob' | 'PaymentMethod' | 'PaymentTransaction' | 'Request' | 'Job' | 'Subscription' | 'PaymentProduct' | 'Error' +export type ModelNames = 'Project' | 'SubscriberEmail' | 'AccessToken' | 'Team' | 'Subscriber' | 'Deployment' | 'Release' | 'User' | 'Post' | 'PrintDevice' | 'Category' | 'Payment' | 'Driver' | 'WaitlistProduct' | 'DigitalDelivery' | 'Manufacturer' | 'OrderItem' | 'ShippingZone' | 'Customer' | 'Product' | 'Receipt' | 'ProductVariant' | 'LicenseKey' | 'WaitlistRestaurant' | 'Review' | 'ProductUnit' | 'GiftCard' | 'Order' | 'Coupon' | 'TaxRate' | 'Transaction' | 'LoyaltyPoint' | 'ProductItem' | 'LoyaltyReward' | 'ShippingMethod' | 'ShippingRate' | 'DeliveryRoute' | 'FailedJob' | 'PaymentMethod' | 'PaymentTransaction' | 'Request' | 'Job' | 'Subscription' | 'PaymentProduct' | 'Error' diff --git a/storage/framework/core/types/src/table-names.ts b/storage/framework/core/types/src/table-names.ts index dab9d91908..d74343d295 100644 --- a/storage/framework/core/types/src/table-names.ts +++ b/storage/framework/core/types/src/table-names.ts @@ -1 +1 @@ -export type TableNames = 'projects' | 'subscriber_emails' | 'personal_access_tokens' | 'team_users' | 'teams' | 'subscribers' | 'deployments' | 'releases' | 'team_users' | 'users' | 'posts' | 'categories' | 'payments' | 'drivers' | 'waitlist_products' | 'digital_deliveries' | 'manufacturers' | 'order_items' | 'shipping_zones' | 'customers' | 'products' | 'receipts' | 'product_variants' | 'license_keys' | 'waitlist_restaurants' | 'reviews' | 'product_units' | 'gift_cards' | 'orders' | 'coupons' | 'tax_rates' | 'transactions' | 'loyalty_points' | 'product_items' | 'loyalty_rewards' | 'shipping_methods' | 'shipping_rates' | 'delivery_routes' | 'failed_jobs' | 'payment_methods' | 'payment_transactions' | 'requests' | 'jobs' | 'subscriptions' | 'payment_products' | 'errors' +export type TableNames = 'projects' | 'subscriber_emails' | 'personal_access_tokens' | 'team_users' | 'teams' | 'subscribers' | 'deployments' | 'releases' | 'team_users' | 'users' | 'posts' | 'print_devices' | 'categories' | 'payments' | 'drivers' | 'waitlist_products' | 'digital_deliveries' | 'manufacturers' | 'order_items' | 'shipping_zones' | 'customers' | 'products' | 'receipts' | 'product_variants' | 'license_keys' | 'waitlist_restaurants' | 'reviews' | 'product_units' | 'gift_cards' | 'orders' | 'coupons' | 'tax_rates' | 'transactions' | 'loyalty_points' | 'product_items' | 'loyalty_rewards' | 'shipping_methods' | 'shipping_rates' | 'delivery_routes' | 'failed_jobs' | 'payment_methods' | 'payment_transactions' | 'requests' | 'jobs' | 'subscriptions' | 'payment_products' | 'errors' diff --git a/storage/framework/defaults/models/ecommerce/PrintDevice.ts b/storage/framework/defaults/models/ecommerce/PrintDevice.ts new file mode 100644 index 0000000000..678a55bf3c --- /dev/null +++ b/storage/framework/defaults/models/ecommerce/PrintDevice.ts @@ -0,0 +1,125 @@ +import type { Model } from '@stacksjs/types' +import { schema } from '@stacksjs/validation' + +export default { + name: 'PrintDevice', + table: 'print_devices', + primaryKey: 'id', + autoIncrement: true, + + traits: { + useUuid: true, + useTimestamps: true, + useSearch: { + displayable: ['id', 'name', 'mac_address', 'location', 'terminal', 'status', 'last_ping', 'print_count'], + searchable: ['name', 'mac_address', 'location', 'terminal'], + sortable: ['last_ping', 'print_count'], + filterable: ['status'], + }, + + useSeeder: { + count: 5, + }, + + useApi: { + uri: 'print-devices', + routes: ['index', 'store', 'show', 'update', 'destroy'], + }, + + observe: true, + }, + + attributes: { + name: { + required: true, + order: 1, + fillable: true, + validation: { + rule: schema.string().maxLength(100), + message: { + maxLength: 'Device name must have a maximum of 100 characters', + }, + }, + factory: faker => faker.company.name(), + }, + + mac_address: { + required: true, + order: 2, + fillable: true, + validation: { + rule: schema.string().maxLength(50), + message: { + maxLength: 'MAC address must have a maximum of 50 characters', + }, + }, + factory: faker => faker.internet.mac(), + }, + + location: { + required: true, + order: 3, + fillable: true, + validation: { + rule: schema.string().maxLength(100), + message: { + maxLength: 'Location must have a maximum of 100 characters', + }, + }, + factory: faker => faker.location.streetAddress(), + }, + + terminal: { + required: true, + order: 4, + fillable: true, + validation: { + rule: schema.string().maxLength(50), + message: { + maxLength: 'Terminal must have a maximum of 50 characters', + }, + }, + factory: faker => faker.string.alphanumeric(10), + }, + + status: { + required: true, + order: 5, + fillable: true, + validation: { + rule: schema.enum(['online', 'offline', 'warning'] as const), + }, + factory: faker => faker.helpers.arrayElement(['online', 'offline', 'warning']), + }, + + last_ping: { + required: true, + order: 6, + fillable: true, + validation: { + rule: schema.number(), + message: { + invalid: 'Invalid timestamp format', + }, + }, + factory: faker => faker.date.recent(), + }, + + print_count: { + required: true, + order: 7, + fillable: true, + validation: { + rule: schema.number().min(0), + message: { + min: 'Print count cannot be negative', + }, + }, + factory: faker => faker.number.int({ min: 0, max: 1000 }), + }, + }, + + dashboard: { + highlight: true, + }, +} satisfies Model diff --git a/storage/framework/orm/routes.ts b/storage/framework/orm/routes.ts index de893fe930..cca8927054 100644 --- a/storage/framework/orm/routes.ts +++ b/storage/framework/orm/routes.ts @@ -6,6 +6,16 @@ route.post('users', 'UserStoreOrmAction') route.get('users/{id}', 'UserShowOrmAction') +route.get('print-devices', 'PrintDeviceIndexOrmAction') + +route.post('print-devices', 'PrintDeviceStoreOrmAction') + +route.get('print-devices/{id}', 'PrintDeviceShowOrmAction') + +route.patch('print-devices/{id}', 'PrintDeviceUpdateOrmAction') + +route.delete('print-devices/{id}', 'PrintDeviceDestroyOrmAction') + route.get('product-categories', 'CategoryIndexOrmAction') route.post('product-categories', 'CategoryStoreOrmAction') diff --git a/storage/framework/orm/src/index.ts b/storage/framework/orm/src/index.ts index 96d9758a3d..3a0ec89911 100644 --- a/storage/framework/orm/src/index.ts +++ b/storage/framework/orm/src/index.ts @@ -44,6 +44,8 @@ export { type NewPaymentTransaction, default as PaymentTransaction, type Payment export { type NewPost, default as Post, type PostJsonResponse, type PostUpdate } from './models/Post' +export { type NewPrintDevice, default as PrintDevice, type PrintDeviceJsonResponse, type PrintDeviceUpdate } from './models/PrintDevice' + export { type NewProduct, default as Product, type ProductJsonResponse, type ProductUpdate } from './models/Product' export { type NewProductItem, default as ProductItem, type ProductItemJsonResponse, type ProductItemUpdate } from './models/ProductItem' diff --git a/storage/framework/orm/src/models/PrintDevice.ts b/storage/framework/orm/src/models/PrintDevice.ts new file mode 100644 index 0000000000..343e80cb46 --- /dev/null +++ b/storage/framework/orm/src/models/PrintDevice.ts @@ -0,0 +1,1032 @@ +import type { Generated, Insertable, RawBuilder, Selectable, Updateable } from '@stacksjs/database' +import type { Operator } from '@stacksjs/orm' +import { randomUUIDv7 } from 'bun' +import { sql } from '@stacksjs/database' +import { HttpError } from '@stacksjs/error-handling' +import { dispatch } from '@stacksjs/events' +import { DB } from '@stacksjs/orm' +import { BaseOrm } from '../utils/base' + +export interface PrintDevicesTable { + id: Generated + name: string + mac_address: string + location: string + terminal: string + status: string | string[] + last_ping: number + print_count: number + uuid?: string + + created_at?: string + + updated_at?: string + +} + +export interface PrintDeviceResponse { + data: PrintDeviceJsonResponse[] + paging: { + total_records: number + page: number + total_pages: number + } + next_cursor: number | null +} + +export interface PrintDeviceJsonResponse extends Omit, 'password'> { + [key: string]: any +} + +export type NewPrintDevice = Insertable +export type PrintDeviceUpdate = Updateable + +export class PrintDeviceModel extends BaseOrm { + private readonly hidden: Array = [] + private readonly fillable: Array = ['name', 'mac_address', 'location', 'terminal', 'status', 'last_ping', 'print_count', 'uuid'] + private readonly guarded: Array = [] + protected attributes = {} as PrintDeviceJsonResponse + protected originalAttributes = {} as PrintDeviceJsonResponse + + protected selectFromQuery: any + protected updateFromQuery: any + protected deleteFromQuery: any + protected hasSelect: boolean + private customColumns: Record = {} + + /** + * This model inherits many query methods from BaseOrm: + * - pluck, chunk, whereExists, has, doesntHave, whereHas, whereDoesntHave + * - inRandomOrder, max, min, avg, paginate, get, and more + * + * See BaseOrm class for the full list of inherited methods. + */ + + constructor(printDevice: PrintDeviceJsonResponse | undefined) { + super('print_devices') + if (printDevice) { + this.attributes = { ...printDevice } + this.originalAttributes = { ...printDevice } + + Object.keys(printDevice).forEach((key) => { + if (!(key in this)) { + this.customColumns[key] = (printDevice as PrintDeviceJsonResponse)[key] + } + }) + } + + this.withRelations = [] + this.selectFromQuery = DB.instance.selectFrom('print_devices') + this.updateFromQuery = DB.instance.updateTable('print_devices') + this.deleteFromQuery = DB.instance.deleteFrom('print_devices') + this.hasSelect = false + this.hasSaved = false + } + + protected async loadRelations(models: PrintDeviceJsonResponse | PrintDeviceJsonResponse[]): Promise { + // Handle both single model and array of models + const modelArray = Array.isArray(models) ? models : [models] + if (!modelArray.length) + return + + const modelIds = modelArray.map(model => model.id) + + for (const relation of this.withRelations) { + const relatedRecords = await DB.instance + .selectFrom(relation) + .where('printDevice_id', 'in', modelIds) + .selectAll() + .execute() + + if (Array.isArray(models)) { + models.map((model: PrintDeviceJsonResponse) => { + const records = relatedRecords.filter((record: { printDevice_id: number }) => { + return record.printDevice_id === model.id + }) + + model[relation] = records.length === 1 ? records[0] : records + return model + }) + } + else { + const records = relatedRecords.filter((record: { printDevice_id: number }) => { + return record.printDevice_id === models.id + }) + + models[relation] = records.length === 1 ? records[0] : records + } + } + } + + static with(relations: string[]): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyWith(relations) + } + + protected mapCustomGetters(models: PrintDeviceJsonResponse | PrintDeviceJsonResponse[]): void { + const data = models + + if (Array.isArray(data)) { + data.map((model: PrintDeviceJsonResponse) => { + const customGetter = { + default: () => { + }, + + } + + for (const [key, fn] of Object.entries(customGetter)) { + (model as any)[key] = fn() + } + + return model + }) + } + else { + const model = data + + const customGetter = { + default: () => { + }, + + } + + for (const [key, fn] of Object.entries(customGetter)) { + (model as any)[key] = fn() + } + } + } + + async mapCustomSetters(model: NewPrintDevice | PrintDeviceUpdate): Promise { + const customSetter = { + default: () => { + }, + + } + + for (const [key, fn] of Object.entries(customSetter)) { + (model as any)[key] = await fn() + } + } + + get id(): number { + return this.attributes.id + } + + get uuid(): string | undefined { + return this.attributes.uuid + } + + get name(): string { + return this.attributes.name + } + + get mac_address(): string { + return this.attributes.mac_address + } + + get location(): string { + return this.attributes.location + } + + get terminal(): string { + return this.attributes.terminal + } + + get status(): string | string[] { + return this.attributes.status + } + + get last_ping(): number { + return this.attributes.last_ping + } + + get print_count(): number { + return this.attributes.print_count + } + + get created_at(): string | undefined { + return this.attributes.created_at + } + + get updated_at(): string | undefined { + return this.attributes.updated_at + } + + set uuid(value: string) { + this.attributes.uuid = value + } + + set name(value: string) { + this.attributes.name = value + } + + set mac_address(value: string) { + this.attributes.mac_address = value + } + + set location(value: string) { + this.attributes.location = value + } + + set terminal(value: string) { + this.attributes.terminal = value + } + + set status(value: string | string[]) { + this.attributes.status = value + } + + set last_ping(value: number) { + this.attributes.last_ping = value + } + + set print_count(value: number) { + this.attributes.print_count = value + } + + set updated_at(value: string) { + this.attributes.updated_at = value + } + + static select(params: (keyof PrintDeviceJsonResponse)[] | RawBuilder | string): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applySelect(params) + } + + // Method to find a PrintDevice by ID + static async find(id: number): Promise { + const query = DB.instance.selectFrom('print_devices').where('id', '=', id).selectAll() + + const model = await query.executeTakeFirst() + + if (!model) + return undefined + + const instance = new PrintDeviceModel(undefined) + return instance.createInstance(model) + } + + static async first(): Promise { + const instance = new PrintDeviceModel(undefined) + + const model = await instance.applyFirst() + + const data = new PrintDeviceModel(model) + + return data + } + + static async last(): Promise { + const instance = new PrintDeviceModel(undefined) + + const model = await instance.applyLast() + + if (!model) + return undefined + + return new PrintDeviceModel(model) + } + + static async firstOrFail(): Promise { + const instance = new PrintDeviceModel(undefined) + + return await instance.applyFirstOrFail() + } + + static async all(): Promise { + const instance = new PrintDeviceModel(undefined) + + const models = await DB.instance.selectFrom('print_devices').selectAll().execute() + + instance.mapCustomGetters(models) + + const data = await Promise.all(models.map(async (model: PrintDeviceJsonResponse) => { + return new PrintDeviceModel(model) + })) + + return data + } + + static async findOrFail(id: number): Promise { + const instance = new PrintDeviceModel(undefined) + + return await instance.applyFindOrFail(id) + } + + static async findMany(ids: number[]): Promise { + const instance = new PrintDeviceModel(undefined) + + const models = await instance.applyFindMany(ids) + + return models.map((modelItem: PrintDeviceJsonResponse) => instance.parseResult(new PrintDeviceModel(modelItem))) + } + + static async latest(column: keyof PrintDevicesTable = 'created_at'): Promise { + const instance = new PrintDeviceModel(undefined) + + const model = await instance.selectFromQuery + .selectAll() + .orderBy(column, 'desc') + .limit(1) + .executeTakeFirst() + + if (!model) + return undefined + + return new PrintDeviceModel(model) + } + + static async oldest(column: keyof PrintDevicesTable = 'created_at'): Promise { + const instance = new PrintDeviceModel(undefined) + + const model = await instance.selectFromQuery + .selectAll() + .orderBy(column, 'asc') + .limit(1) + .executeTakeFirst() + + if (!model) + return undefined + + return new PrintDeviceModel(model) + } + + static skip(count: number): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applySkip(count) + } + + static take(count: number): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyTake(count) + } + + static where(column: keyof PrintDevicesTable, ...args: [V] | [Operator, V]): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyWhere(column, ...args) + } + + static orWhere(...conditions: [string, any][]): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyOrWhere(...conditions) + } + + static whereNotIn(column: keyof PrintDevicesTable, values: V[]): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyWhereNotIn(column, values) + } + + static whereBetween(column: keyof PrintDevicesTable, range: [V, V]): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyWhereBetween(column, range) + } + + static whereRef(column: keyof PrintDevicesTable, ...args: string[]): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyWhereRef(column, ...args) + } + + static when(condition: boolean, callback: (query: PrintDeviceModel) => PrintDeviceModel): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyWhen(condition, callback as any) + } + + static whereNull(column: keyof PrintDevicesTable): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyWhereNull(column) + } + + static whereNotNull(column: keyof PrintDevicesTable): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyWhereNotNull(column) + } + + static whereLike(column: keyof PrintDevicesTable, value: string): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyWhereLike(column, value) + } + + static orderBy(column: keyof PrintDevicesTable, order: 'asc' | 'desc'): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyOrderBy(column, order) + } + + static orderByAsc(column: keyof PrintDevicesTable): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyOrderByAsc(column) + } + + static orderByDesc(column: keyof PrintDevicesTable): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyOrderByDesc(column) + } + + static groupBy(column: keyof PrintDevicesTable): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyGroupBy(column) + } + + static having(column: keyof PrintDevicesTable, operator: Operator, value: V): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyHaving(column, operator, value) + } + + static inRandomOrder(): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyInRandomOrder() + } + + static whereColumn(first: keyof PrintDevicesTable, operator: Operator, second: keyof PrintDevicesTable): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyWhereColumn(first, operator, second) + } + + static async max(field: keyof PrintDevicesTable): Promise { + const instance = new PrintDeviceModel(undefined) + + return await instance.applyMax(field) + } + + static async min(field: keyof PrintDevicesTable): Promise { + const instance = new PrintDeviceModel(undefined) + + return await instance.applyMin(field) + } + + static async avg(field: keyof PrintDevicesTable): Promise { + const instance = new PrintDeviceModel(undefined) + + return await instance.applyAvg(field) + } + + static async sum(field: keyof PrintDevicesTable): Promise { + const instance = new PrintDeviceModel(undefined) + + return await instance.applySum(field) + } + + static async count(): Promise { + const instance = new PrintDeviceModel(undefined) + + return instance.applyCount() + } + + static async get(): Promise { + const instance = new PrintDeviceModel(undefined) + + const results = await instance.applyGet() + + return results.map((item: PrintDeviceJsonResponse) => instance.createInstance(item)) + } + + static async pluck(field: K): Promise { + const instance = new PrintDeviceModel(undefined) + + return await instance.applyPluck(field) + } + + static async chunk(size: number, callback: (models: PrintDeviceModel[]) => Promise): Promise { + const instance = new PrintDeviceModel(undefined) + + await instance.applyChunk(size, async (models) => { + const modelInstances = models.map((item: PrintDeviceJsonResponse) => instance.createInstance(item)) + await callback(modelInstances) + }) + } + + static async paginate(options: { limit?: number, offset?: number, page?: number } = { limit: 10, offset: 0, page: 1 }): Promise<{ + data: PrintDeviceModel[] + paging: { + total_records: number + page: number + total_pages: number + } + next_cursor: number | null + }> { + const instance = new PrintDeviceModel(undefined) + + const result = await instance.applyPaginate(options) + + return { + data: result.data.map((item: PrintDeviceJsonResponse) => instance.createInstance(item)), + paging: result.paging, + next_cursor: result.next_cursor, + } + } + + // Instance method for creating model instances + createInstance(data: PrintDeviceJsonResponse): PrintDeviceModel { + return new PrintDeviceModel(data) + } + + async applyCreate(newPrintDevice: NewPrintDevice): Promise { + const filteredValues = Object.fromEntries( + Object.entries(newPrintDevice).filter(([key]) => + !this.guarded.includes(key) && this.fillable.includes(key), + ), + ) as NewPrintDevice + + await this.mapCustomSetters(filteredValues) + + filteredValues.uuid = randomUUIDv7() + + const result = await DB.instance.insertInto('print_devices') + .values(filteredValues) + .executeTakeFirst() + + const model = await DB.instance.selectFrom('print_devices') + .where('id', '=', Number(result.insertId || result.numInsertedOrUpdatedRows)) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve created PrintDevice') + } + + if (model) + dispatch('printDevice:created', model) + return this.createInstance(model) + } + + async create(newPrintDevice: NewPrintDevice): Promise { + return await this.applyCreate(newPrintDevice) + } + + static async create(newPrintDevice: NewPrintDevice): Promise { + const instance = new PrintDeviceModel(undefined) + return await instance.applyCreate(newPrintDevice) + } + + static async firstOrCreate(search: Partial, values: NewPrintDevice = {} as NewPrintDevice): Promise { + // First try to find a record matching the search criteria + const instance = new PrintDeviceModel(undefined) + + // Apply all search conditions + for (const [key, value] of Object.entries(search)) { + instance.selectFromQuery = instance.selectFromQuery.where(key, '=', value) + } + + // Try to find the record + const existingRecord = await instance.applyFirst() + + if (existingRecord) { + return instance.createInstance(existingRecord) + } + + // If no record exists, create a new one with combined search criteria and values + const createData = { ...search, ...values } as NewPrintDevice + return await PrintDeviceModel.create(createData) + } + + static async updateOrCreate(search: Partial, values: NewPrintDevice = {} as NewPrintDevice): Promise { + // First try to find a record matching the search criteria + const instance = new PrintDeviceModel(undefined) + + // Apply all search conditions + for (const [key, value] of Object.entries(search)) { + instance.selectFromQuery = instance.selectFromQuery.where(key, '=', value) + } + + // Try to find the record + const existingRecord = await instance.applyFirst() + + if (existingRecord) { + // If record exists, update it with the new values + const model = instance.createInstance(existingRecord) + const updatedModel = await model.update(values as PrintDeviceUpdate) + + // Return the updated model instance + if (updatedModel) { + return updatedModel + } + + // If update didn't return a model, fetch it again to ensure we have latest data + const refreshedModel = await instance.applyFirst() + return instance.createInstance(refreshedModel!) + } + + // If no record exists, create a new one with combined search criteria and values + const createData = { ...search, ...values } as NewPrintDevice + return await PrintDeviceModel.create(createData) + } + + async update(newPrintDevice: PrintDeviceUpdate): Promise { + const filteredValues = Object.fromEntries( + Object.entries(newPrintDevice).filter(([key]) => + !this.guarded.includes(key) && this.fillable.includes(key), + ), + ) as PrintDeviceUpdate + + await this.mapCustomSetters(filteredValues) + + filteredValues.updated_at = new Date().toISOString() + + await DB.instance.updateTable('print_devices') + .set(filteredValues) + .where('id', '=', this.id) + .executeTakeFirst() + + if (this.id) { + // Get the updated data + const model = await DB.instance.selectFrom('print_devices') + .where('id', '=', this.id) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve updated PrintDevice') + } + + if (model) + dispatch('printDevice:updated', model) + return this.createInstance(model) + } + + this.hasSaved = true + + return undefined + } + + async forceUpdate(newPrintDevice: PrintDeviceUpdate): Promise { + await DB.instance.updateTable('print_devices') + .set(newPrintDevice) + .where('id', '=', this.id) + .executeTakeFirst() + + if (this.id) { + // Get the updated data + const model = await DB.instance.selectFrom('print_devices') + .where('id', '=', this.id) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve updated PrintDevice') + } + + if (this) + dispatch('printDevice:updated', model) + return this.createInstance(model) + } + + return undefined + } + + async save(): Promise { + // If the model has an ID, update it; otherwise, create a new record + if (this.id) { + // Update existing record + await DB.instance.updateTable('print_devices') + .set(this.attributes as PrintDeviceUpdate) + .where('id', '=', this.id) + .executeTakeFirst() + + // Get the updated data + const model = await DB.instance.selectFrom('print_devices') + .where('id', '=', this.id) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve updated PrintDevice') + } + + if (this) + dispatch('printDevice:updated', model) + return this.createInstance(model) + } + else { + // Create new record + const result = await DB.instance.insertInto('print_devices') + .values(this.attributes as NewPrintDevice) + .executeTakeFirst() + + // Get the created data + const model = await DB.instance.selectFrom('print_devices') + .where('id', '=', Number(result.insertId || result.numInsertedOrUpdatedRows)) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve created PrintDevice') + } + + if (this) + dispatch('printDevice:created', model) + return this.createInstance(model) + } + } + + static async createMany(newPrintDevice: NewPrintDevice[]): Promise { + const instance = new PrintDeviceModel(undefined) + + const valuesFiltered = newPrintDevice.map((newPrintDevice: NewPrintDevice) => { + const filteredValues = Object.fromEntries( + Object.entries(newPrintDevice).filter(([key]) => + !instance.guarded.includes(key) && instance.fillable.includes(key), + ), + ) as NewPrintDevice + + filteredValues.uuid = randomUUIDv7() + + return filteredValues + }) + + await DB.instance.insertInto('print_devices') + .values(valuesFiltered) + .executeTakeFirst() + } + + static async forceCreate(newPrintDevice: NewPrintDevice): Promise { + const result = await DB.instance.insertInto('print_devices') + .values(newPrintDevice) + .executeTakeFirst() + + const instance = new PrintDeviceModel(undefined) + const model = await DB.instance.selectFrom('print_devices') + .where('id', '=', Number(result.insertId || result.numInsertedOrUpdatedRows)) + .selectAll() + .executeTakeFirst() + + if (!model) { + throw new HttpError(500, 'Failed to retrieve created PrintDevice') + } + + if (model) + dispatch('printDevice:created', model) + + return instance.createInstance(model) + } + + // Method to remove a PrintDevice + async delete(): Promise { + if (this.id === undefined) + this.deleteFromQuery.execute() + const model = await this.find(Number(this.id)) + + if (model) + dispatch('printDevice:deleted', model) + + const deleted = await DB.instance.deleteFrom('print_devices') + .where('id', '=', this.id) + .execute() + + return deleted.numDeletedRows + } + + static async remove(id: number): Promise { + const instance = new PrintDeviceModel(undefined) + + const model = await instance.find(Number(id)) + + if (model) + dispatch('printDevice:deleted', model) + + return await DB.instance.deleteFrom('print_devices') + .where('id', '=', id) + .execute() + } + + static whereName(value: string): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('name', '=', value) + + return instance + } + + static whereMacAddress(value: string): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('mac_address', '=', value) + + return instance + } + + static whereLocation(value: string): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('location', '=', value) + + return instance + } + + static whereTerminal(value: string): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('terminal', '=', value) + + return instance + } + + static whereStatus(value: string): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('status', '=', value) + + return instance + } + + static whereLastPing(value: string): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('last_ping', '=', value) + + return instance + } + + static wherePrintCount(value: string): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + instance.selectFromQuery = instance.selectFromQuery.where('print_count', '=', value) + + return instance + } + + static whereIn(column: keyof PrintDevicesTable, values: V[]): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyWhereIn(column, values) + } + + toSearchableObject(): Partial { + return { + id: this.id, + name: this.name, + mac_address: this.mac_address, + location: this.location, + terminal: this.terminal, + status: this.status, + last_ping: this.last_ping, + print_count: this.print_count, + } + } + + static distinct(column: keyof PrintDeviceJsonResponse): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyDistinct(column) + } + + static join(table: string, firstCol: string, secondCol: string): PrintDeviceModel { + const instance = new PrintDeviceModel(undefined) + + return instance.applyJoin(table, firstCol, secondCol) + } + + toJSON(): PrintDeviceJsonResponse { + const output = { + + uuid: this.uuid, + + id: this.id, + name: this.name, + mac_address: this.mac_address, + location: this.location, + terminal: this.terminal, + status: this.status, + last_ping: this.last_ping, + print_count: this.print_count, + + created_at: this.created_at, + + updated_at: this.updated_at, + + ...this.customColumns, + } + + return output + } + + parseResult(model: PrintDeviceModel): PrintDeviceModel { + for (const hiddenAttribute of this.hidden) { + delete model[hiddenAttribute as keyof PrintDeviceModel] + } + + return model + } + + // Add a protected applyFind implementation + protected async applyFind(id: number): Promise { + const model = await DB.instance.selectFrom(this.tableName) + .where('id', '=', id) + .selectAll() + .executeTakeFirst() + + if (!model) + return undefined + + this.mapCustomGetters(model) + + await this.loadRelations(model) + + // Return a proper instance using the factory method + return this.createInstance(model) + } +} + +export async function find(id: number): Promise { + const query = DB.instance.selectFrom('print_devices').where('id', '=', id).selectAll() + + const model = await query.executeTakeFirst() + + if (!model) + return undefined + + const instance = new PrintDeviceModel(undefined) + return instance.createInstance(model) +} + +export async function count(): Promise { + const results = await PrintDeviceModel.count() + + return results +} + +export async function create(newPrintDevice: NewPrintDevice): Promise { + const instance = new PrintDeviceModel(undefined) + return await instance.applyCreate(newPrintDevice) +} + +export async function rawQuery(rawQuery: string): Promise { + return await sql`${rawQuery}`.execute(DB.instance) +} + +export async function remove(id: number): Promise { + await DB.instance.deleteFrom('print_devices') + .where('id', '=', id) + .execute() +} + +export async function whereName(value: string): Promise { + const query = DB.instance.selectFrom('print_devices').where('name', '=', value) + const results: PrintDeviceJsonResponse = await query.execute() + + return results.map((modelItem: PrintDeviceJsonResponse) => new PrintDeviceModel(modelItem)) +} + +export async function whereMacAddress(value: string): Promise { + const query = DB.instance.selectFrom('print_devices').where('mac_address', '=', value) + const results: PrintDeviceJsonResponse = await query.execute() + + return results.map((modelItem: PrintDeviceJsonResponse) => new PrintDeviceModel(modelItem)) +} + +export async function whereLocation(value: string): Promise { + const query = DB.instance.selectFrom('print_devices').where('location', '=', value) + const results: PrintDeviceJsonResponse = await query.execute() + + return results.map((modelItem: PrintDeviceJsonResponse) => new PrintDeviceModel(modelItem)) +} + +export async function whereTerminal(value: string): Promise { + const query = DB.instance.selectFrom('print_devices').where('terminal', '=', value) + const results: PrintDeviceJsonResponse = await query.execute() + + return results.map((modelItem: PrintDeviceJsonResponse) => new PrintDeviceModel(modelItem)) +} + +export async function whereStatus(value: string | string[]): Promise { + const query = DB.instance.selectFrom('print_devices').where('status', '=', value) + const results: PrintDeviceJsonResponse = await query.execute() + + return results.map((modelItem: PrintDeviceJsonResponse) => new PrintDeviceModel(modelItem)) +} + +export async function whereLastPing(value: number): Promise { + const query = DB.instance.selectFrom('print_devices').where('last_ping', '=', value) + const results: PrintDeviceJsonResponse = await query.execute() + + return results.map((modelItem: PrintDeviceJsonResponse) => new PrintDeviceModel(modelItem)) +} + +export async function wherePrintCount(value: number): Promise { + const query = DB.instance.selectFrom('print_devices').where('print_count', '=', value) + const results: PrintDeviceJsonResponse = await query.execute() + + return results.map((modelItem: PrintDeviceJsonResponse) => new PrintDeviceModel(modelItem)) +} + +export const PrintDevice = PrintDeviceModel + +export default PrintDevice diff --git a/storage/framework/orm/src/types.ts b/storage/framework/orm/src/types.ts index eb1078f745..fb1ada67cc 100644 --- a/storage/framework/orm/src/types.ts +++ b/storage/framework/orm/src/types.ts @@ -21,6 +21,7 @@ import type { PaymentMethodsTable } from '../src/models/PaymentMethod' import type { PaymentProductsTable } from '../src/models/PaymentProduct' import type { PaymentTransactionsTable } from '../src/models/PaymentTransaction' import type { PostsTable } from '../src/models/Post' +import type { PrintDevicesTable } from '../src/models/PrintDevice' import type { ProductsTable } from '../src/models/Product' import type { ProductItemsTable } from '../src/models/ProductItem' import type { ProductUnitsTable } from '../src/models/ProductUnit' @@ -85,6 +86,7 @@ export interface Database { releases: ReleasesTable users: UsersTable posts: PostsTable + print_devices: PrintDevicesTable categories: CategoriesTable payments: PaymentsTable drivers: DriversTable diff --git a/storage/framework/requests/PrintDeviceRequest.ts b/storage/framework/requests/PrintDeviceRequest.ts new file mode 100644 index 0000000000..b6404530de --- /dev/null +++ b/storage/framework/requests/PrintDeviceRequest.ts @@ -0,0 +1,48 @@ +import type { schema } from '@stacksjs/validation' +import type { PrintDeviceRequestType } from '../types/requests' +import { Request } from '@stacksjs/router' +import { customValidate, validateField } from '@stacksjs/validation' + +interface ValidationField { + rule: ReturnType + message: Record +} + +interface CustomAttributes { + [key: string]: ValidationField +} +interface RequestDataPrintDevice { + id: number + name: string + mac_address: string + location: string + terminal: string + status: string[] + last_ping: number + print_count: number + created_at?: Date + updated_at?: Date +} +export class PrintDeviceRequest extends Request implements PrintDeviceRequestType { + public id = 1 + public name = '' + public mac_address = '' + public location = '' + public terminal = '' + public status = [] + public last_ping = 0 + public print_count = 0 + public created_at = new Date() + public updated_at = new Date() + public uuid = '' + public async validate(attributes?: CustomAttributes): Promise { + if (attributes === undefined || attributes === null) { + await validateField('PrintDevice', this.all()) + } + else { + await customValidate(attributes, this.all()) + } + } +} + +export const printDeviceRequest = new PrintDeviceRequest() diff --git a/storage/framework/server-auto-imports.json b/storage/framework/server-auto-imports.json index 2271751399..310f37c13d 100644 --- a/storage/framework/server-auto-imports.json +++ b/storage/framework/server-auto-imports.json @@ -134,6 +134,7 @@ "NewPaymentProduct": true, "NewPaymentTransaction": true, "NewPost": true, + "NewPrintDevice": true, "NewProduct": true, "NewProductItem": true, "NewProductUnit": true, @@ -205,6 +206,13 @@ "PostResponse": true, "PostUpdate": true, "PostsTable": true, + "PrintDevice": true, + "PrintDeviceJsonResponse": true, + "PrintDeviceModel": true, + "PrintDeviceRequest": true, + "PrintDeviceResponse": true, + "PrintDeviceUpdate": true, + "PrintDevicesTable": true, "Product": true, "ProductItem": true, "ProductItemJsonResponse": true, @@ -375,6 +383,7 @@ "paymentRequest": true, "paymentTransactionRequest": true, "postRequest": true, + "printDeviceRequest": true, "productItemRequest": true, "productRequest": true, "productUnitRequest": true, diff --git a/storage/framework/types/attributes.ts b/storage/framework/types/attributes.ts index de5d67a7f7..bdda8a69e6 100644 --- a/storage/framework/types/attributes.ts +++ b/storage/framework/types/attributes.ts @@ -29,6 +29,11 @@ export interface Attributes { password: string title: string body: string + mac_address: string + location: string + terminal: string + last_ping: number + print_count: number image_url: string is_active: boolean parent_category_id: string diff --git a/storage/framework/types/events.ts b/storage/framework/types/events.ts index 72e0a104d6..4729aa5537 100644 --- a/storage/framework/types/events.ts +++ b/storage/framework/types/events.ts @@ -11,6 +11,7 @@ import type { LoyaltyRewardModel } from '../orm/src/models/LoyaltyReward' import type { ManufacturerModel } from '../orm/src/models/Manufacturer' import type { OrderModel } from '../orm/src/models/Order' import type { PaymentModel } from '../orm/src/models/Payment' +import type { PrintDeviceModel } from '../orm/src/models/PrintDevice' import type { ProductModel } from '../orm/src/models/Product' import type { ProductItemModel } from '../orm/src/models/ProductItem' import type { ProductUnitModel } from '../orm/src/models/ProductUnit' @@ -31,6 +32,9 @@ export interface ModelEvents { 'user:created': UserModel 'user:updated': UserModel 'user:deleted': UserModel + 'print-device:created': PrintDeviceModel + 'print-device:updated': PrintDeviceModel + 'print-device:deleted': PrintDeviceModel 'category:created': CategoryModel 'category:updated': CategoryModel 'category:deleted': CategoryModel diff --git a/storage/framework/types/requests.d.ts b/storage/framework/types/requests.d.ts index 92939f6319..1678fdbdf0 100644 --- a/storage/framework/types/requests.d.ts +++ b/storage/framework/types/requests.d.ts @@ -228,6 +228,34 @@ export interface PostRequestType extends Request { updated_at?: Date } +interface RequestDataPrintDevice { + id: number + name: string + mac_address: string + location: string + terminal: string + status: string[] + last_ping: number + print_count: number + created_at?: Date + updated_at?: Date +} +export interface PrintDeviceRequestType extends Request { + validate: (attributes?: CustomAttributes) => void + get: (key: string, defaultValue?: T) => T + all: () => RequestDataPrintDevice + id: number + name: string + mac_address: string + location: string + terminal: string + status: string[] + last_ping: number + print_count: number + created_at?: Date + updated_at?: Date +} + interface RequestDataCategory { id: number name: string @@ -1298,4 +1326,4 @@ export interface ErrorRequestType extends Request { updated_at?: Date } -export type ModelRequest = ProjectRequestType | SubscriberEmailRequestType | AccessTokenRequestType | TeamRequestType | SubscriberRequestType | DeploymentRequestType | ReleaseRequestType | UserRequestType | PostRequestType | CategoryRequestType | PaymentRequestType | DriverRequestType | WaitlistProductRequestType | DigitalDeliveryRequestType | ManufacturerRequestType | OrderItemRequestType | ShippingZoneRequestType | CustomerRequestType | ProductRequestType | ReceiptRequestType | ProductVariantRequestType | LicenseKeyRequestType | WaitlistRestaurantRequestType | ReviewRequestType | ProductUnitRequestType | GiftCardRequestType | OrderRequestType | CouponRequestType | TaxRateRequestType | TransactionRequestType | LoyaltyPointRequestType | ProductItemRequestType | LoyaltyRewardRequestType | ShippingMethodRequestType | ShippingRateRequestType | DeliveryRouteRequestType | FailedJobRequestType | PaymentMethodRequestType | PaymentTransactionRequestType | RequestRequestType | JobRequestType | SubscriptionRequestType | PaymentProductRequestType | ErrorRequestType +export type ModelRequest = ProjectRequestType | SubscriberEmailRequestType | AccessTokenRequestType | TeamRequestType | SubscriberRequestType | DeploymentRequestType | ReleaseRequestType | UserRequestType | PostRequestType | PrintDeviceRequestType | CategoryRequestType | PaymentRequestType | DriverRequestType | WaitlistProductRequestType | DigitalDeliveryRequestType | ManufacturerRequestType | OrderItemRequestType | ShippingZoneRequestType | CustomerRequestType | ProductRequestType | ReceiptRequestType | ProductVariantRequestType | LicenseKeyRequestType | WaitlistRestaurantRequestType | ReviewRequestType | ProductUnitRequestType | GiftCardRequestType | OrderRequestType | CouponRequestType | TaxRateRequestType | TransactionRequestType | LoyaltyPointRequestType | ProductItemRequestType | LoyaltyRewardRequestType | ShippingMethodRequestType | ShippingRateRequestType | DeliveryRouteRequestType | FailedJobRequestType | PaymentMethodRequestType | PaymentTransactionRequestType | RequestRequestType | JobRequestType | SubscriptionRequestType | PaymentProductRequestType | ErrorRequestType diff --git a/storage/framework/types/server-auto-imports.d.ts b/storage/framework/types/server-auto-imports.d.ts index 2fd2114cc1..42f7db8af3 100644 --- a/storage/framework/types/server-auto-imports.d.ts +++ b/storage/framework/types/server-auto-imports.d.ts @@ -135,6 +135,7 @@ declare global { const NewPaymentProduct: typeof import('./../orm/src/models')['NewPaymentProduct'] const NewPaymentTransaction: typeof import('./../orm/src/models')['NewPaymentTransaction'] const NewPost: typeof import('./../orm/src/models')['NewPost'] + const NewPrintDevice: typeof import('./../orm/src/models')['NewPrintDevice'] const NewProduct: typeof import('./../orm/src/models')['NewProduct'] const NewProductItem: typeof import('./../orm/src/models')['NewProductItem'] const NewProductUnit: typeof import('./../orm/src/models')['NewProductUnit'] @@ -206,6 +207,13 @@ declare global { const PostResponse: typeof import('./../orm/src/models')['PostResponse'] const PostUpdate: typeof import('./../orm/src/models')['PostUpdate'] const PostsTable: typeof import('./../orm/src/models')['PostsTable'] + const PrintDevice: typeof import('./../orm/src/models')['PrintDevice'] + const PrintDeviceJsonResponse: typeof import('./../orm/src/models')['PrintDeviceJsonResponse'] + const PrintDeviceModel: typeof import('./../orm/src/models')['PrintDeviceModel'] + const PrintDeviceRequest: typeof import('./../requests')['PrintDeviceRequest'] + const PrintDeviceResponse: typeof import('./../orm/src/models')['PrintDeviceResponse'] + const PrintDeviceUpdate: typeof import('./../orm/src/models')['PrintDeviceUpdate'] + const PrintDevicesTable: typeof import('./../orm/src/models')['PrintDevicesTable'] const Product: typeof import('./../orm/src/models')['Product'] const ProductItem: typeof import('./../orm/src/models')['ProductItem'] const ProductItemJsonResponse: typeof import('./../orm/src/models')['ProductItemJsonResponse'] @@ -376,6 +384,7 @@ declare global { const paymentRequest: typeof import('./../requests')['paymentRequest'] const paymentTransactionRequest: typeof import('./../requests')['paymentTransactionRequest'] const postRequest: typeof import('./../requests')['postRequest'] + const printDeviceRequest: typeof import('./../requests')['printDeviceRequest'] const productItemRequest: typeof import('./../requests')['productItemRequest'] const productRequest: typeof import('./../requests')['productRequest'] const productUnitRequest: typeof import('./../requests')['productUnitRequest'] From ab0482bd45baa3bdfd47f918b4668f91ef31f7d0 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Mon, 31 Mar 2025 20:14:57 +0800 Subject: [PATCH 28/78] chore: wip --- ...=> 1743422628652-create-projects-table.ts} | 0 ...2628675-create-subscriber_emails-table.ts} | 0 ...96-create-personal_access_tokens-table.ts} | 0 ... 1743422628699-create-team_users-table.ts} | 0 ...ts => 1743422628717-create-teams-table.ts} | 0 ...1743422628738-create-subscribers-table.ts} | 0 ...1743422628757-create-deployments-table.ts} | 0 ...=> 1743422628777-create-releases-table.ts} | 0 ...=> 1743422628795-create-passkeys-table.ts} | 0 ...ts => 1743422628796-create-users-table.ts} | 0 ...ts => 1743422628815-create-posts-table.ts} | 0 ...743422628837-create-print_devices-table.ts | 19 +++ ... 1743422628856-create-categories-table.ts} | 0 ...=> 1743422628877-create-payments-table.ts} | 0 ... => 1743422628896-create-drivers-table.ts} | 0 ...2628915-create-waitlist_products-table.ts} | 0 ...628934-create-digital_deliveries-table.ts} | 0 ...43422628954-create-manufacturers-table.ts} | 0 ...1743422628972-create-order_items-table.ts} | 0 ...3422628991-create-shipping_zones-table.ts} | 0 ...> 1743422629009-create-customers-table.ts} | 0 ...=> 1743422629029-create-products-table.ts} | 0 ...=> 1743422629050-create-receipts-table.ts} | 0 ...22629069-create-product_variants-table.ts} | 0 ...743422629089-create-license_keys-table.ts} | 0 ...9108-create-waitlist_restaurants-table.ts} | 0 ... => 1743422629126-create-reviews-table.ts} | 0 ...43422629146-create-product_units-table.ts} | 0 ... 1743422629165-create-gift_cards-table.ts} | 0 ...s => 1743422629184-create-orders-table.ts} | 0 ... => 1743422629211-create-coupons-table.ts} | 0 ...> 1743422629231-create-tax_rates-table.ts} | 0 ...743422629251-create-transactions-table.ts} | 0 ...3422629274-create-loyalty_points-table.ts} | 0 ...43422629294-create-product_items-table.ts} | 0 ...422629314-create-loyalty_rewards-table.ts} | 0 ...22629332-create-shipping_methods-table.ts} | 0 ...3422629352-create-shipping_rates-table.ts} | 0 ...422629371-create-delivery_routes-table.ts} | 0 ...1743422629390-create-failed_jobs-table.ts} | 0 ...422629409-create-payment_methods-table.ts} | 0 ...9428-create-payment_transactions-table.ts} | 0 ...=> 1743422629448-create-requests-table.ts} | 0 ....ts => 1743422629467-create-jobs-table.ts} | 0 ...43422629486-create-subscriptions-table.ts} | 0 ...22629504-create-payment_products-table.ts} | 0 ...s => 1743422629523-create-errors-table.ts} | 0 storage/framework/models/PrintDevice.ts | 125 ++++++++++++++++++ 48 files changed, 144 insertions(+) rename database/migrations/{1743419049037-create-projects-table.ts => 1743422628652-create-projects-table.ts} (100%) rename database/migrations/{1743419049064-create-subscriber_emails-table.ts => 1743422628675-create-subscriber_emails-table.ts} (100%) rename database/migrations/{1743419049086-create-personal_access_tokens-table.ts => 1743422628696-create-personal_access_tokens-table.ts} (100%) rename database/migrations/{1743419049090-create-team_users-table.ts => 1743422628699-create-team_users-table.ts} (100%) rename database/migrations/{1743419049109-create-teams-table.ts => 1743422628717-create-teams-table.ts} (100%) rename database/migrations/{1743419049130-create-subscribers-table.ts => 1743422628738-create-subscribers-table.ts} (100%) rename database/migrations/{1743419049150-create-deployments-table.ts => 1743422628757-create-deployments-table.ts} (100%) rename database/migrations/{1743419049172-create-releases-table.ts => 1743422628777-create-releases-table.ts} (100%) rename database/migrations/{1743419049191-create-passkeys-table.ts => 1743422628795-create-passkeys-table.ts} (100%) rename database/migrations/{1743419049191-create-users-table.ts => 1743422628796-create-users-table.ts} (100%) rename database/migrations/{1743419049212-create-posts-table.ts => 1743422628815-create-posts-table.ts} (100%) create mode 100644 database/migrations/1743422628837-create-print_devices-table.ts rename database/migrations/{1743419049234-create-categories-table.ts => 1743422628856-create-categories-table.ts} (100%) rename database/migrations/{1743419049253-create-payments-table.ts => 1743422628877-create-payments-table.ts} (100%) rename database/migrations/{1743419049273-create-drivers-table.ts => 1743422628896-create-drivers-table.ts} (100%) rename database/migrations/{1743419049296-create-waitlist_products-table.ts => 1743422628915-create-waitlist_products-table.ts} (100%) rename database/migrations/{1743419049319-create-digital_deliveries-table.ts => 1743422628934-create-digital_deliveries-table.ts} (100%) rename database/migrations/{1743419049340-create-manufacturers-table.ts => 1743422628954-create-manufacturers-table.ts} (100%) rename database/migrations/{1743419049362-create-order_items-table.ts => 1743422628972-create-order_items-table.ts} (100%) rename database/migrations/{1743419049384-create-shipping_zones-table.ts => 1743422628991-create-shipping_zones-table.ts} (100%) rename database/migrations/{1743419049402-create-customers-table.ts => 1743422629009-create-customers-table.ts} (100%) rename database/migrations/{1743419049497-create-products-table.ts => 1743422629029-create-products-table.ts} (100%) rename database/migrations/{1743419049531-create-receipts-table.ts => 1743422629050-create-receipts-table.ts} (100%) rename database/migrations/{1743419049595-create-product_variants-table.ts => 1743422629069-create-product_variants-table.ts} (100%) rename database/migrations/{1743419049828-create-license_keys-table.ts => 1743422629089-create-license_keys-table.ts} (100%) rename database/migrations/{1743419049897-create-waitlist_restaurants-table.ts => 1743422629108-create-waitlist_restaurants-table.ts} (100%) rename database/migrations/{1743419049954-create-reviews-table.ts => 1743422629126-create-reviews-table.ts} (100%) rename database/migrations/{1743419049975-create-product_units-table.ts => 1743422629146-create-product_units-table.ts} (100%) rename database/migrations/{1743419049995-create-gift_cards-table.ts => 1743422629165-create-gift_cards-table.ts} (100%) rename database/migrations/{1743419050016-create-orders-table.ts => 1743422629184-create-orders-table.ts} (100%) rename database/migrations/{1743419050048-create-coupons-table.ts => 1743422629211-create-coupons-table.ts} (100%) rename database/migrations/{1743419050071-create-tax_rates-table.ts => 1743422629231-create-tax_rates-table.ts} (100%) rename database/migrations/{1743419050100-create-transactions-table.ts => 1743422629251-create-transactions-table.ts} (100%) rename database/migrations/{1743419050127-create-loyalty_points-table.ts => 1743422629274-create-loyalty_points-table.ts} (100%) rename database/migrations/{1743419050150-create-product_items-table.ts => 1743422629294-create-product_items-table.ts} (100%) rename database/migrations/{1743419050180-create-loyalty_rewards-table.ts => 1743422629314-create-loyalty_rewards-table.ts} (100%) rename database/migrations/{1743419050203-create-shipping_methods-table.ts => 1743422629332-create-shipping_methods-table.ts} (100%) rename database/migrations/{1743419050227-create-shipping_rates-table.ts => 1743422629352-create-shipping_rates-table.ts} (100%) rename database/migrations/{1743419050255-create-delivery_routes-table.ts => 1743422629371-create-delivery_routes-table.ts} (100%) rename database/migrations/{1743419050276-create-failed_jobs-table.ts => 1743422629390-create-failed_jobs-table.ts} (100%) rename database/migrations/{1743419050296-create-payment_methods-table.ts => 1743422629409-create-payment_methods-table.ts} (100%) rename database/migrations/{1743419050317-create-payment_transactions-table.ts => 1743422629428-create-payment_transactions-table.ts} (100%) rename database/migrations/{1743419050337-create-requests-table.ts => 1743422629448-create-requests-table.ts} (100%) rename database/migrations/{1743419050357-create-jobs-table.ts => 1743422629467-create-jobs-table.ts} (100%) rename database/migrations/{1743419050379-create-subscriptions-table.ts => 1743422629486-create-subscriptions-table.ts} (100%) rename database/migrations/{1743419050401-create-payment_products-table.ts => 1743422629504-create-payment_products-table.ts} (100%) rename database/migrations/{1743419050421-create-errors-table.ts => 1743422629523-create-errors-table.ts} (100%) create mode 100644 storage/framework/models/PrintDevice.ts diff --git a/database/migrations/1743419049037-create-projects-table.ts b/database/migrations/1743422628652-create-projects-table.ts similarity index 100% rename from database/migrations/1743419049037-create-projects-table.ts rename to database/migrations/1743422628652-create-projects-table.ts diff --git a/database/migrations/1743419049064-create-subscriber_emails-table.ts b/database/migrations/1743422628675-create-subscriber_emails-table.ts similarity index 100% rename from database/migrations/1743419049064-create-subscriber_emails-table.ts rename to database/migrations/1743422628675-create-subscriber_emails-table.ts diff --git a/database/migrations/1743419049086-create-personal_access_tokens-table.ts b/database/migrations/1743422628696-create-personal_access_tokens-table.ts similarity index 100% rename from database/migrations/1743419049086-create-personal_access_tokens-table.ts rename to database/migrations/1743422628696-create-personal_access_tokens-table.ts diff --git a/database/migrations/1743419049090-create-team_users-table.ts b/database/migrations/1743422628699-create-team_users-table.ts similarity index 100% rename from database/migrations/1743419049090-create-team_users-table.ts rename to database/migrations/1743422628699-create-team_users-table.ts diff --git a/database/migrations/1743419049109-create-teams-table.ts b/database/migrations/1743422628717-create-teams-table.ts similarity index 100% rename from database/migrations/1743419049109-create-teams-table.ts rename to database/migrations/1743422628717-create-teams-table.ts diff --git a/database/migrations/1743419049130-create-subscribers-table.ts b/database/migrations/1743422628738-create-subscribers-table.ts similarity index 100% rename from database/migrations/1743419049130-create-subscribers-table.ts rename to database/migrations/1743422628738-create-subscribers-table.ts diff --git a/database/migrations/1743419049150-create-deployments-table.ts b/database/migrations/1743422628757-create-deployments-table.ts similarity index 100% rename from database/migrations/1743419049150-create-deployments-table.ts rename to database/migrations/1743422628757-create-deployments-table.ts diff --git a/database/migrations/1743419049172-create-releases-table.ts b/database/migrations/1743422628777-create-releases-table.ts similarity index 100% rename from database/migrations/1743419049172-create-releases-table.ts rename to database/migrations/1743422628777-create-releases-table.ts diff --git a/database/migrations/1743419049191-create-passkeys-table.ts b/database/migrations/1743422628795-create-passkeys-table.ts similarity index 100% rename from database/migrations/1743419049191-create-passkeys-table.ts rename to database/migrations/1743422628795-create-passkeys-table.ts diff --git a/database/migrations/1743419049191-create-users-table.ts b/database/migrations/1743422628796-create-users-table.ts similarity index 100% rename from database/migrations/1743419049191-create-users-table.ts rename to database/migrations/1743422628796-create-users-table.ts diff --git a/database/migrations/1743419049212-create-posts-table.ts b/database/migrations/1743422628815-create-posts-table.ts similarity index 100% rename from database/migrations/1743419049212-create-posts-table.ts rename to database/migrations/1743422628815-create-posts-table.ts diff --git a/database/migrations/1743422628837-create-print_devices-table.ts b/database/migrations/1743422628837-create-print_devices-table.ts new file mode 100644 index 0000000000..948a1c273c --- /dev/null +++ b/database/migrations/1743422628837-create-print_devices-table.ts @@ -0,0 +1,19 @@ +import type { Database } from '@stacksjs/database' +import { sql } from '@stacksjs/database' + +export async function up(db: Database) { + await db.schema + .createTable('print_devices') + .addColumn('id', 'integer', col => col.primaryKey().autoIncrement()) + .addColumn('uuid', 'text') + .addColumn('name', 'text', col => col.notNull()) + .addColumn('mac_address', 'text', col => col.notNull()) + .addColumn('location', 'text', col => col.notNull()) + .addColumn('terminal', 'text', col => col.notNull()) + .addColumn('status', 'text', col => col.notNull()) + .addColumn('last_ping', 'numeric', col => col.notNull()) + .addColumn('print_count', 'numeric', col => col.notNull()) + .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) + .addColumn('updated_at', 'timestamp') + .execute() +} diff --git a/database/migrations/1743419049234-create-categories-table.ts b/database/migrations/1743422628856-create-categories-table.ts similarity index 100% rename from database/migrations/1743419049234-create-categories-table.ts rename to database/migrations/1743422628856-create-categories-table.ts diff --git a/database/migrations/1743419049253-create-payments-table.ts b/database/migrations/1743422628877-create-payments-table.ts similarity index 100% rename from database/migrations/1743419049253-create-payments-table.ts rename to database/migrations/1743422628877-create-payments-table.ts diff --git a/database/migrations/1743419049273-create-drivers-table.ts b/database/migrations/1743422628896-create-drivers-table.ts similarity index 100% rename from database/migrations/1743419049273-create-drivers-table.ts rename to database/migrations/1743422628896-create-drivers-table.ts diff --git a/database/migrations/1743419049296-create-waitlist_products-table.ts b/database/migrations/1743422628915-create-waitlist_products-table.ts similarity index 100% rename from database/migrations/1743419049296-create-waitlist_products-table.ts rename to database/migrations/1743422628915-create-waitlist_products-table.ts diff --git a/database/migrations/1743419049319-create-digital_deliveries-table.ts b/database/migrations/1743422628934-create-digital_deliveries-table.ts similarity index 100% rename from database/migrations/1743419049319-create-digital_deliveries-table.ts rename to database/migrations/1743422628934-create-digital_deliveries-table.ts diff --git a/database/migrations/1743419049340-create-manufacturers-table.ts b/database/migrations/1743422628954-create-manufacturers-table.ts similarity index 100% rename from database/migrations/1743419049340-create-manufacturers-table.ts rename to database/migrations/1743422628954-create-manufacturers-table.ts diff --git a/database/migrations/1743419049362-create-order_items-table.ts b/database/migrations/1743422628972-create-order_items-table.ts similarity index 100% rename from database/migrations/1743419049362-create-order_items-table.ts rename to database/migrations/1743422628972-create-order_items-table.ts diff --git a/database/migrations/1743419049384-create-shipping_zones-table.ts b/database/migrations/1743422628991-create-shipping_zones-table.ts similarity index 100% rename from database/migrations/1743419049384-create-shipping_zones-table.ts rename to database/migrations/1743422628991-create-shipping_zones-table.ts diff --git a/database/migrations/1743419049402-create-customers-table.ts b/database/migrations/1743422629009-create-customers-table.ts similarity index 100% rename from database/migrations/1743419049402-create-customers-table.ts rename to database/migrations/1743422629009-create-customers-table.ts diff --git a/database/migrations/1743419049497-create-products-table.ts b/database/migrations/1743422629029-create-products-table.ts similarity index 100% rename from database/migrations/1743419049497-create-products-table.ts rename to database/migrations/1743422629029-create-products-table.ts diff --git a/database/migrations/1743419049531-create-receipts-table.ts b/database/migrations/1743422629050-create-receipts-table.ts similarity index 100% rename from database/migrations/1743419049531-create-receipts-table.ts rename to database/migrations/1743422629050-create-receipts-table.ts diff --git a/database/migrations/1743419049595-create-product_variants-table.ts b/database/migrations/1743422629069-create-product_variants-table.ts similarity index 100% rename from database/migrations/1743419049595-create-product_variants-table.ts rename to database/migrations/1743422629069-create-product_variants-table.ts diff --git a/database/migrations/1743419049828-create-license_keys-table.ts b/database/migrations/1743422629089-create-license_keys-table.ts similarity index 100% rename from database/migrations/1743419049828-create-license_keys-table.ts rename to database/migrations/1743422629089-create-license_keys-table.ts diff --git a/database/migrations/1743419049897-create-waitlist_restaurants-table.ts b/database/migrations/1743422629108-create-waitlist_restaurants-table.ts similarity index 100% rename from database/migrations/1743419049897-create-waitlist_restaurants-table.ts rename to database/migrations/1743422629108-create-waitlist_restaurants-table.ts diff --git a/database/migrations/1743419049954-create-reviews-table.ts b/database/migrations/1743422629126-create-reviews-table.ts similarity index 100% rename from database/migrations/1743419049954-create-reviews-table.ts rename to database/migrations/1743422629126-create-reviews-table.ts diff --git a/database/migrations/1743419049975-create-product_units-table.ts b/database/migrations/1743422629146-create-product_units-table.ts similarity index 100% rename from database/migrations/1743419049975-create-product_units-table.ts rename to database/migrations/1743422629146-create-product_units-table.ts diff --git a/database/migrations/1743419049995-create-gift_cards-table.ts b/database/migrations/1743422629165-create-gift_cards-table.ts similarity index 100% rename from database/migrations/1743419049995-create-gift_cards-table.ts rename to database/migrations/1743422629165-create-gift_cards-table.ts diff --git a/database/migrations/1743419050016-create-orders-table.ts b/database/migrations/1743422629184-create-orders-table.ts similarity index 100% rename from database/migrations/1743419050016-create-orders-table.ts rename to database/migrations/1743422629184-create-orders-table.ts diff --git a/database/migrations/1743419050048-create-coupons-table.ts b/database/migrations/1743422629211-create-coupons-table.ts similarity index 100% rename from database/migrations/1743419050048-create-coupons-table.ts rename to database/migrations/1743422629211-create-coupons-table.ts diff --git a/database/migrations/1743419050071-create-tax_rates-table.ts b/database/migrations/1743422629231-create-tax_rates-table.ts similarity index 100% rename from database/migrations/1743419050071-create-tax_rates-table.ts rename to database/migrations/1743422629231-create-tax_rates-table.ts diff --git a/database/migrations/1743419050100-create-transactions-table.ts b/database/migrations/1743422629251-create-transactions-table.ts similarity index 100% rename from database/migrations/1743419050100-create-transactions-table.ts rename to database/migrations/1743422629251-create-transactions-table.ts diff --git a/database/migrations/1743419050127-create-loyalty_points-table.ts b/database/migrations/1743422629274-create-loyalty_points-table.ts similarity index 100% rename from database/migrations/1743419050127-create-loyalty_points-table.ts rename to database/migrations/1743422629274-create-loyalty_points-table.ts diff --git a/database/migrations/1743419050150-create-product_items-table.ts b/database/migrations/1743422629294-create-product_items-table.ts similarity index 100% rename from database/migrations/1743419050150-create-product_items-table.ts rename to database/migrations/1743422629294-create-product_items-table.ts diff --git a/database/migrations/1743419050180-create-loyalty_rewards-table.ts b/database/migrations/1743422629314-create-loyalty_rewards-table.ts similarity index 100% rename from database/migrations/1743419050180-create-loyalty_rewards-table.ts rename to database/migrations/1743422629314-create-loyalty_rewards-table.ts diff --git a/database/migrations/1743419050203-create-shipping_methods-table.ts b/database/migrations/1743422629332-create-shipping_methods-table.ts similarity index 100% rename from database/migrations/1743419050203-create-shipping_methods-table.ts rename to database/migrations/1743422629332-create-shipping_methods-table.ts diff --git a/database/migrations/1743419050227-create-shipping_rates-table.ts b/database/migrations/1743422629352-create-shipping_rates-table.ts similarity index 100% rename from database/migrations/1743419050227-create-shipping_rates-table.ts rename to database/migrations/1743422629352-create-shipping_rates-table.ts diff --git a/database/migrations/1743419050255-create-delivery_routes-table.ts b/database/migrations/1743422629371-create-delivery_routes-table.ts similarity index 100% rename from database/migrations/1743419050255-create-delivery_routes-table.ts rename to database/migrations/1743422629371-create-delivery_routes-table.ts diff --git a/database/migrations/1743419050276-create-failed_jobs-table.ts b/database/migrations/1743422629390-create-failed_jobs-table.ts similarity index 100% rename from database/migrations/1743419050276-create-failed_jobs-table.ts rename to database/migrations/1743422629390-create-failed_jobs-table.ts diff --git a/database/migrations/1743419050296-create-payment_methods-table.ts b/database/migrations/1743422629409-create-payment_methods-table.ts similarity index 100% rename from database/migrations/1743419050296-create-payment_methods-table.ts rename to database/migrations/1743422629409-create-payment_methods-table.ts diff --git a/database/migrations/1743419050317-create-payment_transactions-table.ts b/database/migrations/1743422629428-create-payment_transactions-table.ts similarity index 100% rename from database/migrations/1743419050317-create-payment_transactions-table.ts rename to database/migrations/1743422629428-create-payment_transactions-table.ts diff --git a/database/migrations/1743419050337-create-requests-table.ts b/database/migrations/1743422629448-create-requests-table.ts similarity index 100% rename from database/migrations/1743419050337-create-requests-table.ts rename to database/migrations/1743422629448-create-requests-table.ts diff --git a/database/migrations/1743419050357-create-jobs-table.ts b/database/migrations/1743422629467-create-jobs-table.ts similarity index 100% rename from database/migrations/1743419050357-create-jobs-table.ts rename to database/migrations/1743422629467-create-jobs-table.ts diff --git a/database/migrations/1743419050379-create-subscriptions-table.ts b/database/migrations/1743422629486-create-subscriptions-table.ts similarity index 100% rename from database/migrations/1743419050379-create-subscriptions-table.ts rename to database/migrations/1743422629486-create-subscriptions-table.ts diff --git a/database/migrations/1743419050401-create-payment_products-table.ts b/database/migrations/1743422629504-create-payment_products-table.ts similarity index 100% rename from database/migrations/1743419050401-create-payment_products-table.ts rename to database/migrations/1743422629504-create-payment_products-table.ts diff --git a/database/migrations/1743419050421-create-errors-table.ts b/database/migrations/1743422629523-create-errors-table.ts similarity index 100% rename from database/migrations/1743419050421-create-errors-table.ts rename to database/migrations/1743422629523-create-errors-table.ts diff --git a/storage/framework/models/PrintDevice.ts b/storage/framework/models/PrintDevice.ts new file mode 100644 index 0000000000..678a55bf3c --- /dev/null +++ b/storage/framework/models/PrintDevice.ts @@ -0,0 +1,125 @@ +import type { Model } from '@stacksjs/types' +import { schema } from '@stacksjs/validation' + +export default { + name: 'PrintDevice', + table: 'print_devices', + primaryKey: 'id', + autoIncrement: true, + + traits: { + useUuid: true, + useTimestamps: true, + useSearch: { + displayable: ['id', 'name', 'mac_address', 'location', 'terminal', 'status', 'last_ping', 'print_count'], + searchable: ['name', 'mac_address', 'location', 'terminal'], + sortable: ['last_ping', 'print_count'], + filterable: ['status'], + }, + + useSeeder: { + count: 5, + }, + + useApi: { + uri: 'print-devices', + routes: ['index', 'store', 'show', 'update', 'destroy'], + }, + + observe: true, + }, + + attributes: { + name: { + required: true, + order: 1, + fillable: true, + validation: { + rule: schema.string().maxLength(100), + message: { + maxLength: 'Device name must have a maximum of 100 characters', + }, + }, + factory: faker => faker.company.name(), + }, + + mac_address: { + required: true, + order: 2, + fillable: true, + validation: { + rule: schema.string().maxLength(50), + message: { + maxLength: 'MAC address must have a maximum of 50 characters', + }, + }, + factory: faker => faker.internet.mac(), + }, + + location: { + required: true, + order: 3, + fillable: true, + validation: { + rule: schema.string().maxLength(100), + message: { + maxLength: 'Location must have a maximum of 100 characters', + }, + }, + factory: faker => faker.location.streetAddress(), + }, + + terminal: { + required: true, + order: 4, + fillable: true, + validation: { + rule: schema.string().maxLength(50), + message: { + maxLength: 'Terminal must have a maximum of 50 characters', + }, + }, + factory: faker => faker.string.alphanumeric(10), + }, + + status: { + required: true, + order: 5, + fillable: true, + validation: { + rule: schema.enum(['online', 'offline', 'warning'] as const), + }, + factory: faker => faker.helpers.arrayElement(['online', 'offline', 'warning']), + }, + + last_ping: { + required: true, + order: 6, + fillable: true, + validation: { + rule: schema.number(), + message: { + invalid: 'Invalid timestamp format', + }, + }, + factory: faker => faker.date.recent(), + }, + + print_count: { + required: true, + order: 7, + fillable: true, + validation: { + rule: schema.number().min(0), + message: { + min: 'Print count cannot be negative', + }, + }, + factory: faker => faker.number.int({ min: 0, max: 1000 }), + }, + }, + + dashboard: { + highlight: true, + }, +} satisfies Model From 177ef3c03526e43fba5c644523e1b6f7753e96ed Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Mon, 31 Mar 2025 20:47:34 +0800 Subject: [PATCH 29/78] chore: wip --- .../core/commerce/src/device/fetch.ts | 20 +++ .../core/commerce/src/device/store.ts | 106 ++++++++++++ .../core/commerce/src/device/update.ts | 152 ++++++++++++++++++ 3 files changed, 278 insertions(+) create mode 100644 storage/framework/core/commerce/src/device/fetch.ts create mode 100644 storage/framework/core/commerce/src/device/store.ts create mode 100644 storage/framework/core/commerce/src/device/update.ts diff --git a/storage/framework/core/commerce/src/device/fetch.ts b/storage/framework/core/commerce/src/device/fetch.ts new file mode 100644 index 0000000000..45e39e1987 --- /dev/null +++ b/storage/framework/core/commerce/src/device/fetch.ts @@ -0,0 +1,20 @@ +import type { PrintDeviceJsonResponse } from '@stacksjs/orm' +import { db } from '@stacksjs/database' + +/** + * Fetch a print device by ID + */ +export async function fetchById(id: number): Promise { + return await db + .selectFrom('print_devices') + .where('id', '=', id) + .selectAll() + .executeTakeFirst() +} + +/** + * Fetch all print devices + */ +export async function fetchAll(): Promise { + return await db.selectFrom('print_devices').selectAll().execute() +} diff --git a/storage/framework/core/commerce/src/device/store.ts b/storage/framework/core/commerce/src/device/store.ts new file mode 100644 index 0000000000..8b03c317f9 --- /dev/null +++ b/storage/framework/core/commerce/src/device/store.ts @@ -0,0 +1,106 @@ +import type { NewPrintDevice, PrintDeviceJsonResponse, PrintDeviceRequestType } from '@stacksjs/orm' +import { randomUUIDv7 } from 'bun' +import { db } from '@stacksjs/database' + +/** + * Create a new print device + * + * @param request Print device data to store + * @returns The newly created print device record + */ +export async function store(request: PrintDeviceRequestType): Promise { + // Validate the request data + await request.validate() + + try { + // Prepare print device data + const deviceData: NewPrintDevice = { + name: request.get('name'), + mac_address: request.get('mac_address'), + location: request.get('location'), + terminal: request.get('terminal'), + status: request.get('status'), + last_ping: request.get('last_ping'), + print_count: request.get('print_count'), + } + + deviceData.uuid = randomUUIDv7() + + // Insert the print device + const result = await db + .insertInto('print_devices') + .values(deviceData) + .executeTakeFirst() + + const deviceId = Number(result.insertId) || Number(result.numInsertedOrUpdatedRows) + + // Retrieve the newly created print device + const printDevice = await db + .selectFrom('print_devices') + .where('id', '=', deviceId) + .selectAll() + .executeTakeFirst() + + return printDevice + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to create print device: ${error.message}`) + } + + throw error + } +} + +/** + * Create multiple print devices at once + * + * @param requests Array of print device data to store + * @returns Number of print devices created + */ +export async function bulkStore(requests: PrintDeviceRequestType[]): Promise { + if (!requests.length) + return 0 + + let createdCount = 0 + + try { + // Process each print device + await db.transaction().execute(async (trx) => { + for (const request of requests) { + // Validate request data + request.validate() + + // Prepare print device data + const deviceData: NewPrintDevice = { + name: request.get('name'), + mac_address: request.get('mac_address'), + location: request.get('location'), + terminal: request.get('terminal'), + status: request.get('status'), + last_ping: request.get('last_ping'), + print_count: request.get('print_count'), + } + + deviceData.uuid = randomUUIDv7() + + // Insert the print device + await trx + .insertInto('print_devices') + .values(deviceData) + .execute() + + createdCount++ + } + }) + + return createdCount + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to create print devices in bulk: ${error.message}`) + } + + throw error + } +} diff --git a/storage/framework/core/commerce/src/device/update.ts b/storage/framework/core/commerce/src/device/update.ts new file mode 100644 index 0000000000..6ed7b76c6b --- /dev/null +++ b/storage/framework/core/commerce/src/device/update.ts @@ -0,0 +1,152 @@ +import type { PrintDeviceJsonResponse, PrintDeviceRequestType } from '@stacksjs/orm' +import { db } from '@stacksjs/database' +import { formatDate } from '@stacksjs/orm' +import { fetchById } from './fetch' + +/** + * Update a print device by ID + * + * @param id The ID of the print device to update + * @param request The updated print device data + * @returns The updated print device record + */ +export async function update(id: number, request: PrintDeviceRequestType): Promise { + // Validate the request data + await request.validate() + + // Check if print device exists + const existingDevice = await fetchById(id) + + if (!existingDevice) { + throw new Error(`Print device with ID ${id} not found`) + } + + // Create update data object using request fields + const updateData = { + name: request.get('name'), + mac_address: request.get('mac_address'), + location: request.get('location'), + terminal: request.get('terminal'), + status: request.get('status'), + last_ping: request.get('last_ping'), + print_count: request.get('print_count'), + updated_at: formatDate(new Date()), + } + + // If no fields to update, just return the existing print device + if (Object.keys(updateData).length === 0) { + return existingDevice + } + + try { + // Update the print device + await db + .updateTable('print_devices') + .set(updateData) + .where('id', '=', id) + .execute() + + // Fetch and return the updated print device + return await fetchById(id) + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to update print device: ${error.message}`) + } + + throw error + } +} + +/** + * Update a print device's status + * + * @param id The ID of the print device + * @param status The new status + * @returns The updated print device with the new status + */ +export async function updateStatus( + id: number, + status: 'online' | 'offline' | 'warning', +): Promise { + // Check if print device exists + const printDevice = await fetchById(id) + + if (!printDevice) { + throw new Error(`Print device with ID ${id} not found`) + } + + try { + // Update the print device status + await db + .updateTable('print_devices') + .set({ + status, + updated_at: formatDate(new Date()), + }) + .where('id', '=', id) + .execute() + + // Fetch the updated print device + return await fetchById(id) + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to update print device status: ${error.message}`) + } + + throw error + } +} + +/** + * Update print count for a print device + * + * @param id The ID of the print device + * @param printCount The updated print count value + * @returns The updated print device + */ +export async function updatePrintCount( + id: number, + printCount?: number, +): Promise { + // Check if print device exists + const printDevice = await fetchById(id) + + if (!printDevice) { + throw new Error(`Print device with ID ${id} not found`) + } + + // Create update data with only provided fields + const updateData: Record = { + updated_at: formatDate(new Date()), + } + + if (printCount !== undefined) { + updateData.print_count = printCount + } + + // If no print count fields to update, just return the existing print device + if (Object.keys(updateData).length === 1) { // Only updated_at was set + return printDevice + } + + try { + // Update the print device + await db + .updateTable('print_devices') + .set(updateData) + .where('id', '=', id) + .execute() + + // Fetch the updated print device + return await fetchById(id) + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to update print count: ${error.message}`) + } + + throw error + } +} From ec0ba7288ea7c3c7b20d54565a9d38f2184fd354 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Mon, 31 Mar 2025 20:54:38 +0800 Subject: [PATCH 30/78] chore: wip --- .../core/commerce/src/device/destroy.ts | 54 ++++++++++ .../core/commerce/src/device/export.ts | 99 +++++++++++++++++++ .../core/commerce/src/device/index.ts | 24 +++++ .../core/commerce/src/receipts/export.ts | 0 4 files changed, 177 insertions(+) create mode 100644 storage/framework/core/commerce/src/device/destroy.ts create mode 100644 storage/framework/core/commerce/src/device/export.ts create mode 100644 storage/framework/core/commerce/src/device/index.ts create mode 100644 storage/framework/core/commerce/src/receipts/export.ts diff --git a/storage/framework/core/commerce/src/device/destroy.ts b/storage/framework/core/commerce/src/device/destroy.ts new file mode 100644 index 0000000000..8684126ecf --- /dev/null +++ b/storage/framework/core/commerce/src/device/destroy.ts @@ -0,0 +1,54 @@ +import { db } from '@stacksjs/database' + +/** + * Delete a print device by ID + * + * @param id The ID of the print device to delete + * @returns True if the print device was deleted, false otherwise + */ +export async function destroy(id: number): Promise { + try { + const result = await db + .deleteFrom('print_devices') + .where('id', '=', id) + .executeTakeFirst() + + return Number(result.numDeletedRows) > 0 + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to delete print device: ${error.message}`) + } + + throw error + } +} + +/** + * Delete multiple print devices by ID + * + * @param ids Array of print device IDs to delete + * @returns Number of print devices deleted + */ +export async function bulkDestroy(ids: number[]): Promise { + if (!ids.length) + return 0 + + try { + // Perform the delete operation + const result = await db + .deleteFrom('print_devices') + .where('id', 'in', ids) + .executeTakeFirst() + + // Return the number of deleted rows + return Number(result.numDeletedRows) + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to delete print devices: ${error.message}`) + } + + throw error + } +} diff --git a/storage/framework/core/commerce/src/device/export.ts b/storage/framework/core/commerce/src/device/export.ts new file mode 100644 index 0000000000..4b3cc4ecde --- /dev/null +++ b/storage/framework/core/commerce/src/device/export.ts @@ -0,0 +1,99 @@ +import type { SpreadsheetWrapper } from 'ts-spreadsheets' +import type { PrintDeviceJsonResponse } from '@stacksjs/orm' +import { db } from '@stacksjs/database' +import { createSpreadsheet } from 'ts-spreadsheets' +import { fetchAll } from './fetch' + +/** + * Represents the structure of an exported print device + */ +export interface ExportedPrintDevice { + 'Device ID': number + 'Name': string + 'MAC Address': string + 'Location': string + 'Terminal': string + 'Status': string + 'Last Ping': string + 'Print Count': number +} + +/** + * Export print devices to a spreadsheet + * @param format The format of the spreadsheet (default is CSV) + * @returns Spreadsheet object ready for download or storage + */ +export async function exportPrintDevices(format: 'csv' | 'excel' = 'csv'): Promise { + // Fetch all print devices + const devices = await fetchAll() + + // Prepare data for spreadsheet + const spreadsheetData = prepareDevicesForExport(devices) + + // Create and return spreadsheet + return createSpreadsheet(spreadsheetData, { type: format }) +} + +/** + * Prepare print devices data for spreadsheet export + * @param devices Array of print device objects + * @returns Spreadsheet data structure + */ +function prepareDevicesForExport(devices: PrintDeviceJsonResponse[]) { + // Define headings + const headings: (keyof ExportedPrintDevice)[] = [ + 'Device ID', + 'Name', + 'MAC Address', + 'Location', + 'Terminal', + 'Status', + 'Last Ping', + 'Print Count', + ] + + // Transform devices into export format + const data = devices.map((device) => { + return [ + device.id, + device.name, + device.mac_address, + device.location, + device.terminal, + device.status, + new Date(device.last_ping).toLocaleString(), + device.print_count, + ] + }) + + return { headings, data } +} + +/** + * Export print devices and automatically download + * @param format The format of the spreadsheet (default is CSV) + * @param filename Optional filename for the download + * @returns Download response + */ +export async function downloadPrintDevices(format: 'csv' | 'excel' = 'csv', filename?: string): Promise { + const spreadsheet = await exportPrintDevices(format) + + // Use default filename if not provided + const defaultFilename = `print_devices_export_${new Date().toISOString().split('T')[0]}.${format}` + return spreadsheet.download(filename || defaultFilename) +} + +/** + * Store print devices export to disk + * @param format The format of the spreadsheet (default is CSV) + * @param path Optional path to store the file + * @returns Path where the file is stored + */ +export async function storePrintDevicesExport(format: 'csv' | 'excel' = 'csv', path?: string): Promise { + const spreadsheet = await exportPrintDevices(format) + + // Use default path and filename if not provided + const defaultPath = `print_devices_export_${new Date().toISOString().split('T')[0]}.${format}` + + spreadsheet.store(path || defaultPath) +} diff --git a/storage/framework/core/commerce/src/device/index.ts b/storage/framework/core/commerce/src/device/index.ts new file mode 100644 index 0000000000..8cffa5df41 --- /dev/null +++ b/storage/framework/core/commerce/src/device/index.ts @@ -0,0 +1,24 @@ +// Functions from destroy.ts +export { + bulkDestroy, + destroy, +} from './destroy' + +// Functions from fetch.ts +export { + fetchAll, + fetchById, +} from './fetch' + +// Functions from store.ts +export { + bulkStore, + store, +} from './store' + +// Functions from update.ts +export { + update, + updatePrintCount, + updateStatus, +} from './update' diff --git a/storage/framework/core/commerce/src/receipts/export.ts b/storage/framework/core/commerce/src/receipts/export.ts new file mode 100644 index 0000000000..e69de29bb2 From 5712397ec2a5e71d16422768bfc5ecfc700a8b94 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Mon, 31 Mar 2025 21:32:22 +0800 Subject: [PATCH 31/78] chore: wip --- .../core/commerce/src/device/index.ts | 7 + .../core/commerce/src/tests/device.test.ts | 372 ++++++ .../src/tests/storage/logs/stacks.log | 1145 ----------------- 3 files changed, 379 insertions(+), 1145 deletions(-) create mode 100644 storage/framework/core/commerce/src/tests/device.test.ts delete mode 100644 storage/framework/core/commerce/src/tests/storage/logs/stacks.log diff --git a/storage/framework/core/commerce/src/device/index.ts b/storage/framework/core/commerce/src/device/index.ts index 8cffa5df41..1445d2222f 100644 --- a/storage/framework/core/commerce/src/device/index.ts +++ b/storage/framework/core/commerce/src/device/index.ts @@ -22,3 +22,10 @@ export { updatePrintCount, updateStatus, } from './update' + +// Functions from export.ts +export { + downloadPrintDevices, + exportPrintDevices, + storePrintDevicesExport, +} from './export' diff --git a/storage/framework/core/commerce/src/tests/device.test.ts b/storage/framework/core/commerce/src/tests/device.test.ts new file mode 100644 index 0000000000..83fa3d8597 --- /dev/null +++ b/storage/framework/core/commerce/src/tests/device.test.ts @@ -0,0 +1,372 @@ +import { beforeEach, describe, expect, it } from 'bun:test' +import { refreshDatabase } from '@stacksjs/testing' +import { bulkDestroy, destroy } from '../device/destroy' +import { fetchAll, fetchById } from '../device/fetch' +import { bulkStore, store } from '../device/store' +import { update, updatePrintCount, updateStatus } from '../device/update' +import { downloadPrintDevices, exportPrintDevices, storePrintDevicesExport } from '../device/export' + +// Create a request-like object for testing +class TestRequest { + private data: Record = {} + + constructor(data: Record) { + this.data = data + } + + validate() { + return Promise.resolve() + } + + get(key: string): T { + return this.data[key] as T + } +} + +beforeEach(async () => { + await refreshDatabase() +}) + +describe('Print Device Module', () => { + describe('store', () => { + it('should create a new print device in the database', async () => { + const requestData = { + name: 'Main Printer', + mac_address: '00:11:22:33:44:55', + location: 'Office 101', + terminal: 'TERM001', + status: 'online', + last_ping: Date.now(), + print_count: 0, + } + + const request = new TestRequest(requestData) + const device = await store(request as any) + + expect(device).toBeDefined() + expect(device?.name).toBe('Main Printer') + expect(device?.mac_address).toBe('00:11:22:33:44:55') + expect(device?.location).toBe('Office 101') + expect(device?.terminal).toBe('TERM001') + expect(device?.status).toBe('online') + expect(device?.print_count).toBe(0) + expect(device?.uuid).toBeDefined() + + // Save the ID for further testing + const deviceId = device?.id !== undefined ? Number(device.id) : undefined + + // Verify we can fetch the device we just created + if (deviceId) { + const fetchedDevice = await fetchById(deviceId) + expect(fetchedDevice).toBeDefined() + expect(fetchedDevice?.id).toBe(deviceId) + } + }) + + it('should create a print device with minimal required fields', async () => { + const minimalRequestData = { + name: 'Backup Printer', + mac_address: 'AA:BB:CC:DD:EE:FF', + location: 'Server Room', + terminal: 'TERM002', + } + + const request = new TestRequest(minimalRequestData) + const device = await store(request as any) + + expect(device).toBeDefined() + expect(device?.name).toBe('Backup Printer') + expect(device?.mac_address).toBe('AA:BB:CC:DD:EE:FF') + expect(device?.location).toBe('Server Room') + expect(device?.terminal).toBe('TERM002') + expect(device?.status).toBe('offline') // Default value + expect(device?.print_count).toBe(0) // Default value + expect(device?.uuid).toBeDefined() + }) + + it('should create multiple print devices with bulk store', async () => { + const requests = [ + new TestRequest({ + name: 'Printer 1', + mac_address: '00:11:22:33:44:55', + location: 'Office 101', + terminal: 'TERM001', + status: 'online', + last_ping: Date.now(), + print_count: 0, + }), + new TestRequest({ + name: 'Printer 2', + mac_address: 'AA:BB:CC:DD:EE:FF', + location: 'Office 102', + terminal: 'TERM002', + status: 'online', + last_ping: Date.now(), + print_count: 0, + }), + new TestRequest({ + name: 'Printer 3', + mac_address: '11:22:33:44:55:66', + location: 'Office 103', + terminal: 'TERM003', + status: 'online', + last_ping: Date.now(), + print_count: 0, + }), + ] + + const count = await bulkStore(requests as any) + expect(count).toBe(3) + + // Verify devices can be fetched + const allDevices = await fetchAll() + expect(allDevices.length).toBeGreaterThanOrEqual(3) + }) + + it('should return 0 when trying to bulk store an empty array', async () => { + const count = await bulkStore([]) + expect(count).toBe(0) + }) + }) + + describe('update', () => { + it('should update an existing print device', async () => { + // First create a device to update + const requestData = { + name: 'Main Printer', + mac_address: '00:11:22:33:44:55', + location: 'Office 101', + terminal: 'TERM001', + status: 'online', + last_ping: Date.now(), + print_count: 0, + } + + // Create the device + const createRequest = new TestRequest(requestData) + const device = await store(createRequest as any) + const deviceId = device?.id !== undefined ? Number(device.id) : undefined + + // Make sure we have a valid device ID before proceeding + expect(deviceId).toBeDefined() + if (!deviceId) { + throw new Error('Failed to create test device') + } + + const updateData = { + name: 'Updated Printer', + mac_address: '00:11:22:33:44:66', + location: 'Office 102', + terminal: 'TERM002', + status: 'online', + last_ping: Date.now(), + print_count: 100, + } + + const updateRequest = new TestRequest(updateData) + const updatedDevice = await update(deviceId, updateRequest as any) + + // Verify the update was successful + expect(updatedDevice).toBeDefined() + expect(updatedDevice?.id).toBe(deviceId) + expect(updatedDevice?.name).toBe('Updated Printer') + expect(updatedDevice?.mac_address).toBe('00:11:22:33:44:66') + expect(updatedDevice?.location).toBe('Office 102') + expect(updatedDevice?.terminal).toBe('TERM002') + expect(updatedDevice?.status).toBe('online') + expect(updatedDevice?.print_count).toBe(100) + }) + + it('should update a device\'s status', async () => { + // Create a device + const requestData = { + name: 'Main Printer', + mac_address: '00:11:22:33:44:55', + location: 'Office 101', + terminal: 'TERM001', + status: 'online', + last_ping: Date.now(), + print_count: 0, + } + + const request = new TestRequest(requestData) + const device = await store(request as any) + const deviceId = device?.id !== undefined ? Number(device.id) : undefined + + // Make sure we have a valid device ID before proceeding + expect(deviceId).toBeDefined() + if (!deviceId) { + throw new Error('Failed to create test device') + } + + // Update status to offline + const updatedDevice = await updateStatus(deviceId, 'offline') + expect(updatedDevice).toBeDefined() + expect(updatedDevice?.status).toBe('offline') + + // Update status to warning + const warningDevice = await updateStatus(deviceId, 'warning') + expect(warningDevice).toBeDefined() + expect(warningDevice?.status).toBe('warning') + }) + + it('should update print count', async () => { + // Create a device + const requestData = { + name: 'Main Printer', + mac_address: '00:11:22:33:44:55', + location: 'Office 101', + terminal: 'TERM001', + status: 'online', + last_ping: Date.now(), + print_count: 0, + } + + const request = new TestRequest(requestData) + const device = await store(request as any) + const deviceId = device?.id !== undefined ? Number(device.id) : undefined + + expect(deviceId).toBeDefined() + if (!deviceId) { + throw new Error('Failed to create test device') + } + + // Update print count + const updatedDevice = await updatePrintCount(deviceId, 100) + expect(updatedDevice).toBeDefined() + expect(updatedDevice?.print_count).toBe(100) + }) + }) + + describe('destroy', () => { + it('should delete a print device from the database', async () => { + // First create a device to delete + const requestData = { + name: 'Main Printer', + mac_address: '00:11:22:33:44:55', + location: 'Office 101', + terminal: 'TERM001', + status: 'online', + last_ping: Date.now(), + print_count: 0, + } + + // Create the device + const request = new TestRequest(requestData) + const device = await store(request as any) + const deviceId = device?.id !== undefined ? Number(device.id) : undefined + + // Make sure we have a valid device ID before proceeding + expect(deviceId).toBeDefined() + if (!deviceId) { + throw new Error('Failed to create test device') + } + + // Verify the device exists + let fetchedDevice = await fetchById(deviceId) + expect(fetchedDevice).toBeDefined() + + // Delete the device + const result = await destroy(deviceId) + expect(result).toBe(true) + + // Verify the device no longer exists + fetchedDevice = await fetchById(deviceId) + expect(fetchedDevice).toBeUndefined() + }) + + it('should delete multiple print devices from the database', async () => { + // Create several devices to delete + const deviceIds = [] + + // Create 3 test devices + for (let i = 0; i < 3; i++) { + const requestData = { + name: `Printer ${i}`, + mac_address: `00:11:22:33:44:${i.toString().padStart(2, '0')}`, + location: `Office ${100 + i}`, + terminal: `TERM${(i + 1).toString().padStart(3, '0')}`, + status: 'online', + last_ping: Date.now(), + print_count: 0, + } + + const request = new TestRequest(requestData) + const device = await store(request as any) + + const deviceId = device?.id !== undefined ? Number(device.id) : undefined + expect(deviceId).toBeDefined() + + if (deviceId) { + deviceIds.push(deviceId) + } + } + + // Ensure we have created the devices + expect(deviceIds.length).toBe(3) + + // Delete the devices + const deletedCount = await bulkDestroy(deviceIds) + expect(deletedCount).toBe(3) + + // Verify the devices no longer exist + for (const id of deviceIds) { + const fetchedDevice = await fetchById(id) + expect(fetchedDevice).toBeUndefined() + } + }) + + it('should return 0 when trying to delete an empty array of devices', async () => { + // Try to delete with an empty array + const deletedCount = await bulkDestroy([]) + expect(deletedCount).toBe(0) + }) + }) + + describe('export', () => { + it('should export print devices to CSV format', async () => { + // Create a test device + const requestData = { + name: 'Main Printer', + mac_address: '00:11:22:33:44:55', + location: 'Office 101', + terminal: 'TERM001', + status: 'online', + last_ping: Date.now(), + print_count: 100, + } + + const request = new TestRequest(requestData) + await store(request as any) + + // Export devices + const spreadsheet = await exportPrintDevices('csv') + expect(spreadsheet).toBeDefined() + }) + + it('should export print devices to Excel format', async () => { + // Create a test device + const requestData = { + name: 'Main Printer', + mac_address: '00:11:22:33:44:55', + location: 'Office 101', + terminal: 'TERM001', + status: 'online', + last_ping: Date.now(), + print_count: 100, + } + + const request = new TestRequest(requestData) + await store(request as any) + + // Export devices + const spreadsheet = await exportPrintDevices('excel') + expect(spreadsheet).toBeDefined() + }) + + it('should handle empty device list during export', async () => { + const spreadsheet = await exportPrintDevices('csv') + expect(spreadsheet).toBeDefined() + }) + }) +}) diff --git a/storage/framework/core/commerce/src/tests/storage/logs/stacks.log b/storage/framework/core/commerce/src/tests/storage/logs/stacks.log deleted file mode 100644 index 4eb993a930..0000000000 --- a/storage/framework/core/commerce/src/tests/storage/logs/stacks.log +++ /dev/null @@ -1,1145 +0,0 @@ -[2025-03-19T09:32:58.337Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:32:58.511Z] INFO: Migrating database... -[2025-03-19T09:32:58.642Z] INFO: Migrating database... -[2025-03-19T09:33:12.401Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:33:12.564Z] INFO: Migrating database... -[2025-03-19T09:33:12.684Z] INFO: Migrating database... -[2025-03-19T09:33:28.454Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:33:28.610Z] INFO: Migrating database... -[2025-03-19T09:33:28.727Z] INFO: Migrating database... -[2025-03-19T09:35:28.169Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:35:28.345Z] INFO: Migrating database... -[2025-03-19T09:35:28.470Z] INFO: Migrating database... -[2025-03-19T09:37:04.800Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:37:04.964Z] INFO: Migrating database... -[2025-03-19T09:37:05.094Z] INFO: Migrating database... -[2025-03-19T09:37:53.623Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:37:53.789Z] INFO: Migrating database... -[2025-03-19T09:37:53.907Z] INFO: Migrating database... -[2025-03-19T09:38:14.518Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:38:14.677Z] INFO: Migrating database... -[2025-03-19T09:38:14.802Z] INFO: Migrating database... -[2025-03-19T09:40:34.304Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:40:34.477Z] INFO: Migrating database... -[2025-03-19T09:40:34.602Z] INFO: Migrating database... -[2025-03-19T09:44:10.207Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:44:10.385Z] INFO: Migrating database... -[2025-03-19T09:44:10.523Z] INFO: Migrating database... -[2025-03-19T09:44:23.822Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:44:24.012Z] INFO: Migrating database... -[2025-03-19T09:44:24.140Z] INFO: Migrating database... -[2025-03-19T09:44:38.574Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:44:38.748Z] INFO: Migrating database... -[2025-03-19T09:45:43.210Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:45:43.391Z] INFO: Migrating database... -[2025-03-19T09:45:56.065Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:45:56.225Z] INFO: Migrating database... -[2025-03-19T09:46:09.378Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:46:09.549Z] INFO: Migrating database... -[2025-03-19T09:46:19.723Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:46:19.887Z] INFO: Migrating database... -[2025-03-19T09:47:01.784Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:47:01.981Z] INFO: Migrating database... -[2025-03-19T09:47:05.285Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:47:05.453Z] INFO: Migrating database... -[2025-03-19T09:47:23.067Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:47:23.226Z] INFO: Migrating database... -[2025-03-19T09:47:39.076Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:47:59.605Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:48:06.005Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:48:11.333Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:49:14.897Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:49:15.089Z] INFO: Migrating database... -[2025-03-19T09:49:24.734Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:49:24.904Z] INFO: Migrating database... -[2025-03-19T09:49:25.030Z] INFO: Migrating database... -[2025-03-19T09:53:34.600Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:53:34.790Z] INFO: Migrating database... -[2025-03-19T09:53:34.922Z] INFO: Migrating database... -[2025-03-19T09:53:35.041Z] INFO: Migrating database... -[2025-03-19T09:53:35.153Z] INFO: Migrating database... -[2025-03-19T09:54:14.104Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:54:14.296Z] INFO: Migrating database... -[2025-03-19T09:54:14.436Z] INFO: Migrating database... -[2025-03-19T09:54:14.550Z] INFO: Migrating database... -[2025-03-19T09:54:14.669Z] INFO: Migrating database... -[2025-03-19T09:55:25.312Z] DEBUG: Using database driver: sqlite -[2025-03-19T09:55:25.490Z] INFO: Migrating database... -[2025-03-19T09:55:25.622Z] INFO: Migrating database... -[2025-03-19T09:55:25.739Z] INFO: Migrating database... -[2025-03-19T09:55:25.844Z] INFO: Migrating database... -[2025-03-20T11:10:07.149Z] DEBUG: Using database driver: sqlite -[2025-03-20T11:10:20.805Z] DEBUG: Using database driver: sqlite -[2025-03-20T11:10:20.988Z] INFO: Migrating database... -[2025-03-20T11:10:21.021Z] ERROR: SQLiteError: table "product_reviews" already exists - at prepare (unknown) - at prepare (bun:sqlite:298:37) - at run (/Users/glennmichaeltorregosa/Documents/Projects/stacks/node_modules/kysely-bun-worker/dist/chunk-HUOEIHRK.mjs:7:19) - at (/Users/glennmichaeltorregosa/Documents/Projects/stacks/node_modules/kysely-bun-worker/dist/chunk-HUOEIHRK.mjs:43:20) -[2025-03-20T11:16:49.295Z] DEBUG: Using database driver: sqlite -[2025-03-20T11:16:49.481Z] INFO: Migrating database... -[2025-03-20T11:16:49.619Z] INFO: Migrating database... -[2025-03-20T11:16:49.728Z] INFO: Migrating database... -[2025-03-20T11:17:20.837Z] DEBUG: Using database driver: sqlite -[2025-03-20T11:17:21.007Z] INFO: Migrating database... -[2025-03-20T11:17:21.120Z] INFO: Migrating database... -[2025-03-20T11:17:21.219Z] INFO: Migrating database... -[2025-03-20T11:17:33.240Z] DEBUG: Using database driver: sqlite -[2025-03-20T11:17:33.409Z] INFO: Migrating database... -[2025-03-20T11:17:33.547Z] INFO: Migrating database... -[2025-03-20T11:17:33.652Z] INFO: Migrating database... -[2025-03-20T11:17:33.753Z] INFO: Migrating database... -[2025-03-20T11:17:33.856Z] INFO: Migrating database... -[2025-03-20T11:17:43.633Z] DEBUG: Using database driver: sqlite -[2025-03-20T11:17:43.818Z] INFO: Migrating database... -[2025-03-20T11:17:43.936Z] INFO: Migrating database... -[2025-03-20T11:17:44.050Z] INFO: Migrating database... -[2025-03-20T11:17:44.156Z] INFO: Migrating database... -[2025-03-20T11:17:44.266Z] INFO: Migrating database... -[2025-03-20T11:17:44.386Z] INFO: Migrating database... -[2025-03-20T11:18:02.152Z] DEBUG: Using database driver: sqlite -[2025-03-20T11:18:02.355Z] INFO: Migrating database... -[2025-03-20T11:18:02.483Z] INFO: Migrating database... -[2025-03-20T11:18:02.593Z] INFO: Migrating database... -[2025-03-20T11:18:02.694Z] INFO: Migrating database... -[2025-03-20T11:18:02.804Z] INFO: Migrating database... -[2025-03-20T11:18:02.908Z] INFO: Migrating database... -[2025-03-20T11:18:10.133Z] DEBUG: Using database driver: sqlite -[2025-03-20T11:18:10.300Z] INFO: Migrating database... -[2025-03-20T11:18:10.420Z] INFO: Migrating database... -[2025-03-20T11:18:10.522Z] INFO: Migrating database... -[2025-03-20T11:18:10.624Z] INFO: Migrating database... -[2025-03-20T11:18:10.719Z] INFO: Migrating database... -[2025-03-20T11:18:10.822Z] INFO: Migrating database... -[2025-03-20T11:18:10.924Z] INFO: Migrating database... -[2025-03-20T11:18:11.021Z] INFO: Migrating database... -[2025-03-20T11:24:44.598Z] DEBUG: Using database driver: sqlite -[2025-03-20T11:24:44.793Z] INFO: Migrating database... -[2025-03-20T11:24:44.930Z] INFO: Migrating database... -[2025-03-20T11:24:45.052Z] INFO: Migrating database... -[2025-03-20T11:24:45.157Z] INFO: Migrating database... -[2025-03-20T11:24:45.291Z] INFO: Migrating database... -[2025-03-20T11:24:45.438Z] INFO: Migrating database... -[2025-03-20T11:24:45.549Z] INFO: Migrating database... -[2025-03-20T11:24:45.668Z] INFO: Migrating database... -[2025-03-20T11:24:45.791Z] INFO: Migrating database... -[2025-03-20T11:24:45.907Z] INFO: Migrating database... -[2025-03-20T11:24:46.036Z] INFO: Migrating database... -[2025-03-20T11:30:58.997Z] DEBUG: Using database driver: sqlite -[2025-03-20T11:30:59.174Z] INFO: Migrating database... -[2025-03-20T11:30:59.318Z] INFO: Migrating database... -[2025-03-20T11:30:59.441Z] INFO: Migrating database... -[2025-03-20T11:30:59.568Z] INFO: Migrating database... -[2025-03-20T11:30:59.680Z] INFO: Migrating database... -[2025-03-20T11:30:59.794Z] INFO: Migrating database... -[2025-03-20T11:30:59.899Z] INFO: Migrating database... -[2025-03-20T11:31:00.003Z] INFO: Migrating database... -[2025-03-20T11:31:00.115Z] INFO: Migrating database... -[2025-03-20T11:31:00.249Z] INFO: Migrating database... -[2025-03-20T11:31:12.309Z] DEBUG: Using database driver: sqlite -[2025-03-20T11:31:12.484Z] INFO: Migrating database... -[2025-03-20T11:31:12.605Z] INFO: Migrating database... -[2025-03-20T11:31:12.723Z] INFO: Migrating database... -[2025-03-20T11:31:12.820Z] INFO: Migrating database... -[2025-03-20T11:31:12.927Z] INFO: Migrating database... -[2025-03-20T11:31:13.023Z] INFO: Migrating database... -[2025-03-20T11:31:13.118Z] INFO: Migrating database... -[2025-03-20T11:31:13.227Z] INFO: Migrating database... -[2025-03-20T11:31:13.336Z] INFO: Migrating database... -[2025-03-20T11:31:13.458Z] INFO: Migrating database... -[2025-03-20T11:31:13.567Z] INFO: Migrating database... -[2025-03-20T11:31:13.676Z] INFO: Migrating database... -[2025-03-20T11:38:17.623Z] DEBUG: Using database driver: sqlite -[2025-03-20T11:38:17.810Z] INFO: Migrating database... -[2025-03-20T11:38:17.942Z] INFO: Migrating database... -[2025-03-20T11:38:18.053Z] INFO: Migrating database... -[2025-03-20T11:38:18.162Z] INFO: Migrating database... -[2025-03-20T11:38:18.285Z] INFO: Migrating database... -[2025-03-20T11:38:18.402Z] INFO: Migrating database... -[2025-03-20T11:38:18.507Z] INFO: Migrating database... -[2025-03-20T11:38:18.610Z] INFO: Migrating database... -[2025-03-20T11:38:18.721Z] INFO: Migrating database... -[2025-03-20T11:38:18.959Z] INFO: Migrating database... -[2025-03-20T11:38:19.117Z] INFO: Migrating database... -[2025-03-20T11:38:19.243Z] INFO: Migrating database... -[2025-03-20T11:38:19.613Z] INFO: Migrating database... -[2025-03-20T11:38:19.742Z] INFO: Migrating database... -[2025-03-20T11:38:19.848Z] INFO: Migrating database... -[2025-03-20T11:38:19.979Z] INFO: Migrating database... -[2025-03-20T11:38:26.122Z] DEBUG: Using database driver: sqlite -[2025-03-20T11:38:26.404Z] INFO: Migrating database... -[2025-03-20T11:38:26.532Z] INFO: Migrating database... -[2025-03-20T11:38:26.660Z] INFO: Migrating database... -[2025-03-20T11:38:26.779Z] INFO: Migrating database... -[2025-03-20T11:38:26.903Z] INFO: Migrating database... -[2025-03-20T11:38:27.002Z] INFO: Migrating database... -[2025-03-20T11:38:27.108Z] INFO: Migrating database... -[2025-03-20T11:38:27.238Z] INFO: Migrating database... -[2025-03-20T11:38:27.357Z] INFO: Migrating database... -[2025-03-20T11:38:27.473Z] INFO: Migrating database... -[2025-03-20T11:38:27.593Z] INFO: Migrating database... -[2025-03-20T11:38:27.708Z] INFO: Migrating database... -[2025-03-20T11:38:27.884Z] INFO: Migrating database... -[2025-03-20T11:38:28.021Z] INFO: Migrating database... -[2025-03-20T11:38:28.154Z] INFO: Migrating database... -[2025-03-20T11:38:28.298Z] INFO: Migrating database... -[2025-03-20T11:38:28.417Z] INFO: Migrating database... -[2025-03-20T11:38:28.522Z] INFO: Migrating database... -[2025-03-20T11:38:28.618Z] INFO: Migrating database... -[2025-03-20T11:38:28.732Z] INFO: Migrating database... -[2025-03-20T12:23:31.933Z] DEBUG: Using database driver: sqlite -[2025-03-20T12:23:32.136Z] INFO: Migrating database... -[2025-03-20T12:23:32.264Z] INFO: Migrating database... -[2025-03-20T12:23:32.373Z] INFO: Migrating database... -[2025-03-20T12:40:22.907Z] DEBUG: Using database driver: sqlite -[2025-03-20T12:40:23.120Z] INFO: Migrating database... -[2025-03-20T12:40:23.285Z] INFO: Migrating database... -[2025-03-20T12:40:23.401Z] INFO: Migrating database... -[2025-03-20T12:40:52.527Z] DEBUG: Using database driver: sqlite -[2025-03-20T12:40:52.740Z] INFO: Migrating database... -[2025-03-20T12:40:52.909Z] INFO: Migrating database... -[2025-03-20T12:40:53.054Z] INFO: Migrating database... -[2025-03-20T12:58:20.628Z] DEBUG: Using database driver: sqlite -[2025-03-20T12:58:20.822Z] INFO: Migrating database... -[2025-03-20T12:58:20.958Z] INFO: Migrating database... -[2025-03-20T12:58:21.067Z] INFO: Migrating database... -[2025-03-20T13:00:02.220Z] DEBUG: Using database driver: sqlite -[2025-03-20T13:00:02.436Z] INFO: Migrating database... -[2025-03-20T13:00:02.618Z] INFO: Migrating database... -[2025-03-20T13:00:02.731Z] INFO: Migrating database... -[2025-03-20T13:00:25.407Z] DEBUG: Using database driver: sqlite -[2025-03-20T13:00:25.588Z] INFO: Migrating database... -[2025-03-20T13:00:25.732Z] INFO: Migrating database... -[2025-03-20T13:00:25.834Z] INFO: Migrating database... -[2025-03-20T13:00:39.586Z] DEBUG: Using database driver: sqlite -[2025-03-20T13:00:39.782Z] INFO: Migrating database... -[2025-03-20T13:00:39.910Z] INFO: Migrating database... -[2025-03-20T13:00:40.025Z] INFO: Migrating database... -[2025-03-20T13:00:48.375Z] DEBUG: Using database driver: sqlite -[2025-03-20T13:00:48.549Z] INFO: Migrating database... -[2025-03-20T13:00:48.677Z] INFO: Migrating database... -[2025-03-20T13:00:48.787Z] INFO: Migrating database... -[2025-03-20T13:00:48.913Z] INFO: Migrating database... -[2025-03-20T13:00:49.021Z] INFO: Migrating database... -[2025-03-20T13:01:09.946Z] DEBUG: Using database driver: sqlite -[2025-03-20T13:01:10.142Z] INFO: Migrating database... -[2025-03-20T13:01:10.279Z] INFO: Migrating database... -[2025-03-20T13:01:10.390Z] INFO: Migrating database... -[2025-03-20T13:01:10.503Z] INFO: Migrating database... -[2025-03-20T13:01:10.642Z] INFO: Migrating database... -[2025-03-20T13:01:10.753Z] INFO: Migrating database... -[2025-03-20T13:01:10.861Z] INFO: Migrating database... -[2025-03-20T13:01:10.971Z] INFO: Migrating database... -[2025-03-20T13:01:11.086Z] INFO: Migrating database... -[2025-03-20T13:01:20.988Z] DEBUG: Using database driver: sqlite -[2025-03-20T13:01:21.161Z] INFO: Migrating database... -[2025-03-20T13:01:21.285Z] INFO: Migrating database... -[2025-03-20T13:01:21.390Z] INFO: Migrating database... -[2025-03-20T13:01:21.496Z] INFO: Migrating database... -[2025-03-20T13:01:21.600Z] INFO: Migrating database... -[2025-03-20T13:01:21.704Z] INFO: Migrating database... -[2025-03-20T13:01:21.806Z] INFO: Migrating database... -[2025-03-20T13:01:21.913Z] INFO: Migrating database... -[2025-03-20T13:01:34.778Z] DEBUG: Using database driver: sqlite -[2025-03-20T13:01:34.967Z] INFO: Migrating database... -[2025-03-20T13:01:35.106Z] INFO: Migrating database... -[2025-03-20T13:01:35.207Z] INFO: Migrating database... -[2025-03-20T13:01:35.319Z] INFO: Migrating database... -[2025-03-20T13:01:35.423Z] INFO: Migrating database... -[2025-03-20T13:01:35.522Z] INFO: Migrating database... -[2025-03-20T13:01:35.622Z] INFO: Migrating database... -[2025-03-20T13:01:35.726Z] INFO: Migrating database... -[2025-03-20T13:01:35.835Z] INFO: Migrating database... -[2025-03-20T13:01:35.990Z] INFO: Migrating database... -[2025-03-20T13:02:06.945Z] DEBUG: Using database driver: sqlite -[2025-03-20T13:02:07.134Z] INFO: Migrating database... -[2025-03-20T13:02:07.261Z] INFO: Migrating database... -[2025-03-20T13:02:07.367Z] INFO: Migrating database... -[2025-03-20T13:02:07.473Z] INFO: Migrating database... -[2025-03-20T13:02:07.588Z] INFO: Migrating database... -[2025-03-20T13:02:07.713Z] INFO: Migrating database... -[2025-03-20T13:02:07.829Z] INFO: Migrating database... -[2025-03-20T13:02:07.932Z] INFO: Migrating database... -[2025-03-20T13:02:08.039Z] INFO: Migrating database... -[2025-03-20T13:02:08.159Z] INFO: Migrating database... -[2025-03-20T13:21:21.629Z] DEBUG: Using database driver: sqlite -[2025-03-20T13:21:21.810Z] INFO: Migrating database... -[2025-03-20T13:21:21.947Z] INFO: Migrating database... -[2025-03-20T13:21:22.058Z] INFO: Migrating database... -[2025-03-20T13:21:22.172Z] INFO: Migrating database... -[2025-03-20T13:21:22.274Z] INFO: Migrating database... -[2025-03-20T13:21:22.402Z] INFO: Migrating database... -[2025-03-20T13:21:22.535Z] INFO: Migrating database... -[2025-03-20T13:21:22.638Z] INFO: Migrating database... -[2025-03-20T13:21:22.740Z] INFO: Migrating database... -[2025-03-20T13:21:22.865Z] INFO: Migrating database... -[2025-03-20T13:23:24.530Z] DEBUG: Using database driver: sqlite -[2025-03-20T13:23:24.721Z] INFO: Migrating database... -[2025-03-20T13:23:24.852Z] INFO: Migrating database... -[2025-03-20T13:23:24.959Z] INFO: Migrating database... -[2025-03-20T13:23:25.073Z] INFO: Migrating database... -[2025-03-20T13:23:25.181Z] INFO: Migrating database... -[2025-03-20T13:23:25.296Z] INFO: Migrating database... -[2025-03-20T13:23:25.408Z] INFO: Migrating database... -[2025-03-20T13:23:25.519Z] INFO: Migrating database... -[2025-03-20T13:23:25.623Z] INFO: Migrating database... -[2025-03-20T13:23:25.782Z] INFO: Migrating database... -[2025-03-20T13:23:26.196Z] INFO: Migrating database... -[2025-03-20T13:26:08.933Z] DEBUG: Using database driver: sqlite -[2025-03-20T13:26:09.124Z] INFO: Migrating database... -[2025-03-20T13:26:09.255Z] INFO: Migrating database... -[2025-03-20T13:26:09.359Z] INFO: Migrating database... -[2025-03-20T13:26:09.476Z] INFO: Migrating database... -[2025-03-20T13:26:09.589Z] INFO: Migrating database... -[2025-03-20T13:26:09.738Z] INFO: Migrating database... -[2025-03-20T13:26:09.853Z] INFO: Migrating database... -[2025-03-20T13:26:09.967Z] INFO: Migrating database... -[2025-03-20T13:26:10.093Z] INFO: Migrating database... -[2025-03-20T13:26:10.209Z] INFO: Migrating database... -[2025-03-20T13:26:10.326Z] INFO: Migrating database... -[2025-03-20T13:29:55.658Z] DEBUG: Using database driver: sqlite -[2025-03-20T13:29:55.864Z] INFO: Migrating database... -[2025-03-20T13:29:55.997Z] INFO: Migrating database... -[2025-03-20T13:29:56.108Z] INFO: Migrating database... -[2025-03-20T13:29:56.222Z] INFO: Migrating database... -[2025-03-20T13:29:56.372Z] INFO: Migrating database... -[2025-03-20T13:29:56.497Z] INFO: Migrating database... -[2025-03-20T13:29:56.666Z] INFO: Migrating database... -[2025-03-20T13:29:56.832Z] INFO: Migrating database... -[2025-03-20T13:29:56.992Z] INFO: Migrating database... -[2025-03-20T13:29:57.159Z] INFO: Migrating database... -[2025-03-20T13:29:57.332Z] INFO: Migrating database... -[2025-03-20T13:35:43.299Z] DEBUG: Using database driver: sqlite -[2025-03-20T13:35:43.486Z] INFO: Migrating database... -[2025-03-20T13:35:43.631Z] INFO: Migrating database... -[2025-03-20T13:35:43.743Z] INFO: Migrating database... -[2025-03-20T13:35:43.850Z] INFO: Migrating database... -[2025-03-20T13:35:43.958Z] INFO: Migrating database... -[2025-03-20T13:35:44.070Z] INFO: Migrating database... -[2025-03-20T13:35:44.190Z] INFO: Migrating database... -[2025-03-20T13:35:44.305Z] INFO: Migrating database... -[2025-03-20T13:35:44.435Z] INFO: Migrating database... -[2025-03-20T13:35:44.556Z] INFO: Migrating database... -[2025-03-20T13:35:44.672Z] INFO: Migrating database... -[2025-03-20T13:45:20.354Z] DEBUG: Using database driver: sqlite -[2025-03-20T13:45:20.540Z] INFO: Migrating database... -[2025-03-20T13:45:20.680Z] INFO: Migrating database... -[2025-03-20T13:45:20.786Z] INFO: Migrating database... -[2025-03-20T13:45:20.893Z] INFO: Migrating database... -[2025-03-20T13:45:21.003Z] INFO: Migrating database... -[2025-03-20T13:45:21.115Z] INFO: Migrating database... -[2025-03-20T13:45:21.218Z] INFO: Migrating database... -[2025-03-20T13:45:21.328Z] INFO: Migrating database... -[2025-03-20T13:45:21.438Z] INFO: Migrating database... -[2025-03-20T13:45:21.585Z] INFO: Migrating database... -[2025-03-20T13:45:21.722Z] INFO: Migrating database... -[2025-03-23T13:35:08.594Z] DEBUG: Using database driver: sqlite -[2025-03-23T13:35:08.775Z] INFO: Migrating database... -[2025-03-23T13:35:08.906Z] INFO: Migrating database... -[2025-03-23T13:35:09.012Z] INFO: Migrating database... -[2025-03-23T13:35:09.132Z] INFO: Migrating database... -[2025-03-23T13:35:09.241Z] INFO: Migrating database... -[2025-03-23T13:35:09.352Z] INFO: Migrating database... -[2025-03-23T13:35:09.456Z] INFO: Migrating database... -[2025-03-23T13:35:09.561Z] INFO: Migrating database... -[2025-03-23T13:35:09.669Z] INFO: Migrating database... -[2025-03-23T13:35:09.803Z] INFO: Migrating database... -[2025-03-23T13:35:09.910Z] INFO: Migrating database... -[2025-03-23T13:35:10.034Z] INFO: Migrating database... -[2025-03-23T13:35:10.145Z] INFO: Migrating database... -[2025-03-23T13:35:24.839Z] DEBUG: Using database driver: sqlite -[2025-03-23T13:35:25.035Z] INFO: Migrating database... -[2025-03-23T13:35:25.159Z] INFO: Migrating database... -[2025-03-23T13:35:25.255Z] INFO: Migrating database... -[2025-03-23T13:35:25.356Z] INFO: Migrating database... -[2025-03-23T13:35:32.433Z] DEBUG: Using database driver: sqlite -[2025-03-23T13:35:32.596Z] INFO: Migrating database... -[2025-03-23T13:35:32.714Z] INFO: Migrating database... -[2025-03-23T13:35:32.812Z] INFO: Migrating database... -[2025-03-23T13:35:32.916Z] INFO: Migrating database... -[2025-03-23T13:36:18.597Z] DEBUG: Using database driver: sqlite -[2025-03-23T13:36:18.774Z] INFO: Migrating database... -[2025-03-23T13:36:18.898Z] INFO: Migrating database... -[2025-03-23T13:36:19.023Z] INFO: Migrating database... -[2025-03-23T13:36:19.130Z] INFO: Migrating database... -[2025-03-23T13:37:18.734Z] DEBUG: Using database driver: sqlite -[2025-03-23T13:37:18.912Z] INFO: Migrating database... -[2025-03-23T13:37:19.037Z] INFO: Migrating database... -[2025-03-23T13:37:19.143Z] INFO: Migrating database... -[2025-03-23T13:37:19.243Z] INFO: Migrating database... -[2025-03-23T13:37:35.181Z] DEBUG: Using database driver: sqlite -[2025-03-23T13:37:35.363Z] INFO: Migrating database... -[2025-03-23T13:37:35.493Z] INFO: Migrating database... -[2025-03-23T13:37:35.594Z] INFO: Migrating database... -[2025-03-23T13:37:35.692Z] INFO: Migrating database... -[2025-03-23T13:37:44.059Z] DEBUG: Using database driver: sqlite -[2025-03-23T13:37:44.218Z] INFO: Migrating database... -[2025-03-23T13:37:44.340Z] INFO: Migrating database... -[2025-03-23T13:37:44.441Z] INFO: Migrating database... -[2025-03-23T13:37:44.547Z] INFO: Migrating database... -[2025-03-23T13:37:53.225Z] DEBUG: Using database driver: sqlite -[2025-03-23T13:37:53.378Z] INFO: Migrating database... -[2025-03-23T13:37:53.500Z] INFO: Migrating database... -[2025-03-23T13:37:53.600Z] INFO: Migrating database... -[2025-03-23T13:37:53.704Z] INFO: Migrating database... -[2025-03-23T13:38:04.265Z] DEBUG: Using database driver: sqlite -[2025-03-23T13:38:04.421Z] INFO: Migrating database... -[2025-03-23T13:38:04.556Z] INFO: Migrating database... -[2025-03-23T13:38:04.664Z] INFO: Migrating database... -[2025-03-23T13:38:04.765Z] INFO: Migrating database... -[2025-03-23T13:39:13.785Z] DEBUG: Using database driver: sqlite -[2025-03-23T13:39:13.957Z] INFO: Migrating database... -[2025-03-23T13:39:14.079Z] INFO: Migrating database... -[2025-03-23T13:39:14.176Z] INFO: Migrating database... -[2025-03-23T13:39:14.280Z] INFO: Migrating database... -[2025-03-23T13:39:46.217Z] DEBUG: Using database driver: sqlite -[2025-03-23T13:39:46.392Z] INFO: Migrating database... -[2025-03-23T13:39:46.520Z] INFO: Migrating database... -[2025-03-23T13:39:46.627Z] INFO: Migrating database... -[2025-03-23T13:39:46.732Z] INFO: Migrating database... -[2025-03-23T13:39:46.838Z] INFO: Migrating database... -[2025-03-23T13:39:46.939Z] INFO: Migrating database... -[2025-03-23T13:39:47.042Z] INFO: Migrating database... -[2025-03-23T13:40:07.394Z] DEBUG: Using database driver: sqlite -[2025-03-23T13:40:07.567Z] INFO: Migrating database... -[2025-03-23T13:40:07.690Z] INFO: Migrating database... -[2025-03-23T13:40:07.792Z] INFO: Migrating database... -[2025-03-23T13:40:07.898Z] INFO: Migrating database... -[2025-03-23T13:40:07.997Z] INFO: Migrating database... -[2025-03-23T13:40:08.110Z] INFO: Migrating database... -[2025-03-23T13:40:08.203Z] INFO: Migrating database... -[2025-03-23T13:40:08.302Z] INFO: Migrating database... -[2025-03-23T13:40:08.412Z] INFO: Migrating database... -[2025-03-23T13:40:08.526Z] INFO: Migrating database... -[2025-03-23T13:40:08.658Z] INFO: Migrating database... -[2025-03-23T13:40:08.787Z] INFO: Migrating database... -[2025-03-23T13:40:16.054Z] DEBUG: Using database driver: sqlite -[2025-03-23T13:40:16.237Z] INFO: Migrating database... -[2025-03-23T13:40:16.415Z] INFO: Migrating database... -[2025-03-23T13:40:16.549Z] INFO: Migrating database... -[2025-03-23T13:40:16.688Z] INFO: Migrating database... -[2025-03-23T13:40:16.820Z] INFO: Migrating database... -[2025-03-23T13:40:16.956Z] INFO: Migrating database... -[2025-03-23T13:40:17.108Z] INFO: Migrating database... -[2025-03-23T13:40:17.235Z] INFO: Migrating database... -[2025-03-23T13:40:17.344Z] INFO: Migrating database... -[2025-03-23T13:40:17.451Z] INFO: Migrating database... -[2025-03-23T13:40:17.544Z] INFO: Migrating database... -[2025-03-23T13:40:17.643Z] INFO: Migrating database... -[2025-03-23T13:40:17.749Z] INFO: Migrating database... -[2025-03-24T15:03:50.544Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:03:50.737Z] INFO: Migrating database... -[2025-03-24T15:03:50.866Z] INFO: Migrating database... -[2025-03-24T15:03:50.980Z] INFO: Migrating database... -[2025-03-24T15:03:51.087Z] INFO: Migrating database... -[2025-03-24T15:03:51.201Z] INFO: Migrating database... -[2025-03-24T15:03:51.318Z] INFO: Migrating database... -[2025-03-24T15:03:51.425Z] INFO: Migrating database... -[2025-03-24T15:03:51.529Z] INFO: Migrating database... -[2025-03-24T15:03:51.636Z] INFO: Migrating database... -[2025-03-24T15:03:51.764Z] INFO: Migrating database... -[2025-03-24T15:03:51.876Z] INFO: Migrating database... -[2025-03-24T15:03:51.988Z] INFO: Migrating database... -[2025-03-24T15:03:52.107Z] INFO: Migrating database... -[2025-03-24T15:04:40.542Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:04:40.728Z] INFO: Migrating database... -[2025-03-24T15:04:40.857Z] INFO: Migrating database... -[2025-03-24T15:04:40.964Z] INFO: Migrating database... -[2025-03-24T15:04:41.078Z] INFO: Migrating database... -[2025-03-24T15:04:41.189Z] INFO: Migrating database... -[2025-03-24T15:04:41.301Z] INFO: Migrating database... -[2025-03-24T15:04:41.412Z] INFO: Migrating database... -[2025-03-24T15:04:41.513Z] INFO: Migrating database... -[2025-03-24T15:04:41.628Z] INFO: Migrating database... -[2025-03-24T15:04:41.747Z] INFO: Migrating database... -[2025-03-24T15:04:41.857Z] INFO: Migrating database... -[2025-03-24T15:04:41.975Z] INFO: Migrating database... -[2025-03-24T15:04:42.088Z] INFO: Migrating database... -[2025-03-24T15:05:15.115Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:05:15.297Z] INFO: Migrating database... -[2025-03-24T15:05:15.435Z] INFO: Migrating database... -[2025-03-24T15:05:15.550Z] INFO: Migrating database... -[2025-03-24T15:05:15.657Z] INFO: Migrating database... -[2025-03-24T15:05:15.770Z] INFO: Migrating database... -[2025-03-24T15:05:15.879Z] INFO: Migrating database... -[2025-03-24T15:05:15.992Z] INFO: Migrating database... -[2025-03-24T15:05:16.100Z] INFO: Migrating database... -[2025-03-24T15:05:16.215Z] INFO: Migrating database... -[2025-03-24T15:05:16.372Z] INFO: Migrating database... -[2025-03-24T15:05:16.490Z] INFO: Migrating database... -[2025-03-24T15:05:16.608Z] INFO: Migrating database... -[2025-03-24T15:05:16.719Z] INFO: Migrating database... -[2025-03-24T15:06:38.645Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:06:38.844Z] INFO: Migrating database... -[2025-03-24T15:06:38.999Z] INFO: Migrating database... -[2025-03-24T15:06:39.116Z] INFO: Migrating database... -[2025-03-24T15:06:39.233Z] INFO: Migrating database... -[2025-03-24T15:06:39.363Z] INFO: Migrating database... -[2025-03-24T15:06:39.482Z] INFO: Migrating database... -[2025-03-24T15:06:39.600Z] INFO: Migrating database... -[2025-03-24T15:06:39.730Z] INFO: Migrating database... -[2025-03-24T15:06:39.864Z] INFO: Migrating database... -[2025-03-24T15:06:40.009Z] INFO: Migrating database... -[2025-03-24T15:06:40.146Z] INFO: Migrating database... -[2025-03-24T15:06:40.266Z] INFO: Migrating database... -[2025-03-24T15:06:40.409Z] INFO: Migrating database... -[2025-03-24T15:07:38.882Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:07:39.065Z] INFO: Migrating database... -[2025-03-24T15:07:39.205Z] INFO: Migrating database... -[2025-03-24T15:07:39.311Z] INFO: Migrating database... -[2025-03-24T15:07:39.422Z] INFO: Migrating database... -[2025-03-24T15:07:39.534Z] INFO: Migrating database... -[2025-03-24T15:07:39.648Z] INFO: Migrating database... -[2025-03-24T15:07:39.756Z] INFO: Migrating database... -[2025-03-24T15:07:39.862Z] INFO: Migrating database... -[2025-03-24T15:07:39.972Z] INFO: Migrating database... -[2025-03-24T15:07:40.108Z] INFO: Migrating database... -[2025-03-24T15:07:40.234Z] INFO: Migrating database... -[2025-03-24T15:07:40.348Z] INFO: Migrating database... -[2025-03-24T15:08:01.675Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:08:01.860Z] INFO: Migrating database... -[2025-03-24T15:08:01.987Z] INFO: Migrating database... -[2025-03-24T15:08:02.093Z] INFO: Migrating database... -[2025-03-24T15:08:02.215Z] INFO: Migrating database... -[2025-03-24T15:08:02.332Z] INFO: Migrating database... -[2025-03-24T15:08:02.438Z] INFO: Migrating database... -[2025-03-24T15:08:02.542Z] INFO: Migrating database... -[2025-03-24T15:08:02.650Z] INFO: Migrating database... -[2025-03-24T15:08:02.765Z] INFO: Migrating database... -[2025-03-24T15:08:02.900Z] INFO: Migrating database... -[2025-03-24T15:08:03.025Z] INFO: Migrating database... -[2025-03-24T15:08:03.135Z] INFO: Migrating database... -[2025-03-24T15:08:34.594Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:08:34.781Z] INFO: Migrating database... -[2025-03-24T15:08:34.922Z] INFO: Migrating database... -[2025-03-24T15:08:35.030Z] INFO: Migrating database... -[2025-03-24T15:08:35.142Z] INFO: Migrating database... -[2025-03-24T15:08:35.252Z] INFO: Migrating database... -[2025-03-24T15:08:35.374Z] INFO: Migrating database... -[2025-03-24T15:08:35.481Z] INFO: Migrating database... -[2025-03-24T15:08:35.595Z] INFO: Migrating database... -[2025-03-24T15:08:35.713Z] INFO: Migrating database... -[2025-03-24T15:08:35.825Z] INFO: Migrating database... -[2025-03-24T15:08:35.942Z] INFO: Migrating database... -[2025-03-24T15:08:36.057Z] INFO: Migrating database... -[2025-03-24T15:09:18.573Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:09:18.754Z] INFO: Migrating database... -[2025-03-24T15:09:18.889Z] INFO: Migrating database... -[2025-03-24T15:09:19.008Z] INFO: Migrating database... -[2025-03-24T15:09:19.113Z] INFO: Migrating database... -[2025-03-24T15:09:19.227Z] INFO: Migrating database... -[2025-03-24T15:09:19.336Z] INFO: Migrating database... -[2025-03-24T15:09:19.445Z] INFO: Migrating database... -[2025-03-24T15:09:19.556Z] INFO: Migrating database... -[2025-03-24T15:09:19.669Z] INFO: Migrating database... -[2025-03-24T15:09:19.795Z] INFO: Migrating database... -[2025-03-24T15:09:20.010Z] INFO: Migrating database... -[2025-03-24T15:09:20.139Z] INFO: Migrating database... -[2025-03-24T15:09:24.685Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:09:24.851Z] INFO: Migrating database... -[2025-03-24T15:09:24.982Z] INFO: Migrating database... -[2025-03-24T15:09:25.093Z] INFO: Migrating database... -[2025-03-24T15:09:25.201Z] INFO: Migrating database... -[2025-03-24T15:09:25.310Z] INFO: Migrating database... -[2025-03-24T15:09:25.418Z] INFO: Migrating database... -[2025-03-24T15:09:25.525Z] INFO: Migrating database... -[2025-03-24T15:09:25.633Z] INFO: Migrating database... -[2025-03-24T15:09:25.748Z] INFO: Migrating database... -[2025-03-24T15:09:25.855Z] INFO: Migrating database... -[2025-03-24T15:09:25.973Z] INFO: Migrating database... -[2025-03-24T15:09:26.083Z] INFO: Migrating database... -[2025-03-24T15:09:26.201Z] INFO: Migrating database... -[2025-03-24T15:09:47.134Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:09:47.338Z] INFO: Migrating database... -[2025-03-24T15:09:47.470Z] INFO: Migrating database... -[2025-03-24T15:09:47.581Z] INFO: Migrating database... -[2025-03-24T15:09:47.685Z] INFO: Migrating database... -[2025-03-24T15:09:47.798Z] INFO: Migrating database... -[2025-03-24T15:09:47.907Z] INFO: Migrating database... -[2025-03-24T15:09:48.016Z] INFO: Migrating database... -[2025-03-24T15:09:48.125Z] INFO: Migrating database... -[2025-03-24T15:09:48.239Z] INFO: Migrating database... -[2025-03-24T15:09:48.349Z] INFO: Migrating database... -[2025-03-24T15:09:48.457Z] INFO: Migrating database... -[2025-03-24T15:09:48.566Z] INFO: Migrating database... -[2025-03-24T15:09:48.679Z] INFO: Migrating database... -[2025-03-24T15:10:06.150Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:10:06.352Z] INFO: Migrating database... -[2025-03-24T15:10:06.492Z] INFO: Migrating database... -[2025-03-24T15:10:06.607Z] INFO: Migrating database... -[2025-03-24T15:10:06.720Z] INFO: Migrating database... -[2025-03-24T15:10:06.847Z] INFO: Migrating database... -[2025-03-24T15:10:06.957Z] INFO: Migrating database... -[2025-03-24T15:10:07.064Z] INFO: Migrating database... -[2025-03-24T15:10:07.177Z] INFO: Migrating database... -[2025-03-24T15:10:07.289Z] INFO: Migrating database... -[2025-03-24T15:10:07.394Z] INFO: Migrating database... -[2025-03-24T15:10:07.510Z] INFO: Migrating database... -[2025-03-24T15:10:07.615Z] INFO: Migrating database... -[2025-03-24T15:10:07.729Z] INFO: Migrating database... -[2025-03-24T15:10:49.710Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:10:49.880Z] INFO: Migrating database... -[2025-03-24T15:11:01.448Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:11:01.623Z] INFO: Migrating database... -[2025-03-24T15:11:16.251Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:11:16.441Z] INFO: Migrating database... -[2025-03-24T15:11:20.851Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:11:21.018Z] INFO: Migrating database... -[2025-03-24T15:11:37.896Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:11:38.128Z] INFO: Migrating database... -[2025-03-24T15:12:11.082Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:12:11.266Z] INFO: Migrating database... -[2025-03-24T15:12:57.056Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:12:57.242Z] INFO: Migrating database... -[2025-03-24T15:12:57.375Z] INFO: Migrating database... -[2025-03-24T15:12:57.494Z] INFO: Migrating database... -[2025-03-24T15:12:57.602Z] INFO: Migrating database... -[2025-03-24T15:12:57.717Z] INFO: Migrating database... -[2025-03-24T15:12:57.836Z] INFO: Migrating database... -[2025-03-24T15:12:57.947Z] INFO: Migrating database... -[2025-03-24T15:12:58.051Z] INFO: Migrating database... -[2025-03-24T15:12:58.227Z] INFO: Migrating database... -[2025-03-24T15:12:58.414Z] INFO: Migrating database... -[2025-03-24T15:12:58.526Z] INFO: Migrating database... -[2025-03-24T15:12:58.648Z] INFO: Migrating database... -[2025-03-24T15:12:58.767Z] INFO: Migrating database... -[2025-03-24T15:13:10.995Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:13:11.173Z] INFO: Migrating database... -[2025-03-24T15:13:11.300Z] INFO: Migrating database... -[2025-03-24T15:13:11.407Z] INFO: Migrating database... -[2025-03-24T15:13:11.529Z] INFO: Migrating database... -[2025-03-24T15:13:11.645Z] INFO: Migrating database... -[2025-03-24T15:13:11.756Z] INFO: Migrating database... -[2025-03-24T15:13:11.861Z] INFO: Migrating database... -[2025-03-24T15:13:11.978Z] INFO: Migrating database... -[2025-03-24T15:13:12.096Z] INFO: Migrating database... -[2025-03-24T15:13:12.210Z] INFO: Migrating database... -[2025-03-24T15:13:12.324Z] INFO: Migrating database... -[2025-03-24T15:13:12.439Z] INFO: Migrating database... -[2025-03-24T15:13:12.548Z] INFO: Migrating database... -[2025-03-24T15:13:38.143Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:13:38.320Z] INFO: Migrating database... -[2025-03-24T15:13:38.459Z] INFO: Migrating database... -[2025-03-24T15:13:38.573Z] INFO: Migrating database... -[2025-03-24T15:13:38.687Z] INFO: Migrating database... -[2025-03-24T15:13:38.792Z] INFO: Migrating database... -[2025-03-24T15:13:38.903Z] INFO: Migrating database... -[2025-03-24T15:13:39.013Z] INFO: Migrating database... -[2025-03-24T15:13:39.131Z] INFO: Migrating database... -[2025-03-24T15:13:39.248Z] INFO: Migrating database... -[2025-03-24T15:13:39.384Z] INFO: Migrating database... -[2025-03-24T15:13:39.500Z] INFO: Migrating database... -[2025-03-24T15:13:39.618Z] INFO: Migrating database... -[2025-03-24T15:13:39.740Z] INFO: Migrating database... -[2025-03-24T15:14:31.884Z] DEBUG: Using database driver: sqlite -[2025-03-24T15:14:32.070Z] INFO: Migrating database... -[2025-03-24T15:14:32.206Z] INFO: Migrating database... -[2025-03-24T15:14:32.324Z] INFO: Migrating database... -[2025-03-24T15:14:32.438Z] INFO: Migrating database... -[2025-03-24T15:14:32.553Z] INFO: Migrating database... -[2025-03-24T15:14:32.663Z] INFO: Migrating database... -[2025-03-24T15:14:32.777Z] INFO: Migrating database... -[2025-03-24T15:14:32.880Z] INFO: Migrating database... -[2025-03-24T15:14:32.996Z] INFO: Migrating database... -[2025-03-24T15:14:33.105Z] INFO: Migrating database... -[2025-03-24T15:14:33.218Z] INFO: Migrating database... -[2025-03-24T15:14:33.326Z] INFO: Migrating database... -[2025-03-24T15:14:33.435Z] INFO: Migrating database... -[2025-03-25T10:14:30.682Z] DEBUG: Using database driver: sqlite -[2025-03-25T10:14:30.887Z] INFO: Migrating database... -[2025-03-25T10:14:31.019Z] INFO: Migrating database... -[2025-03-25T10:14:31.131Z] INFO: Migrating database... -[2025-03-25T10:14:31.251Z] INFO: Migrating database... -[2025-03-25T10:14:31.360Z] INFO: Migrating database... -[2025-03-25T10:14:31.492Z] INFO: Migrating database... -[2025-03-25T10:14:31.604Z] INFO: Migrating database... -[2025-03-25T10:14:31.710Z] INFO: Migrating database... -[2025-03-25T10:14:31.824Z] INFO: Migrating database... -[2025-03-25T10:14:31.938Z] INFO: Migrating database... -[2025-03-25T10:14:32.068Z] INFO: Migrating database... -[2025-03-25T10:14:32.200Z] INFO: Migrating database... -[2025-03-25T10:14:32.316Z] INFO: Migrating database... -[2025-03-25T10:14:32.449Z] INFO: Migrating database... -[2025-03-25T10:14:32.569Z] INFO: Migrating database... -[2025-03-25T10:14:51.592Z] DEBUG: Using database driver: sqlite -[2025-03-25T10:14:51.794Z] INFO: Migrating database... -[2025-03-25T10:14:51.946Z] INFO: Migrating database... -[2025-03-25T10:14:52.088Z] INFO: Migrating database... -[2025-03-25T10:14:52.233Z] INFO: Migrating database... -[2025-03-25T10:14:52.368Z] INFO: Migrating database... -[2025-03-25T10:14:52.495Z] INFO: Migrating database... -[2025-03-25T10:14:52.658Z] INFO: Migrating database... -[2025-03-25T10:14:52.821Z] INFO: Migrating database... -[2025-03-25T10:14:52.958Z] INFO: Migrating database... -[2025-03-25T10:14:53.091Z] INFO: Migrating database... -[2025-03-25T10:14:53.256Z] INFO: Migrating database... -[2025-03-25T10:14:53.416Z] INFO: Migrating database... -[2025-03-25T10:14:53.585Z] INFO: Migrating database... -[2025-03-25T10:14:53.738Z] INFO: Migrating database... -[2025-03-25T10:14:53.885Z] INFO: Migrating database... -[2025-03-25T10:17:04.259Z] DEBUG: Using database driver: sqlite -[2025-03-25T10:17:04.439Z] INFO: Migrating database... -[2025-03-25T10:17:04.566Z] INFO: Migrating database... -[2025-03-25T10:17:04.675Z] INFO: Migrating database... -[2025-03-25T10:17:04.789Z] INFO: Migrating database... -[2025-03-25T10:17:04.900Z] INFO: Migrating database... -[2025-03-25T10:17:05.019Z] INFO: Migrating database... -[2025-03-25T10:17:05.128Z] INFO: Migrating database... -[2025-03-25T10:17:05.232Z] INFO: Migrating database... -[2025-03-25T10:17:05.350Z] INFO: Migrating database... -[2025-03-25T10:17:05.465Z] INFO: Migrating database... -[2025-03-25T10:17:05.585Z] INFO: Migrating database... -[2025-03-25T10:17:05.705Z] INFO: Migrating database... -[2025-03-25T10:17:05.827Z] INFO: Migrating database... -[2025-03-25T10:17:05.972Z] INFO: Migrating database... -[2025-03-25T10:17:06.087Z] INFO: Migrating database... -[2025-03-25T10:17:24.384Z] DEBUG: Using database driver: sqlite -[2025-03-25T10:17:24.574Z] INFO: Migrating database... -[2025-03-25T10:17:24.720Z] INFO: Migrating database... -[2025-03-25T10:17:24.848Z] INFO: Migrating database... -[2025-03-25T10:17:24.957Z] INFO: Migrating database... -[2025-03-25T10:17:25.086Z] INFO: Migrating database... -[2025-03-25T10:17:25.200Z] INFO: Migrating database... -[2025-03-25T10:17:25.310Z] INFO: Migrating database... -[2025-03-25T10:17:25.422Z] INFO: Migrating database... -[2025-03-25T10:17:25.543Z] INFO: Migrating database... -[2025-03-25T10:17:25.648Z] INFO: Migrating database... -[2025-03-25T10:17:25.754Z] INFO: Migrating database... -[2025-03-25T10:17:25.864Z] INFO: Migrating database... -[2025-03-25T10:17:25.976Z] INFO: Migrating database... -[2025-03-25T10:17:26.094Z] INFO: Migrating database... -[2025-03-25T10:17:26.206Z] INFO: Migrating database... -[2025-03-25T10:18:26.048Z] DEBUG: Using database driver: sqlite -[2025-03-25T10:18:26.213Z] INFO: Migrating database... -[2025-03-25T10:18:26.341Z] INFO: Migrating database... -[2025-03-25T10:18:26.451Z] INFO: Migrating database... -[2025-03-25T10:18:26.561Z] INFO: Migrating database... -[2025-03-25T10:18:26.673Z] INFO: Migrating database... -[2025-03-25T10:18:26.780Z] INFO: Migrating database... -[2025-03-25T10:18:26.894Z] INFO: Migrating database... -[2025-03-25T10:18:27.005Z] INFO: Migrating database... -[2025-03-25T10:18:27.123Z] INFO: Migrating database... -[2025-03-25T10:18:27.244Z] INFO: Migrating database... -[2025-03-25T10:18:27.362Z] INFO: Migrating database... -[2025-03-25T10:18:27.481Z] INFO: Migrating database... -[2025-03-25T10:18:27.603Z] INFO: Migrating database... -[2025-03-25T10:18:27.732Z] INFO: Migrating database... -[2025-03-25T10:18:27.846Z] INFO: Migrating database... -[2025-03-25T10:18:52.766Z] DEBUG: Using database driver: sqlite -[2025-03-25T10:18:52.960Z] INFO: Migrating database... -[2025-03-25T10:18:53.103Z] INFO: Migrating database... -[2025-03-25T10:18:53.221Z] INFO: Migrating database... -[2025-03-25T10:18:53.333Z] INFO: Migrating database... -[2025-03-25T10:18:53.486Z] INFO: Migrating database... -[2025-03-25T10:18:53.604Z] INFO: Migrating database... -[2025-03-25T10:18:53.714Z] INFO: Migrating database... -[2025-03-25T10:18:53.852Z] INFO: Migrating database... -[2025-03-25T10:18:53.978Z] INFO: Migrating database... -[2025-03-25T10:18:54.084Z] INFO: Migrating database... -[2025-03-25T10:18:54.194Z] INFO: Migrating database... -[2025-03-25T10:18:54.314Z] INFO: Migrating database... -[2025-03-25T10:18:54.446Z] INFO: Migrating database... -[2025-03-25T10:18:54.571Z] INFO: Migrating database... -[2025-03-25T10:18:54.695Z] INFO: Migrating database... -[2025-03-25T10:19:17.824Z] DEBUG: Using database driver: sqlite -[2025-03-25T10:19:18.008Z] INFO: Migrating database... -[2025-03-25T10:19:18.155Z] INFO: Migrating database... -[2025-03-25T10:19:18.264Z] INFO: Migrating database... -[2025-03-25T10:19:18.374Z] INFO: Migrating database... -[2025-03-25T10:19:18.495Z] INFO: Migrating database... -[2025-03-25T10:19:18.645Z] INFO: Migrating database... -[2025-03-25T10:19:18.760Z] INFO: Migrating database... -[2025-03-25T10:19:18.875Z] INFO: Migrating database... -[2025-03-25T10:19:18.997Z] INFO: Migrating database... -[2025-03-25T10:19:19.118Z] INFO: Migrating database... -[2025-03-25T10:19:19.253Z] INFO: Migrating database... -[2025-03-25T10:19:19.373Z] INFO: Migrating database... -[2025-03-25T10:19:19.483Z] INFO: Migrating database... -[2025-03-25T10:19:19.601Z] INFO: Migrating database... -[2025-03-25T10:19:19.722Z] INFO: Migrating database... -[2025-03-25T10:19:23.413Z] DEBUG: Using database driver: sqlite -[2025-03-25T10:19:23.577Z] INFO: Migrating database... -[2025-03-25T10:19:23.711Z] INFO: Migrating database... -[2025-03-25T10:19:23.827Z] INFO: Migrating database... -[2025-03-25T10:19:23.936Z] INFO: Migrating database... -[2025-03-25T10:19:24.050Z] INFO: Migrating database... -[2025-03-25T10:19:24.167Z] INFO: Migrating database... -[2025-03-25T10:19:24.279Z] INFO: Migrating database... -[2025-03-25T10:19:24.389Z] INFO: Migrating database... -[2025-03-25T10:19:24.500Z] INFO: Migrating database... -[2025-03-25T10:19:24.721Z] INFO: Migrating database... -[2025-03-25T10:19:24.848Z] INFO: Migrating database... -[2025-03-25T10:19:24.969Z] INFO: Migrating database... -[2025-03-25T10:19:25.092Z] INFO: Migrating database... -[2025-03-25T10:19:25.213Z] INFO: Migrating database... -[2025-03-25T10:19:25.325Z] INFO: Migrating database... -[2025-03-25T10:19:48.540Z] DEBUG: Using database driver: sqlite -[2025-03-25T10:19:48.715Z] INFO: Migrating database... -[2025-03-25T10:19:48.851Z] INFO: Migrating database... -[2025-03-25T10:19:48.961Z] INFO: Migrating database... -[2025-03-25T10:19:49.076Z] INFO: Migrating database... -[2025-03-25T10:19:49.198Z] INFO: Migrating database... -[2025-03-25T10:19:49.321Z] INFO: Migrating database... -[2025-03-25T10:19:49.438Z] INFO: Migrating database... -[2025-03-25T10:19:49.548Z] INFO: Migrating database... -[2025-03-25T10:19:49.669Z] INFO: Migrating database... -[2025-03-25T10:19:49.785Z] INFO: Migrating database... -[2025-03-25T10:19:49.903Z] INFO: Migrating database... -[2025-03-25T10:19:50.026Z] INFO: Migrating database... -[2025-03-25T10:19:50.159Z] INFO: Migrating database... -[2025-03-25T10:19:50.392Z] INFO: Migrating database... -[2025-03-25T10:19:50.502Z] INFO: Migrating database... -[2025-03-25T10:21:35.965Z] DEBUG: Using database driver: sqlite -[2025-03-25T10:21:36.166Z] INFO: Migrating database... -[2025-03-25T10:21:36.303Z] INFO: Migrating database... -[2025-03-25T10:21:36.438Z] INFO: Migrating database... -[2025-03-25T10:21:36.551Z] INFO: Migrating database... -[2025-03-25T10:21:36.678Z] INFO: Migrating database... -[2025-03-25T10:21:36.801Z] INFO: Migrating database... -[2025-03-25T10:21:36.913Z] INFO: Migrating database... -[2025-03-25T10:21:37.035Z] INFO: Migrating database... -[2025-03-25T10:21:37.165Z] INFO: Migrating database... -[2025-03-25T10:21:37.293Z] INFO: Migrating database... -[2025-03-25T10:21:37.422Z] INFO: Migrating database... -[2025-03-25T10:21:37.541Z] INFO: Migrating database... -[2025-03-25T10:21:55.833Z] DEBUG: Using database driver: sqlite -[2025-03-25T10:21:56.009Z] INFO: Migrating database... -[2025-03-25T10:21:56.142Z] INFO: Migrating database... -[2025-03-25T10:21:56.253Z] INFO: Migrating database... -[2025-03-25T10:21:56.362Z] INFO: Migrating database... -[2025-03-25T10:21:56.471Z] INFO: Migrating database... -[2025-03-25T10:21:56.585Z] INFO: Migrating database... -[2025-03-25T10:21:56.688Z] INFO: Migrating database... -[2025-03-25T10:21:56.796Z] INFO: Migrating database... -[2025-03-25T10:21:56.918Z] INFO: Migrating database... -[2025-03-25T10:21:57.062Z] INFO: Migrating database... -[2025-03-25T10:21:57.179Z] INFO: Migrating database... -[2025-03-25T10:23:56.492Z] DEBUG: Using database driver: sqlite -[2025-03-25T10:23:56.718Z] INFO: Migrating database... -[2025-03-25T10:23:56.848Z] INFO: Migrating database... -[2025-03-25T10:23:56.973Z] INFO: Migrating database... -[2025-03-25T10:23:57.083Z] INFO: Migrating database... -[2025-03-25T10:23:57.195Z] INFO: Migrating database... -[2025-03-25T10:23:57.304Z] INFO: Migrating database... -[2025-03-25T10:23:57.411Z] INFO: Migrating database... -[2025-03-25T10:23:57.528Z] INFO: Migrating database... -[2025-03-25T10:23:57.665Z] INFO: Migrating database... -[2025-03-25T10:23:57.792Z] INFO: Migrating database... -[2025-03-25T10:23:57.911Z] INFO: Migrating database... -[2025-03-25T10:24:24.349Z] DEBUG: Using database driver: sqlite -[2025-03-25T10:24:24.546Z] INFO: Migrating database... -[2025-03-25T10:24:24.685Z] INFO: Migrating database... -[2025-03-25T10:24:24.795Z] INFO: Migrating database... -[2025-03-25T10:24:24.908Z] INFO: Migrating database... -[2025-03-25T10:24:25.102Z] INFO: Migrating database... -[2025-03-25T10:24:25.231Z] INFO: Migrating database... -[2025-03-25T10:24:25.356Z] INFO: Migrating database... -[2025-03-25T10:24:25.475Z] INFO: Migrating database... -[2025-03-25T10:24:25.615Z] INFO: Migrating database... -[2025-03-25T10:24:25.767Z] INFO: Migrating database... -[2025-03-27T12:26:45.736Z] DEBUG: Using database driver: sqlite -[2025-03-27T12:26:45.955Z] INFO: Migrating database... -[2025-03-27T12:26:46.120Z] INFO: Migrating database... -[2025-03-27T12:26:46.250Z] INFO: Migrating database... -[2025-03-27T12:26:46.382Z] INFO: Migrating database... -[2025-03-27T12:26:46.538Z] INFO: Migrating database... -[2025-03-27T12:26:46.695Z] INFO: Migrating database... -[2025-03-27T12:26:46.828Z] INFO: Migrating database... -[2025-03-27T12:26:46.970Z] INFO: Migrating database... -[2025-03-27T12:26:47.126Z] INFO: Migrating database... -[2025-03-27T12:26:47.272Z] INFO: Migrating database... -[2025-03-27T12:26:47.419Z] INFO: Migrating database... -[2025-03-27T12:26:47.611Z] INFO: Migrating database... -[2025-03-27T12:26:47.755Z] INFO: Migrating database... -[2025-03-27T12:26:47.910Z] INFO: Migrating database... -[2025-03-27T12:26:48.063Z] INFO: Migrating database... -[2025-03-27T12:26:48.204Z] INFO: Migrating database... -[2025-03-31T11:22:08.668Z] DEBUG: Using database driver: sqlite -[2025-03-31T11:22:08.880Z] INFO: Migrating database... -[2025-03-31T11:22:09.076Z] INFO: Migrating database... -[2025-03-31T11:22:09.248Z] INFO: Migrating database... -[2025-03-31T11:22:09.410Z] INFO: Migrating database... -[2025-03-31T11:22:09.567Z] INFO: Migrating database... -[2025-03-31T11:22:09.729Z] INFO: Migrating database... -[2025-03-31T11:22:09.907Z] INFO: Migrating database... -[2025-03-31T11:22:10.074Z] INFO: Migrating database... -[2025-03-31T11:22:10.249Z] INFO: Migrating database... -[2025-03-31T11:22:10.404Z] INFO: Migrating database... -[2025-03-31T11:22:10.560Z] INFO: Migrating database... -[2025-03-31T11:22:10.720Z] INFO: Migrating database... -[2025-03-31T11:22:10.896Z] INFO: Migrating database... -[2025-03-31T11:22:11.055Z] INFO: Migrating database... -[2025-03-31T11:22:11.220Z] INFO: Migrating database... -[2025-03-31T11:22:11.383Z] INFO: Migrating database... -[2025-03-31T11:22:11.552Z] INFO: Migrating database... -[2025-03-31T11:22:11.711Z] INFO: Migrating database... -[2025-03-31T11:22:11.883Z] INFO: Migrating database... -[2025-03-31T11:22:12.047Z] INFO: Migrating database... -[2025-03-31T11:22:12.199Z] INFO: Migrating database... -[2025-03-31T11:22:12.364Z] INFO: Migrating database... -[2025-03-31T11:22:12.526Z] INFO: Migrating database... -[2025-03-31T11:22:12.692Z] INFO: Migrating database... -[2025-03-31T11:22:12.848Z] INFO: Migrating database... -[2025-03-31T11:22:13.007Z] INFO: Migrating database... -[2025-03-31T11:22:13.155Z] INFO: Migrating database... -[2025-03-31T11:22:13.316Z] INFO: Migrating database... -[2025-03-31T11:22:13.472Z] INFO: Migrating database... -[2025-03-31T11:22:13.632Z] INFO: Migrating database... -[2025-03-31T11:23:48.371Z] DEBUG: Using database driver: sqlite -[2025-03-31T11:23:48.566Z] INFO: Migrating database... -[2025-03-31T11:23:48.732Z] INFO: Migrating database... -[2025-03-31T11:23:48.878Z] INFO: Migrating database... -[2025-03-31T11:23:49.030Z] INFO: Migrating database... -[2025-03-31T11:23:49.171Z] INFO: Migrating database... -[2025-03-31T11:23:49.319Z] INFO: Migrating database... -[2025-03-31T11:23:49.466Z] INFO: Migrating database... -[2025-03-31T11:23:49.614Z] INFO: Migrating database... -[2025-03-31T11:23:49.756Z] INFO: Migrating database... -[2025-03-31T11:23:49.907Z] INFO: Migrating database... -[2025-03-31T11:23:50.074Z] INFO: Migrating database... -[2025-03-31T11:23:50.319Z] INFO: Migrating database... -[2025-03-31T11:23:50.469Z] INFO: Migrating database... -[2025-03-31T11:23:50.618Z] INFO: Migrating database... -[2025-03-31T11:23:50.755Z] INFO: Migrating database... -[2025-03-31T11:23:50.905Z] INFO: Migrating database... -[2025-03-31T11:23:51.069Z] INFO: Migrating database... -[2025-03-31T11:23:51.226Z] INFO: Migrating database... -[2025-03-31T11:23:51.377Z] INFO: Migrating database... -[2025-03-31T11:23:51.533Z] INFO: Migrating database... -[2025-03-31T11:23:51.675Z] INFO: Migrating database... -[2025-03-31T11:23:51.819Z] INFO: Migrating database... -[2025-03-31T11:23:51.971Z] INFO: Migrating database... -[2025-03-31T11:23:52.122Z] INFO: Migrating database... -[2025-03-31T11:23:52.274Z] INFO: Migrating database... -[2025-03-31T11:23:52.426Z] INFO: Migrating database... -[2025-03-31T11:23:52.576Z] INFO: Migrating database... -[2025-03-31T11:23:52.717Z] INFO: Migrating database... -[2025-03-31T11:23:52.854Z] INFO: Migrating database... -[2025-03-31T11:23:53.013Z] INFO: Migrating database... -[2025-03-31T11:25:10.536Z] DEBUG: Using database driver: sqlite -[2025-03-31T11:25:10.828Z] INFO: Migrating database... -[2025-03-31T11:25:11.011Z] INFO: Migrating database... -[2025-03-31T11:25:11.178Z] INFO: Migrating database... -[2025-03-31T11:25:11.353Z] INFO: Migrating database... -[2025-03-31T11:25:11.515Z] INFO: Migrating database... -[2025-03-31T11:25:11.714Z] INFO: Migrating database... -[2025-03-31T11:25:11.891Z] INFO: Migrating database... -[2025-03-31T11:25:12.061Z] INFO: Migrating database... -[2025-03-31T11:25:12.238Z] INFO: Migrating database... -[2025-03-31T11:25:32.643Z] DEBUG: Using database driver: sqlite -[2025-03-31T11:25:32.816Z] INFO: Migrating database... -[2025-03-31T11:25:32.983Z] INFO: Migrating database... -[2025-03-31T11:25:33.128Z] INFO: Migrating database... -[2025-03-31T11:25:33.276Z] INFO: Migrating database... -[2025-03-31T11:25:33.428Z] INFO: Migrating database... -[2025-03-31T11:25:33.566Z] INFO: Migrating database... -[2025-03-31T11:25:33.712Z] INFO: Migrating database... -[2025-03-31T11:25:33.870Z] INFO: Migrating database... -[2025-03-31T11:25:34.022Z] INFO: Migrating database... -[2025-03-31T11:25:34.181Z] INFO: Migrating database... -[2025-03-31T11:25:34.360Z] INFO: Migrating database... -[2025-03-31T11:25:34.559Z] INFO: Migrating database... -[2025-03-31T11:25:34.708Z] INFO: Migrating database... -[2025-03-31T11:25:34.908Z] INFO: Migrating database... -[2025-03-31T11:25:35.102Z] INFO: Migrating database... -[2025-03-31T11:25:35.291Z] INFO: Migrating database... -[2025-03-31T11:25:35.488Z] INFO: Migrating database... -[2025-03-31T11:25:35.684Z] INFO: Migrating database... -[2025-03-31T11:25:35.971Z] INFO: Migrating database... -[2025-03-31T11:25:36.125Z] INFO: Migrating database... -[2025-03-31T11:25:36.306Z] INFO: Migrating database... -[2025-03-31T11:25:36.512Z] INFO: Migrating database... -[2025-03-31T11:25:36.713Z] INFO: Migrating database... -[2025-03-31T11:25:36.884Z] INFO: Migrating database... -[2025-03-31T11:25:37.044Z] INFO: Migrating database... -[2025-03-31T11:25:37.187Z] INFO: Migrating database... -[2025-03-31T11:25:37.331Z] INFO: Migrating database... -[2025-03-31T11:25:37.490Z] INFO: Migrating database... -[2025-03-31T11:25:37.654Z] INFO: Migrating database... -[2025-03-31T11:25:37.818Z] INFO: Migrating database... -[2025-03-31T11:26:38.001Z] DEBUG: Using database driver: sqlite -[2025-03-31T11:26:38.434Z] INFO: Migrating database... -[2025-03-31T11:26:38.601Z] INFO: Migrating database... -[2025-03-31T11:26:38.755Z] INFO: Migrating database... -[2025-03-31T11:26:38.899Z] INFO: Migrating database... -[2025-03-31T11:26:39.040Z] INFO: Migrating database... -[2025-03-31T11:26:39.184Z] INFO: Migrating database... -[2025-03-31T11:26:39.361Z] INFO: Migrating database... -[2025-03-31T11:26:39.500Z] INFO: Migrating database... -[2025-03-31T11:26:39.648Z] INFO: Migrating database... -[2025-03-31T11:26:39.811Z] INFO: Migrating database... -[2025-03-31T11:26:39.967Z] INFO: Migrating database... -[2025-03-31T11:26:40.121Z] INFO: Migrating database... -[2025-03-31T11:26:40.288Z] INFO: Migrating database... -[2025-03-31T11:26:40.434Z] INFO: Migrating database... -[2025-03-31T11:26:40.580Z] INFO: Migrating database... -[2025-03-31T11:26:40.729Z] INFO: Migrating database... -[2025-03-31T11:26:40.870Z] INFO: Migrating database... -[2025-03-31T11:26:41.017Z] INFO: Migrating database... -[2025-03-31T11:26:41.169Z] INFO: Migrating database... -[2025-03-31T11:26:41.329Z] INFO: Migrating database... -[2025-03-31T11:26:41.475Z] INFO: Migrating database... -[2025-03-31T11:26:41.618Z] INFO: Migrating database... -[2025-03-31T11:26:41.780Z] INFO: Migrating database... -[2025-03-31T11:26:41.926Z] INFO: Migrating database... -[2025-03-31T11:26:42.068Z] INFO: Migrating database... -[2025-03-31T11:26:42.220Z] INFO: Migrating database... -[2025-03-31T11:26:42.379Z] INFO: Migrating database... -[2025-03-31T11:26:42.536Z] INFO: Migrating database... -[2025-03-31T11:26:42.730Z] INFO: Migrating database... -[2025-03-31T11:26:42.925Z] INFO: Migrating database... -[2025-03-31T11:27:33.782Z] DEBUG: Using database driver: sqlite -[2025-03-31T11:27:33.978Z] INFO: Migrating database... -[2025-03-31T11:27:34.149Z] INFO: Migrating database... -[2025-03-31T11:27:34.299Z] INFO: Migrating database... -[2025-03-31T11:27:34.446Z] INFO: Migrating database... -[2025-03-31T11:27:34.610Z] INFO: Migrating database... -[2025-03-31T11:27:34.747Z] INFO: Migrating database... -[2025-03-31T11:27:34.893Z] INFO: Migrating database... -[2025-03-31T11:27:35.044Z] INFO: Migrating database... -[2025-03-31T11:27:35.186Z] INFO: Migrating database... -[2025-03-31T11:27:35.341Z] INFO: Migrating database... -[2025-03-31T11:27:35.504Z] INFO: Migrating database... -[2025-03-31T11:27:35.664Z] INFO: Migrating database... -[2025-03-31T11:27:35.819Z] INFO: Migrating database... -[2025-03-31T11:27:35.992Z] INFO: Migrating database... -[2025-03-31T11:27:36.185Z] INFO: Migrating database... -[2025-03-31T11:27:36.392Z] INFO: Migrating database... -[2025-03-31T11:27:36.573Z] INFO: Migrating database... -[2025-03-31T11:27:36.753Z] INFO: Migrating database... -[2025-03-31T11:27:36.904Z] INFO: Migrating database... -[2025-03-31T11:27:37.071Z] INFO: Migrating database... -[2025-03-31T11:27:37.216Z] INFO: Migrating database... -[2025-03-31T11:27:37.358Z] INFO: Migrating database... -[2025-03-31T11:27:37.523Z] INFO: Migrating database... -[2025-03-31T11:27:37.682Z] INFO: Migrating database... -[2025-03-31T11:27:37.902Z] INFO: Migrating database... -[2025-03-31T11:27:38.082Z] INFO: Migrating database... -[2025-03-31T11:27:38.270Z] INFO: Migrating database... -[2025-03-31T11:27:38.464Z] INFO: Migrating database... -[2025-03-31T11:27:38.658Z] INFO: Migrating database... -[2025-03-31T11:27:38.848Z] INFO: Migrating database... -[2025-03-31T11:30:23.988Z] DEBUG: Using database driver: sqlite -[2025-03-31T11:30:24.194Z] INFO: Migrating database... -[2025-03-31T11:30:24.369Z] INFO: Migrating database... -[2025-03-31T11:30:24.527Z] INFO: Migrating database... -[2025-03-31T11:30:24.680Z] INFO: Migrating database... -[2025-03-31T11:30:24.819Z] INFO: Migrating database... -[2025-03-31T11:30:24.955Z] INFO: Migrating database... -[2025-03-31T11:30:25.099Z] INFO: Migrating database... -[2025-03-31T11:30:25.334Z] INFO: Migrating database... -[2025-03-31T11:30:25.514Z] INFO: Migrating database... -[2025-03-31T11:30:25.763Z] INFO: Migrating database... -[2025-03-31T11:30:26.097Z] INFO: Migrating database... -[2025-03-31T11:30:26.362Z] INFO: Migrating database... -[2025-03-31T11:30:26.520Z] INFO: Migrating database... -[2025-03-31T11:30:26.686Z] INFO: Migrating database... -[2025-03-31T11:30:26.854Z] INFO: Migrating database... -[2025-03-31T11:30:27.022Z] INFO: Migrating database... -[2025-03-31T11:30:27.197Z] INFO: Migrating database... -[2025-03-31T11:30:27.517Z] INFO: Migrating database... -[2025-03-31T11:30:27.689Z] INFO: Migrating database... -[2025-03-31T11:30:27.890Z] INFO: Migrating database... -[2025-03-31T11:30:28.174Z] INFO: Migrating database... -[2025-03-31T11:30:28.375Z] INFO: Migrating database... -[2025-03-31T11:30:28.603Z] INFO: Migrating database... -[2025-03-31T11:30:29.075Z] INFO: Migrating database... -[2025-03-31T11:30:29.376Z] INFO: Migrating database... -[2025-03-31T11:30:29.544Z] INFO: Migrating database... -[2025-03-31T11:30:29.706Z] INFO: Migrating database... -[2025-03-31T11:30:29.875Z] INFO: Migrating database... -[2025-03-31T11:30:30.067Z] INFO: Migrating database... -[2025-03-31T11:30:30.275Z] INFO: Migrating database... -[2025-03-31T11:30:50.343Z] DEBUG: Using database driver: sqlite -[2025-03-31T11:30:50.539Z] INFO: Migrating database... -[2025-03-31T11:30:50.724Z] INFO: Migrating database... -[2025-03-31T11:30:50.864Z] INFO: Migrating database... -[2025-03-31T11:30:51.007Z] INFO: Migrating database... -[2025-03-31T11:30:51.144Z] INFO: Migrating database... -[2025-03-31T11:30:51.288Z] INFO: Migrating database... -[2025-03-31T11:30:51.454Z] INFO: Migrating database... -[2025-03-31T11:30:51.663Z] INFO: Migrating database... -[2025-03-31T11:30:51.896Z] INFO: Migrating database... -[2025-03-31T11:30:52.092Z] INFO: Migrating database... -[2025-03-31T11:30:52.282Z] INFO: Migrating database... -[2025-03-31T11:30:52.484Z] INFO: Migrating database... -[2025-03-31T11:30:52.697Z] INFO: Migrating database... -[2025-03-31T11:30:52.846Z] INFO: Migrating database... -[2025-03-31T11:30:53.000Z] INFO: Migrating database... -[2025-03-31T11:30:53.155Z] INFO: Migrating database... -[2025-03-31T11:30:53.297Z] INFO: Migrating database... -[2025-03-31T11:30:53.436Z] INFO: Migrating database... -[2025-03-31T11:30:53.586Z] INFO: Migrating database... -[2025-03-31T11:30:53.734Z] INFO: Migrating database... -[2025-03-31T11:30:53.882Z] INFO: Migrating database... -[2025-03-31T11:30:54.061Z] INFO: Migrating database... -[2025-03-31T11:30:54.221Z] INFO: Migrating database... -[2025-03-31T11:30:54.380Z] INFO: Migrating database... -[2025-03-31T11:30:54.534Z] INFO: Migrating database... -[2025-03-31T11:30:54.688Z] INFO: Migrating database... -[2025-03-31T11:30:54.837Z] INFO: Migrating database... -[2025-03-31T11:30:54.988Z] INFO: Migrating database... -[2025-03-31T11:30:55.144Z] INFO: Migrating database... -[2025-03-31T11:30:55.295Z] INFO: Migrating database... -[2025-03-31T11:33:19.260Z] DEBUG: Using database driver: sqlite -[2025-03-31T11:33:19.458Z] INFO: Migrating database... -[2025-03-31T11:33:19.625Z] INFO: Migrating database... -[2025-03-31T11:33:19.783Z] INFO: Migrating database... -[2025-03-31T11:33:19.938Z] INFO: Migrating database... -[2025-03-31T11:33:20.126Z] INFO: Migrating database... -[2025-03-31T11:33:20.285Z] INFO: Migrating database... -[2025-03-31T11:33:20.489Z] INFO: Migrating database... -[2025-03-31T11:33:20.672Z] INFO: Migrating database... -[2025-03-31T11:33:20.889Z] INFO: Migrating database... -[2025-03-31T11:33:21.078Z] INFO: Migrating database... -[2025-03-31T11:33:21.303Z] INFO: Migrating database... -[2025-03-31T11:33:21.446Z] INFO: Migrating database... -[2025-03-31T11:33:21.591Z] INFO: Migrating database... -[2025-03-31T11:33:21.736Z] INFO: Migrating database... -[2025-03-31T11:33:21.886Z] INFO: Migrating database... -[2025-03-31T11:33:22.046Z] INFO: Migrating database... -[2025-03-31T11:33:22.204Z] INFO: Migrating database... -[2025-03-31T11:33:22.368Z] INFO: Migrating database... -[2025-03-31T11:33:22.528Z] INFO: Migrating database... -[2025-03-31T11:33:22.675Z] INFO: Migrating database... -[2025-03-31T11:33:22.820Z] INFO: Migrating database... -[2025-03-31T11:33:22.980Z] INFO: Migrating database... -[2025-03-31T11:33:23.197Z] INFO: Migrating database... -[2025-03-31T11:33:23.420Z] INFO: Migrating database... -[2025-03-31T11:33:23.631Z] INFO: Migrating database... -[2025-03-31T11:33:23.823Z] INFO: Migrating database... -[2025-03-31T11:33:24.029Z] INFO: Migrating database... -[2025-03-31T11:33:24.252Z] INFO: Migrating database... -[2025-03-31T11:33:24.400Z] INFO: Migrating database... -[2025-03-31T11:33:24.550Z] INFO: Migrating database... -[2025-03-31T11:33:38.546Z] DEBUG: Using database driver: sqlite -[2025-03-31T11:33:38.751Z] INFO: Migrating database... -[2025-03-31T11:33:38.948Z] INFO: Migrating database... -[2025-03-31T11:33:39.105Z] INFO: Migrating database... -[2025-03-31T11:33:39.307Z] INFO: Migrating database... -[2025-03-31T11:33:39.514Z] INFO: Migrating database... -[2025-03-31T11:33:39.731Z] INFO: Migrating database... -[2025-03-31T11:33:39.940Z] INFO: Migrating database... -[2025-03-31T11:33:40.182Z] INFO: Migrating database... -[2025-03-31T11:33:40.350Z] INFO: Migrating database... -[2025-03-31T11:33:40.508Z] INFO: Migrating database... -[2025-03-31T11:33:40.655Z] INFO: Migrating database... -[2025-03-31T11:33:40.907Z] INFO: Migrating database... -[2025-03-31T11:33:41.051Z] INFO: Migrating database... -[2025-03-31T11:33:41.205Z] INFO: Migrating database... -[2025-03-31T11:33:41.359Z] INFO: Migrating database... -[2025-03-31T11:33:41.544Z] INFO: Migrating database... -[2025-03-31T11:33:41.739Z] INFO: Migrating database... -[2025-03-31T11:33:41.983Z] INFO: Migrating database... -[2025-03-31T11:33:42.192Z] INFO: Migrating database... -[2025-03-31T11:33:42.374Z] INFO: Migrating database... -[2025-03-31T11:33:42.572Z] INFO: Migrating database... -[2025-03-31T11:33:42.744Z] INFO: Migrating database... -[2025-03-31T11:33:42.890Z] INFO: Migrating database... -[2025-03-31T11:33:43.033Z] INFO: Migrating database... -[2025-03-31T11:33:43.167Z] INFO: Migrating database... -[2025-03-31T11:33:43.324Z] INFO: Migrating database... -[2025-03-31T11:33:43.479Z] INFO: Migrating database... -[2025-03-31T11:33:43.634Z] INFO: Migrating database... -[2025-03-31T11:33:43.793Z] INFO: Migrating database... -[2025-03-31T11:33:43.943Z] INFO: Migrating database... From d8bc32ca53ac9b9a09bae1d0d8e05b149d8eb351 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Mon, 31 Mar 2025 21:49:59 +0800 Subject: [PATCH 32/78] chore: wip --- .../core/commerce/src/device/export.ts | 3 +- .../core/commerce/src/device/fetch.ts | 11 +++++++ .../core/commerce/src/device/index.ts | 14 ++++----- .../core/commerce/src/tests/device.test.ts | 5 +++- .../defaults/models/ecommerce/PrintDevice.ts | 2 +- .../defaults/models/ecommerce/Receipt.ts | 2 +- .../framework/orm/src/models/PrintDevice.ts | 7 +++++ storage/framework/orm/src/models/Receipt.ts | 29 ++++++++++++++++++- storage/framework/requests/ReceiptRequest.ts | 2 ++ storage/framework/types/requests.d.ts | 2 ++ 10 files changed, 64 insertions(+), 13 deletions(-) diff --git a/storage/framework/core/commerce/src/device/export.ts b/storage/framework/core/commerce/src/device/export.ts index 4b3cc4ecde..fabff59f30 100644 --- a/storage/framework/core/commerce/src/device/export.ts +++ b/storage/framework/core/commerce/src/device/export.ts @@ -1,6 +1,5 @@ -import type { SpreadsheetWrapper } from 'ts-spreadsheets' import type { PrintDeviceJsonResponse } from '@stacksjs/orm' -import { db } from '@stacksjs/database' +import type { SpreadsheetWrapper } from 'ts-spreadsheets' import { createSpreadsheet } from 'ts-spreadsheets' import { fetchAll } from './fetch' diff --git a/storage/framework/core/commerce/src/device/fetch.ts b/storage/framework/core/commerce/src/device/fetch.ts index 45e39e1987..8723e6b665 100644 --- a/storage/framework/core/commerce/src/device/fetch.ts +++ b/storage/framework/core/commerce/src/device/fetch.ts @@ -18,3 +18,14 @@ export async function fetchById(id: number): Promise { return await db.selectFrom('print_devices').selectAll().execute() } + +/** + * Count all print devices + */ +export async function countAll(): Promise { + return await db + .selectFrom('print_devices') + .select(db.fn.count('id').as('count')) + .executeTakeFirst() + .then(result => result?.count ?? 0) +} diff --git a/storage/framework/core/commerce/src/device/index.ts b/storage/framework/core/commerce/src/device/index.ts index 1445d2222f..8825127792 100644 --- a/storage/framework/core/commerce/src/device/index.ts +++ b/storage/framework/core/commerce/src/device/index.ts @@ -4,6 +4,13 @@ export { destroy, } from './destroy' +// Functions from export.ts +export { + downloadPrintDevices, + exportPrintDevices, + storePrintDevicesExport, +} from './export' + // Functions from fetch.ts export { fetchAll, @@ -22,10 +29,3 @@ export { updatePrintCount, updateStatus, } from './update' - -// Functions from export.ts -export { - downloadPrintDevices, - exportPrintDevices, - storePrintDevicesExport, -} from './export' diff --git a/storage/framework/core/commerce/src/tests/device.test.ts b/storage/framework/core/commerce/src/tests/device.test.ts index 83fa3d8597..f99caf2830 100644 --- a/storage/framework/core/commerce/src/tests/device.test.ts +++ b/storage/framework/core/commerce/src/tests/device.test.ts @@ -1,10 +1,10 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { refreshDatabase } from '@stacksjs/testing' import { bulkDestroy, destroy } from '../device/destroy' +import { exportPrintDevices } from '../device/export' import { fetchAll, fetchById } from '../device/fetch' import { bulkStore, store } from '../device/store' import { update, updatePrintCount, updateStatus } from '../device/update' -import { downloadPrintDevices, exportPrintDevices, storePrintDevicesExport } from '../device/export' // Create a request-like object for testing class TestRequest { @@ -69,6 +69,9 @@ describe('Print Device Module', () => { mac_address: 'AA:BB:CC:DD:EE:FF', location: 'Server Room', terminal: 'TERM002', + status: 'offline', + last_ping: Date.now(), + print_count: 0, } const request = new TestRequest(minimalRequestData) diff --git a/storage/framework/defaults/models/ecommerce/PrintDevice.ts b/storage/framework/defaults/models/ecommerce/PrintDevice.ts index 678a55bf3c..e8eb5bd0f3 100644 --- a/storage/framework/defaults/models/ecommerce/PrintDevice.ts +++ b/storage/framework/defaults/models/ecommerce/PrintDevice.ts @@ -6,7 +6,7 @@ export default { table: 'print_devices', primaryKey: 'id', autoIncrement: true, - + hasMany: ['Receipt'], traits: { useUuid: true, useTimestamps: true, diff --git a/storage/framework/defaults/models/ecommerce/Receipt.ts b/storage/framework/defaults/models/ecommerce/Receipt.ts index ac78ff6075..85eea01281 100644 --- a/storage/framework/defaults/models/ecommerce/Receipt.ts +++ b/storage/framework/defaults/models/ecommerce/Receipt.ts @@ -6,7 +6,7 @@ export default { table: 'receipts', primaryKey: 'id', autoIncrement: true, - + belongsTo: ['PrintDevice'], traits: { useUuid: true, useTimestamps: true, diff --git a/storage/framework/orm/src/models/PrintDevice.ts b/storage/framework/orm/src/models/PrintDevice.ts index 343e80cb46..8772eb6786 100644 --- a/storage/framework/orm/src/models/PrintDevice.ts +++ b/storage/framework/orm/src/models/PrintDevice.ts @@ -1,10 +1,12 @@ import type { Generated, Insertable, RawBuilder, Selectable, Updateable } from '@stacksjs/database' import type { Operator } from '@stacksjs/orm' +import type { ReceiptModel } from './Receipt' import { randomUUIDv7 } from 'bun' import { sql } from '@stacksjs/database' import { HttpError } from '@stacksjs/error-handling' import { dispatch } from '@stacksjs/events' import { DB } from '@stacksjs/orm' + import { BaseOrm } from '../utils/base' export interface PrintDevicesTable { @@ -169,6 +171,10 @@ export class PrintDeviceModel extends BaseOrm + print_device_id: number printer: string document: string timestamp: number @@ -43,7 +46,7 @@ export type ReceiptUpdate = Updateable export class ReceiptModel extends BaseOrm { private readonly hidden: Array = [] - private readonly fillable: Array = ['printer', 'document', 'timestamp', 'status', 'size', 'pages', 'duration', 'uuid'] + private readonly fillable: Array = ['printer', 'document', 'timestamp', 'status', 'size', 'pages', 'duration', 'uuid', 'print_device_id'] private readonly guarded: Array = [] protected attributes = {} as ReceiptJsonResponse protected originalAttributes = {} as ReceiptJsonResponse @@ -169,6 +172,14 @@ export class ReceiptModel extends BaseOrm(column, values) } + async printDeviceBelong(): Promise { + if (this.print_device_id === undefined) + throw new HttpError(500, 'Relation Error!') + + const model = await PrintDevice + .where('id', '=', this.print_device_id) + .first() + + if (!model) + throw new HttpError(500, 'Model Relation Not Found!') + + return model + } + toSearchableObject(): Partial { return { id: this.id, @@ -912,6 +937,8 @@ export class ReceiptModel extends BaseOrm implements Recei public size = 0 public pages = 0 public duration = 0 + public print_device_id = 0 public created_at = new Date() public updated_at = new Date() public uuid = '' diff --git a/storage/framework/types/requests.d.ts b/storage/framework/types/requests.d.ts index 1678fdbdf0..5cd725565f 100644 --- a/storage/framework/types/requests.d.ts +++ b/storage/framework/types/requests.d.ts @@ -563,6 +563,7 @@ interface RequestDataReceipt { size: number pages: number duration: number + print_device_id: number created_at?: Date updated_at?: Date } @@ -578,6 +579,7 @@ export interface ReceiptRequestType extends Request { size: number pages: number duration: number + print_device_id: number created_at?: Date updated_at?: Date } From 10aa73aa64da784fcb036be041a4b045bfc72a0b Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Mon, 31 Mar 2025 22:13:20 +0800 Subject: [PATCH 33/78] chore: wip --- ...=> 1743429399884-create-projects-table.ts} | 0 ...9399907-create-subscriber_emails-table.ts} | 0 ...32-create-personal_access_tokens-table.ts} | 0 ... 1743429399935-create-team_users-table.ts} | 0 ...ts => 1743429399952-create-teams-table.ts} | 0 ...1743429399974-create-subscribers-table.ts} | 0 ...1743429399993-create-deployments-table.ts} | 0 ...=> 1743429400014-create-releases-table.ts} | 0 ...=> 1743429400032-create-passkeys-table.ts} | 0 ...ts => 1743429400033-create-users-table.ts} | 0 ...ts => 1743429400053-create-posts-table.ts} | 0 ...43429400073-create-print_devices-table.ts} | 0 ... 1743429400092-create-categories-table.ts} | 0 ...=> 1743429400112-create-payments-table.ts} | 0 ... => 1743429400132-create-drivers-table.ts} | 0 ...9400151-create-waitlist_products-table.ts} | 0 ...400171-create-digital_deliveries-table.ts} | 0 ...43429400191-create-manufacturers-table.ts} | 0 ...1743429400210-create-order_items-table.ts} | 0 ...3429400229-create-shipping_zones-table.ts} | 0 ...> 1743429400247-create-customers-table.ts} | 0 ...=> 1743429400265-create-products-table.ts} | 0 ...=> 1743429400285-create-receipts-table.ts} | 4 + ...29400308-create-product_variants-table.ts} | 0 ...743429400328-create-license_keys-table.ts} | 0 ...0349-create-waitlist_restaurants-table.ts} | 0 ... => 1743429400375-create-reviews-table.ts} | 0 ...43429400398-create-product_units-table.ts} | 0 ... 1743429400419-create-gift_cards-table.ts} | 0 ...s => 1743429400441-create-orders-table.ts} | 0 ... => 1743429400463-create-coupons-table.ts} | 0 ...> 1743429400484-create-tax_rates-table.ts} | 0 ...743429400505-create-transactions-table.ts} | 0 ...3429400527-create-loyalty_points-table.ts} | 0 ...43429400547-create-product_items-table.ts} | 0 ...429400567-create-loyalty_rewards-table.ts} | 0 ...29400586-create-shipping_methods-table.ts} | 0 ...3429400608-create-shipping_rates-table.ts} | 0 ...429400627-create-delivery_routes-table.ts} | 0 ...1743429400648-create-failed_jobs-table.ts} | 0 ...429400668-create-payment_methods-table.ts} | 0 ...0687-create-payment_transactions-table.ts} | 0 ...=> 1743429400706-create-requests-table.ts} | 0 ....ts => 1743429400726-create-jobs-table.ts} | 0 ...43429400744-create-subscriptions-table.ts} | 0 ...29400764-create-payment_products-table.ts} | 0 ...s => 1743429400784-create-errors-table.ts} | 0 .../core/commerce/src/device/fetch.ts | 25 ++++++ .../core/commerce/src/tests/device.test.ts | 86 ++++++++++++++++++- storage/framework/models/PrintDevice.ts | 2 +- storage/framework/models/Receipt.ts | 2 +- 51 files changed, 116 insertions(+), 3 deletions(-) rename database/migrations/{1743422628652-create-projects-table.ts => 1743429399884-create-projects-table.ts} (100%) rename database/migrations/{1743422628675-create-subscriber_emails-table.ts => 1743429399907-create-subscriber_emails-table.ts} (100%) rename database/migrations/{1743422628696-create-personal_access_tokens-table.ts => 1743429399932-create-personal_access_tokens-table.ts} (100%) rename database/migrations/{1743422628699-create-team_users-table.ts => 1743429399935-create-team_users-table.ts} (100%) rename database/migrations/{1743422628717-create-teams-table.ts => 1743429399952-create-teams-table.ts} (100%) rename database/migrations/{1743422628738-create-subscribers-table.ts => 1743429399974-create-subscribers-table.ts} (100%) rename database/migrations/{1743422628757-create-deployments-table.ts => 1743429399993-create-deployments-table.ts} (100%) rename database/migrations/{1743422628777-create-releases-table.ts => 1743429400014-create-releases-table.ts} (100%) rename database/migrations/{1743422628795-create-passkeys-table.ts => 1743429400032-create-passkeys-table.ts} (100%) rename database/migrations/{1743422628796-create-users-table.ts => 1743429400033-create-users-table.ts} (100%) rename database/migrations/{1743422628815-create-posts-table.ts => 1743429400053-create-posts-table.ts} (100%) rename database/migrations/{1743422628837-create-print_devices-table.ts => 1743429400073-create-print_devices-table.ts} (100%) rename database/migrations/{1743422628856-create-categories-table.ts => 1743429400092-create-categories-table.ts} (100%) rename database/migrations/{1743422628877-create-payments-table.ts => 1743429400112-create-payments-table.ts} (100%) rename database/migrations/{1743422628896-create-drivers-table.ts => 1743429400132-create-drivers-table.ts} (100%) rename database/migrations/{1743422628915-create-waitlist_products-table.ts => 1743429400151-create-waitlist_products-table.ts} (100%) rename database/migrations/{1743422628934-create-digital_deliveries-table.ts => 1743429400171-create-digital_deliveries-table.ts} (100%) rename database/migrations/{1743422628954-create-manufacturers-table.ts => 1743429400191-create-manufacturers-table.ts} (100%) rename database/migrations/{1743422628972-create-order_items-table.ts => 1743429400210-create-order_items-table.ts} (100%) rename database/migrations/{1743422628991-create-shipping_zones-table.ts => 1743429400229-create-shipping_zones-table.ts} (100%) rename database/migrations/{1743422629009-create-customers-table.ts => 1743429400247-create-customers-table.ts} (100%) rename database/migrations/{1743422629029-create-products-table.ts => 1743429400265-create-products-table.ts} (100%) rename database/migrations/{1743422629050-create-receipts-table.ts => 1743429400285-create-receipts-table.ts} (77%) rename database/migrations/{1743422629069-create-product_variants-table.ts => 1743429400308-create-product_variants-table.ts} (100%) rename database/migrations/{1743422629089-create-license_keys-table.ts => 1743429400328-create-license_keys-table.ts} (100%) rename database/migrations/{1743422629108-create-waitlist_restaurants-table.ts => 1743429400349-create-waitlist_restaurants-table.ts} (100%) rename database/migrations/{1743422629126-create-reviews-table.ts => 1743429400375-create-reviews-table.ts} (100%) rename database/migrations/{1743422629146-create-product_units-table.ts => 1743429400398-create-product_units-table.ts} (100%) rename database/migrations/{1743422629165-create-gift_cards-table.ts => 1743429400419-create-gift_cards-table.ts} (100%) rename database/migrations/{1743422629184-create-orders-table.ts => 1743429400441-create-orders-table.ts} (100%) rename database/migrations/{1743422629211-create-coupons-table.ts => 1743429400463-create-coupons-table.ts} (100%) rename database/migrations/{1743422629231-create-tax_rates-table.ts => 1743429400484-create-tax_rates-table.ts} (100%) rename database/migrations/{1743422629251-create-transactions-table.ts => 1743429400505-create-transactions-table.ts} (100%) rename database/migrations/{1743422629274-create-loyalty_points-table.ts => 1743429400527-create-loyalty_points-table.ts} (100%) rename database/migrations/{1743422629294-create-product_items-table.ts => 1743429400547-create-product_items-table.ts} (100%) rename database/migrations/{1743422629314-create-loyalty_rewards-table.ts => 1743429400567-create-loyalty_rewards-table.ts} (100%) rename database/migrations/{1743422629332-create-shipping_methods-table.ts => 1743429400586-create-shipping_methods-table.ts} (100%) rename database/migrations/{1743422629352-create-shipping_rates-table.ts => 1743429400608-create-shipping_rates-table.ts} (100%) rename database/migrations/{1743422629371-create-delivery_routes-table.ts => 1743429400627-create-delivery_routes-table.ts} (100%) rename database/migrations/{1743422629390-create-failed_jobs-table.ts => 1743429400648-create-failed_jobs-table.ts} (100%) rename database/migrations/{1743422629409-create-payment_methods-table.ts => 1743429400668-create-payment_methods-table.ts} (100%) rename database/migrations/{1743422629428-create-payment_transactions-table.ts => 1743429400687-create-payment_transactions-table.ts} (100%) rename database/migrations/{1743422629448-create-requests-table.ts => 1743429400706-create-requests-table.ts} (100%) rename database/migrations/{1743422629467-create-jobs-table.ts => 1743429400726-create-jobs-table.ts} (100%) rename database/migrations/{1743422629486-create-subscriptions-table.ts => 1743429400744-create-subscriptions-table.ts} (100%) rename database/migrations/{1743422629504-create-payment_products-table.ts => 1743429400764-create-payment_products-table.ts} (100%) rename database/migrations/{1743422629523-create-errors-table.ts => 1743429400784-create-errors-table.ts} (100%) diff --git a/database/migrations/1743422628652-create-projects-table.ts b/database/migrations/1743429399884-create-projects-table.ts similarity index 100% rename from database/migrations/1743422628652-create-projects-table.ts rename to database/migrations/1743429399884-create-projects-table.ts diff --git a/database/migrations/1743422628675-create-subscriber_emails-table.ts b/database/migrations/1743429399907-create-subscriber_emails-table.ts similarity index 100% rename from database/migrations/1743422628675-create-subscriber_emails-table.ts rename to database/migrations/1743429399907-create-subscriber_emails-table.ts diff --git a/database/migrations/1743422628696-create-personal_access_tokens-table.ts b/database/migrations/1743429399932-create-personal_access_tokens-table.ts similarity index 100% rename from database/migrations/1743422628696-create-personal_access_tokens-table.ts rename to database/migrations/1743429399932-create-personal_access_tokens-table.ts diff --git a/database/migrations/1743422628699-create-team_users-table.ts b/database/migrations/1743429399935-create-team_users-table.ts similarity index 100% rename from database/migrations/1743422628699-create-team_users-table.ts rename to database/migrations/1743429399935-create-team_users-table.ts diff --git a/database/migrations/1743422628717-create-teams-table.ts b/database/migrations/1743429399952-create-teams-table.ts similarity index 100% rename from database/migrations/1743422628717-create-teams-table.ts rename to database/migrations/1743429399952-create-teams-table.ts diff --git a/database/migrations/1743422628738-create-subscribers-table.ts b/database/migrations/1743429399974-create-subscribers-table.ts similarity index 100% rename from database/migrations/1743422628738-create-subscribers-table.ts rename to database/migrations/1743429399974-create-subscribers-table.ts diff --git a/database/migrations/1743422628757-create-deployments-table.ts b/database/migrations/1743429399993-create-deployments-table.ts similarity index 100% rename from database/migrations/1743422628757-create-deployments-table.ts rename to database/migrations/1743429399993-create-deployments-table.ts diff --git a/database/migrations/1743422628777-create-releases-table.ts b/database/migrations/1743429400014-create-releases-table.ts similarity index 100% rename from database/migrations/1743422628777-create-releases-table.ts rename to database/migrations/1743429400014-create-releases-table.ts diff --git a/database/migrations/1743422628795-create-passkeys-table.ts b/database/migrations/1743429400032-create-passkeys-table.ts similarity index 100% rename from database/migrations/1743422628795-create-passkeys-table.ts rename to database/migrations/1743429400032-create-passkeys-table.ts diff --git a/database/migrations/1743422628796-create-users-table.ts b/database/migrations/1743429400033-create-users-table.ts similarity index 100% rename from database/migrations/1743422628796-create-users-table.ts rename to database/migrations/1743429400033-create-users-table.ts diff --git a/database/migrations/1743422628815-create-posts-table.ts b/database/migrations/1743429400053-create-posts-table.ts similarity index 100% rename from database/migrations/1743422628815-create-posts-table.ts rename to database/migrations/1743429400053-create-posts-table.ts diff --git a/database/migrations/1743422628837-create-print_devices-table.ts b/database/migrations/1743429400073-create-print_devices-table.ts similarity index 100% rename from database/migrations/1743422628837-create-print_devices-table.ts rename to database/migrations/1743429400073-create-print_devices-table.ts diff --git a/database/migrations/1743422628856-create-categories-table.ts b/database/migrations/1743429400092-create-categories-table.ts similarity index 100% rename from database/migrations/1743422628856-create-categories-table.ts rename to database/migrations/1743429400092-create-categories-table.ts diff --git a/database/migrations/1743422628877-create-payments-table.ts b/database/migrations/1743429400112-create-payments-table.ts similarity index 100% rename from database/migrations/1743422628877-create-payments-table.ts rename to database/migrations/1743429400112-create-payments-table.ts diff --git a/database/migrations/1743422628896-create-drivers-table.ts b/database/migrations/1743429400132-create-drivers-table.ts similarity index 100% rename from database/migrations/1743422628896-create-drivers-table.ts rename to database/migrations/1743429400132-create-drivers-table.ts diff --git a/database/migrations/1743422628915-create-waitlist_products-table.ts b/database/migrations/1743429400151-create-waitlist_products-table.ts similarity index 100% rename from database/migrations/1743422628915-create-waitlist_products-table.ts rename to database/migrations/1743429400151-create-waitlist_products-table.ts diff --git a/database/migrations/1743422628934-create-digital_deliveries-table.ts b/database/migrations/1743429400171-create-digital_deliveries-table.ts similarity index 100% rename from database/migrations/1743422628934-create-digital_deliveries-table.ts rename to database/migrations/1743429400171-create-digital_deliveries-table.ts diff --git a/database/migrations/1743422628954-create-manufacturers-table.ts b/database/migrations/1743429400191-create-manufacturers-table.ts similarity index 100% rename from database/migrations/1743422628954-create-manufacturers-table.ts rename to database/migrations/1743429400191-create-manufacturers-table.ts diff --git a/database/migrations/1743422628972-create-order_items-table.ts b/database/migrations/1743429400210-create-order_items-table.ts similarity index 100% rename from database/migrations/1743422628972-create-order_items-table.ts rename to database/migrations/1743429400210-create-order_items-table.ts diff --git a/database/migrations/1743422628991-create-shipping_zones-table.ts b/database/migrations/1743429400229-create-shipping_zones-table.ts similarity index 100% rename from database/migrations/1743422628991-create-shipping_zones-table.ts rename to database/migrations/1743429400229-create-shipping_zones-table.ts diff --git a/database/migrations/1743422629009-create-customers-table.ts b/database/migrations/1743429400247-create-customers-table.ts similarity index 100% rename from database/migrations/1743422629009-create-customers-table.ts rename to database/migrations/1743429400247-create-customers-table.ts diff --git a/database/migrations/1743422629029-create-products-table.ts b/database/migrations/1743429400265-create-products-table.ts similarity index 100% rename from database/migrations/1743422629029-create-products-table.ts rename to database/migrations/1743429400265-create-products-table.ts diff --git a/database/migrations/1743422629050-create-receipts-table.ts b/database/migrations/1743429400285-create-receipts-table.ts similarity index 77% rename from database/migrations/1743422629050-create-receipts-table.ts rename to database/migrations/1743429400285-create-receipts-table.ts index c887e6e8d0..9be966e656 100644 --- a/database/migrations/1743422629050-create-receipts-table.ts +++ b/database/migrations/1743429400285-create-receipts-table.ts @@ -13,7 +13,11 @@ export async function up(db: Database) { .addColumn('size', 'numeric') .addColumn('pages', 'numeric') .addColumn('duration', 'numeric') + .addColumn('print_device_id', 'integer', col => + col.references('print_devices.id').onDelete('cascade')) .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('receipts_print_device_id_index').on('receipts').column('print_device_id').execute() } diff --git a/database/migrations/1743422629069-create-product_variants-table.ts b/database/migrations/1743429400308-create-product_variants-table.ts similarity index 100% rename from database/migrations/1743422629069-create-product_variants-table.ts rename to database/migrations/1743429400308-create-product_variants-table.ts diff --git a/database/migrations/1743422629089-create-license_keys-table.ts b/database/migrations/1743429400328-create-license_keys-table.ts similarity index 100% rename from database/migrations/1743422629089-create-license_keys-table.ts rename to database/migrations/1743429400328-create-license_keys-table.ts diff --git a/database/migrations/1743422629108-create-waitlist_restaurants-table.ts b/database/migrations/1743429400349-create-waitlist_restaurants-table.ts similarity index 100% rename from database/migrations/1743422629108-create-waitlist_restaurants-table.ts rename to database/migrations/1743429400349-create-waitlist_restaurants-table.ts diff --git a/database/migrations/1743422629126-create-reviews-table.ts b/database/migrations/1743429400375-create-reviews-table.ts similarity index 100% rename from database/migrations/1743422629126-create-reviews-table.ts rename to database/migrations/1743429400375-create-reviews-table.ts diff --git a/database/migrations/1743422629146-create-product_units-table.ts b/database/migrations/1743429400398-create-product_units-table.ts similarity index 100% rename from database/migrations/1743422629146-create-product_units-table.ts rename to database/migrations/1743429400398-create-product_units-table.ts diff --git a/database/migrations/1743422629165-create-gift_cards-table.ts b/database/migrations/1743429400419-create-gift_cards-table.ts similarity index 100% rename from database/migrations/1743422629165-create-gift_cards-table.ts rename to database/migrations/1743429400419-create-gift_cards-table.ts diff --git a/database/migrations/1743422629184-create-orders-table.ts b/database/migrations/1743429400441-create-orders-table.ts similarity index 100% rename from database/migrations/1743422629184-create-orders-table.ts rename to database/migrations/1743429400441-create-orders-table.ts diff --git a/database/migrations/1743422629211-create-coupons-table.ts b/database/migrations/1743429400463-create-coupons-table.ts similarity index 100% rename from database/migrations/1743422629211-create-coupons-table.ts rename to database/migrations/1743429400463-create-coupons-table.ts diff --git a/database/migrations/1743422629231-create-tax_rates-table.ts b/database/migrations/1743429400484-create-tax_rates-table.ts similarity index 100% rename from database/migrations/1743422629231-create-tax_rates-table.ts rename to database/migrations/1743429400484-create-tax_rates-table.ts diff --git a/database/migrations/1743422629251-create-transactions-table.ts b/database/migrations/1743429400505-create-transactions-table.ts similarity index 100% rename from database/migrations/1743422629251-create-transactions-table.ts rename to database/migrations/1743429400505-create-transactions-table.ts diff --git a/database/migrations/1743422629274-create-loyalty_points-table.ts b/database/migrations/1743429400527-create-loyalty_points-table.ts similarity index 100% rename from database/migrations/1743422629274-create-loyalty_points-table.ts rename to database/migrations/1743429400527-create-loyalty_points-table.ts diff --git a/database/migrations/1743422629294-create-product_items-table.ts b/database/migrations/1743429400547-create-product_items-table.ts similarity index 100% rename from database/migrations/1743422629294-create-product_items-table.ts rename to database/migrations/1743429400547-create-product_items-table.ts diff --git a/database/migrations/1743422629314-create-loyalty_rewards-table.ts b/database/migrations/1743429400567-create-loyalty_rewards-table.ts similarity index 100% rename from database/migrations/1743422629314-create-loyalty_rewards-table.ts rename to database/migrations/1743429400567-create-loyalty_rewards-table.ts diff --git a/database/migrations/1743422629332-create-shipping_methods-table.ts b/database/migrations/1743429400586-create-shipping_methods-table.ts similarity index 100% rename from database/migrations/1743422629332-create-shipping_methods-table.ts rename to database/migrations/1743429400586-create-shipping_methods-table.ts diff --git a/database/migrations/1743422629352-create-shipping_rates-table.ts b/database/migrations/1743429400608-create-shipping_rates-table.ts similarity index 100% rename from database/migrations/1743422629352-create-shipping_rates-table.ts rename to database/migrations/1743429400608-create-shipping_rates-table.ts diff --git a/database/migrations/1743422629371-create-delivery_routes-table.ts b/database/migrations/1743429400627-create-delivery_routes-table.ts similarity index 100% rename from database/migrations/1743422629371-create-delivery_routes-table.ts rename to database/migrations/1743429400627-create-delivery_routes-table.ts diff --git a/database/migrations/1743422629390-create-failed_jobs-table.ts b/database/migrations/1743429400648-create-failed_jobs-table.ts similarity index 100% rename from database/migrations/1743422629390-create-failed_jobs-table.ts rename to database/migrations/1743429400648-create-failed_jobs-table.ts diff --git a/database/migrations/1743422629409-create-payment_methods-table.ts b/database/migrations/1743429400668-create-payment_methods-table.ts similarity index 100% rename from database/migrations/1743422629409-create-payment_methods-table.ts rename to database/migrations/1743429400668-create-payment_methods-table.ts diff --git a/database/migrations/1743422629428-create-payment_transactions-table.ts b/database/migrations/1743429400687-create-payment_transactions-table.ts similarity index 100% rename from database/migrations/1743422629428-create-payment_transactions-table.ts rename to database/migrations/1743429400687-create-payment_transactions-table.ts diff --git a/database/migrations/1743422629448-create-requests-table.ts b/database/migrations/1743429400706-create-requests-table.ts similarity index 100% rename from database/migrations/1743422629448-create-requests-table.ts rename to database/migrations/1743429400706-create-requests-table.ts diff --git a/database/migrations/1743422629467-create-jobs-table.ts b/database/migrations/1743429400726-create-jobs-table.ts similarity index 100% rename from database/migrations/1743422629467-create-jobs-table.ts rename to database/migrations/1743429400726-create-jobs-table.ts diff --git a/database/migrations/1743422629486-create-subscriptions-table.ts b/database/migrations/1743429400744-create-subscriptions-table.ts similarity index 100% rename from database/migrations/1743422629486-create-subscriptions-table.ts rename to database/migrations/1743429400744-create-subscriptions-table.ts diff --git a/database/migrations/1743422629504-create-payment_products-table.ts b/database/migrations/1743429400764-create-payment_products-table.ts similarity index 100% rename from database/migrations/1743422629504-create-payment_products-table.ts rename to database/migrations/1743429400764-create-payment_products-table.ts diff --git a/database/migrations/1743422629523-create-errors-table.ts b/database/migrations/1743429400784-create-errors-table.ts similarity index 100% rename from database/migrations/1743422629523-create-errors-table.ts rename to database/migrations/1743429400784-create-errors-table.ts diff --git a/storage/framework/core/commerce/src/device/fetch.ts b/storage/framework/core/commerce/src/device/fetch.ts index 8723e6b665..f99bbcc567 100644 --- a/storage/framework/core/commerce/src/device/fetch.ts +++ b/storage/framework/core/commerce/src/device/fetch.ts @@ -29,3 +29,28 @@ export async function countAll(): Promise { .executeTakeFirst() .then(result => result?.count ?? 0) } + +/** + * Count total prints across all print devices from receipts + */ +export async function countTotalPrints(): Promise { + const result = await db + .selectFrom('print_devices') + .select('print_count') + .executeTakeFirst() + + return result?.print_count ?? 0 +} + +/** + * Count total prints for a specific print device from receipts + */ +export async function countPrintsByDeviceId(printDeviceId: number): Promise { + const result = await db + .selectFrom('print_devices') + .select('print_count') + .where('id', '=', printDeviceId) + .executeTakeFirst() + + return result?.print_count ?? 0 +} diff --git a/storage/framework/core/commerce/src/tests/device.test.ts b/storage/framework/core/commerce/src/tests/device.test.ts index f99caf2830..e75e0d89ca 100644 --- a/storage/framework/core/commerce/src/tests/device.test.ts +++ b/storage/framework/core/commerce/src/tests/device.test.ts @@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { refreshDatabase } from '@stacksjs/testing' import { bulkDestroy, destroy } from '../device/destroy' import { exportPrintDevices } from '../device/export' -import { fetchAll, fetchById } from '../device/fetch' +import { countPrintsByDeviceId, countTotalPrints, fetchAll, fetchById } from '../device/fetch' import { bulkStore, store } from '../device/store' import { update, updatePrintCount, updateStatus } from '../device/update' @@ -372,4 +372,88 @@ describe('Print Device Module', () => { expect(spreadsheet).toBeDefined() }) }) + + describe('print counting', () => { + it('should count total prints across all devices', async () => { + // Create a test device + const requestData = { + name: 'Main Printer', + mac_address: '00:11:22:33:44:55', + location: 'Office 101', + terminal: 'TERM001', + status: 'online', + last_ping: Date.now(), + print_count: 0, + } + + const request = new TestRequest(requestData) + const device = await store(request as any) + const deviceId = device?.id !== undefined ? Number(device.id) : undefined + + expect(deviceId).toBeDefined() + if (!deviceId) { + throw new Error('Failed to create test device') + } + + // Update print count for the device + await updatePrintCount(deviceId, 100) + + // Count total prints + const totalPrints = await countTotalPrints() + expect(totalPrints).toBe(100) + }) + + it('should count prints for a specific device', async () => { + // Create two test devices + const device1Data = { + name: 'Printer 1', + mac_address: '00:11:22:33:44:55', + location: 'Office 101', + terminal: 'TERM001', + status: 'online', + last_ping: Date.now(), + print_count: 0, + } + + const device2Data = { + name: 'Printer 2', + mac_address: 'AA:BB:CC:DD:EE:FF', + location: 'Office 102', + terminal: 'TERM002', + status: 'online', + last_ping: Date.now(), + print_count: 0, + } + + const device1 = await store(new TestRequest(device1Data) as any) + const device2 = await store(new TestRequest(device2Data) as any) + + const device1Id = device1?.id !== undefined ? Number(device1.id) : undefined + const device2Id = device2?.id !== undefined ? Number(device2.id) : undefined + + expect(device1Id).toBeDefined() + expect(device2Id).toBeDefined() + + if (!device1Id || !device2Id) { + throw new Error('Failed to create test devices') + } + + // Update print counts for both devices + await updatePrintCount(device1Id, 50) + await updatePrintCount(device2Id, 75) + + // Count prints for each device + const device1Prints = await countPrintsByDeviceId(device1Id) + const device2Prints = await countPrintsByDeviceId(device2Id) + + expect(device1Prints).toBe(50) + expect(device2Prints).toBe(75) + }) + + it('should return 0 when counting prints for non-existent device', async () => { + const nonExistentDeviceId = 99999 + const prints = await countPrintsByDeviceId(nonExistentDeviceId) + expect(prints).toBe(0) + }) + }) }) diff --git a/storage/framework/models/PrintDevice.ts b/storage/framework/models/PrintDevice.ts index 678a55bf3c..e8eb5bd0f3 100644 --- a/storage/framework/models/PrintDevice.ts +++ b/storage/framework/models/PrintDevice.ts @@ -6,7 +6,7 @@ export default { table: 'print_devices', primaryKey: 'id', autoIncrement: true, - + hasMany: ['Receipt'], traits: { useUuid: true, useTimestamps: true, diff --git a/storage/framework/models/Receipt.ts b/storage/framework/models/Receipt.ts index ac78ff6075..85eea01281 100644 --- a/storage/framework/models/Receipt.ts +++ b/storage/framework/models/Receipt.ts @@ -6,7 +6,7 @@ export default { table: 'receipts', primaryKey: 'id', autoIncrement: true, - + belongsTo: ['PrintDevice'], traits: { useUuid: true, useTimestamps: true, From e25bc0f109a2b16667ed5181508a53093e23b4e9 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Mon, 31 Mar 2025 22:48:53 +0800 Subject: [PATCH 34/78] chore: wip --- .../core/commerce/src/device/fetch.ts | 21 +++++ .../core/commerce/src/receipts/store.ts | 2 + .../core/commerce/src/tests/device.test.ts | 76 ++++++++++++++++++- .../src/tests/storage/logs/stacks.log | 20 +++++ storage/framework/core/orm/src/utils.ts | 2 +- .../framework/requests/AccessTokenRequest.ts | 2 +- storage/framework/requests/CustomerRequest.ts | 2 +- .../requests/DigitalDeliveryRequest.ts | 2 +- storage/framework/requests/DriverRequest.ts | 2 +- .../framework/requests/LicenseKeyRequest.ts | 4 +- .../framework/requests/PrintDeviceRequest.ts | 2 +- .../requests/ProductVariantRequest.ts | 2 +- storage/framework/requests/ReceiptRequest.ts | 2 +- storage/framework/requests/RequestRequest.ts | 2 +- .../requests/ShippingMethodRequest.ts | 2 +- .../framework/requests/ShippingZoneRequest.ts | 2 +- storage/framework/requests/TaxRateRequest.ts | 4 +- .../requests/WaitlistProductRequest.ts | 4 +- .../requests/WaitlistRestaurantRequest.ts | 4 +- storage/framework/types/requests.d.ts | 72 +++++++++--------- 20 files changed, 173 insertions(+), 56 deletions(-) create mode 100644 storage/framework/core/commerce/src/tests/storage/logs/stacks.log diff --git a/storage/framework/core/commerce/src/device/fetch.ts b/storage/framework/core/commerce/src/device/fetch.ts index f99bbcc567..fc6050fec2 100644 --- a/storage/framework/core/commerce/src/device/fetch.ts +++ b/storage/framework/core/commerce/src/device/fetch.ts @@ -54,3 +54,24 @@ export async function countPrintsByDeviceId(printDeviceId: number): Promise { + const result = await db + .selectFrom('receipts') + .select([ + db.fn.count('id').as('total'), + db.fn.count('id') + .filterWhere('status', '=', 'error') + .as('error_count'), + ]) + .executeTakeFirst() + + if (!result?.total || result.total === 0) { + return 0 + } + + return Number(((result.error_count ?? 0) / result.total) * 100) +} diff --git a/storage/framework/core/commerce/src/receipts/store.ts b/storage/framework/core/commerce/src/receipts/store.ts index 8580476aeb..94b6a353cf 100644 --- a/storage/framework/core/commerce/src/receipts/store.ts +++ b/storage/framework/core/commerce/src/receipts/store.ts @@ -22,6 +22,7 @@ export async function store(request: ReceiptRequestType): Promise('size'), pages: request.get('pages'), duration: request.get('duration'), + print_device_id: request.get('print_device_id'), } receiptData.uuid = randomUUIDv7() @@ -77,6 +78,7 @@ export async function bulkStore(requests: ReceiptRequestType[]): Promise size: request.get('size'), pages: request.get('pages'), duration: request.get('duration'), + print_device_id: request.get('print_device_id'), uuid: randomUUIDv7(), } }) diff --git a/storage/framework/core/commerce/src/tests/device.test.ts b/storage/framework/core/commerce/src/tests/device.test.ts index e75e0d89ca..592f979553 100644 --- a/storage/framework/core/commerce/src/tests/device.test.ts +++ b/storage/framework/core/commerce/src/tests/device.test.ts @@ -2,9 +2,10 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { refreshDatabase } from '@stacksjs/testing' import { bulkDestroy, destroy } from '../device/destroy' import { exportPrintDevices } from '../device/export' -import { countPrintsByDeviceId, countTotalPrints, fetchAll, fetchById } from '../device/fetch' +import { calculateErrorRate, countPrintsByDeviceId, countTotalPrints, fetchAll, fetchById } from '../device/fetch' import { bulkStore, store } from '../device/store' import { update, updatePrintCount, updateStatus } from '../device/update' +import { store as storeReceipt } from '../receipts/store' // Create a request-like object for testing class TestRequest { @@ -456,4 +457,77 @@ describe('Print Device Module', () => { expect(prints).toBe(0) }) }) + + describe('error rate calculation', () => { + it('should calculate 0% error rate when no receipts exist', async () => { + const errorRate = await calculateErrorRate() + expect(errorRate).toBe(0) + }) + + it('should calculate 0% error rate when no receipts have error status', async () => { + // Create a test device first + const deviceData = { + name: 'Test Printer', + mac_address: '00:11:22:33:44:55', + location: 'Office 101', + terminal: 'TERM001', + status: 'online', + last_ping: Date.now(), + print_count: 0, + } + + const device = await store(new TestRequest(deviceData) as any) + const deviceId = device?.id !== undefined ? Number(device.id) : undefined + + expect(deviceId).toBeDefined() + if (!deviceId) { + throw new Error('Failed to create test device') + } + + // Create some test receipts with non-error statuses + // Note: You'll need to implement the receipt creation logic here + // This is a placeholder for the actual receipt creation code + // await createReceipt(deviceId, 'success') + // await createReceipt(deviceId, 'success') + // await createReceipt(deviceId, 'success') + + const errorRate = await calculateErrorRate() + expect(errorRate).toBe(0) + }) + + it('should calculate correct error rate percentage from receipts', async () => { + // Create a test device first + const deviceData = { + name: 'Test Printer', + mac_address: '00:11:22:33:44:55', + location: 'Office 101', + terminal: 'TERM001', + status: 'online', + last_ping: Date.now(), + print_count: 0, + } + + const device = await store(new TestRequest(deviceData) as any) + const deviceId = device?.id !== undefined ? Number(device.id) : undefined + + expect(deviceId).toBeDefined() + if (!deviceId) { + throw new Error('Failed to create test device') + } + + await storeReceipt({ + printer: 'Main Printer', + document: 'Test Document', + timestamp: Date.now(), + status: 'error', + duration: 100, + size: 100, + pages: 1, + print_device_id: deviceId, + }) + + const errorRate = await calculateErrorRate() + expect(errorRate).toBe(50) // 2 out of 4 receipts have error status + }) + }) }) diff --git a/storage/framework/core/commerce/src/tests/storage/logs/stacks.log b/storage/framework/core/commerce/src/tests/storage/logs/stacks.log new file mode 100644 index 0000000000..caf39b1a7e --- /dev/null +++ b/storage/framework/core/commerce/src/tests/storage/logs/stacks.log @@ -0,0 +1,20 @@ +[2025-03-31T14:24:28.750Z] DEBUG: Using database driver: sqlite +[2025-03-31T14:24:28.955Z] INFO: Migrating database... +[2025-03-31T14:24:29.128Z] INFO: Migrating database... +[2025-03-31T14:24:29.271Z] INFO: Migrating database... +[2025-03-31T14:24:29.415Z] INFO: Migrating database... +[2025-03-31T14:24:29.572Z] INFO: Migrating database... +[2025-03-31T14:24:29.715Z] INFO: Migrating database... +[2025-03-31T14:24:29.861Z] INFO: Migrating database... +[2025-03-31T14:24:30.012Z] INFO: Migrating database... +[2025-03-31T14:24:30.160Z] INFO: Migrating database... +[2025-03-31T14:24:30.303Z] INFO: Migrating database... +[2025-03-31T14:24:30.462Z] INFO: Migrating database... +[2025-03-31T14:24:30.651Z] INFO: Migrating database... +[2025-03-31T14:24:30.793Z] INFO: Migrating database... +[2025-03-31T14:24:30.934Z] INFO: Migrating database... +[2025-03-31T14:24:31.093Z] INFO: Migrating database... +[2025-03-31T14:24:31.256Z] INFO: Migrating database... +[2025-03-31T14:24:31.402Z] INFO: Migrating database... +[2025-03-31T14:24:31.556Z] INFO: Migrating database... +[2025-03-31T14:24:31.706Z] INFO: Migrating database... diff --git a/storage/framework/core/orm/src/utils.ts b/storage/framework/core/orm/src/utils.ts index 7c3a1605f3..48ac26dec6 100644 --- a/storage/framework/core/orm/src/utils.ts +++ b/storage/framework/core/orm/src/utils.ts @@ -686,7 +686,7 @@ export async function writeModelRequest(): Promise { // Group attributes by their entity type for (const attribute of attributes) { - const entity = attribute.fieldArray?.entity === 'enum' ? 'string[]' : attribute.fieldArray?.entity + const entity = attribute.fieldArray?.entity === 'enum' ? 'string[] | string' : attribute.fieldArray?.entity let defaultValue: string | boolean | number | string[] = `''` if (attribute.fieldArray?.entity === 'boolean') diff --git a/storage/framework/requests/AccessTokenRequest.ts b/storage/framework/requests/AccessTokenRequest.ts index 5e07299aa3..3740cf97b7 100644 --- a/storage/framework/requests/AccessTokenRequest.ts +++ b/storage/framework/requests/AccessTokenRequest.ts @@ -16,7 +16,7 @@ interface RequestDataAccessToken { name: string token: string plain_text_token: string - abilities: string[] + abilities: string[] | string last_used_at: date expires_at: date revoked_at: date diff --git a/storage/framework/requests/CustomerRequest.ts b/storage/framework/requests/CustomerRequest.ts index f5bc96692c..2890e8d491 100644 --- a/storage/framework/requests/CustomerRequest.ts +++ b/storage/framework/requests/CustomerRequest.ts @@ -18,7 +18,7 @@ interface RequestDataCustomer { phone: string total_spent: number last_order: string - status: string[] + status: string[] | string avatar: string user_id: number created_at?: Date diff --git a/storage/framework/requests/DigitalDeliveryRequest.ts b/storage/framework/requests/DigitalDeliveryRequest.ts index 47bb673a42..34ee347587 100644 --- a/storage/framework/requests/DigitalDeliveryRequest.ts +++ b/storage/framework/requests/DigitalDeliveryRequest.ts @@ -19,7 +19,7 @@ interface RequestDataDigitalDelivery { expiry_days: number requires_login: boolean automatic_delivery: boolean - status: string[] + status: string[] | string created_at?: Date updated_at?: Date } diff --git a/storage/framework/requests/DriverRequest.ts b/storage/framework/requests/DriverRequest.ts index 013e4db4aa..5026158471 100644 --- a/storage/framework/requests/DriverRequest.ts +++ b/storage/framework/requests/DriverRequest.ts @@ -17,7 +17,7 @@ interface RequestDataDriver { phone: string vehicle_number: string license: string - status: string[] + status: string[] | string user_id: number created_at?: Date updated_at?: Date diff --git a/storage/framework/requests/LicenseKeyRequest.ts b/storage/framework/requests/LicenseKeyRequest.ts index 0e8899946f..c664263d46 100644 --- a/storage/framework/requests/LicenseKeyRequest.ts +++ b/storage/framework/requests/LicenseKeyRequest.ts @@ -14,9 +14,9 @@ interface CustomAttributes { interface RequestDataLicenseKey { id: number key: string - template: string[] + template: string[] | string expiry_date: date - status: string[] + status: string[] | string customer_id: number product_id: number order_id: number diff --git a/storage/framework/requests/PrintDeviceRequest.ts b/storage/framework/requests/PrintDeviceRequest.ts index b6404530de..c0bfecec19 100644 --- a/storage/framework/requests/PrintDeviceRequest.ts +++ b/storage/framework/requests/PrintDeviceRequest.ts @@ -17,7 +17,7 @@ interface RequestDataPrintDevice { mac_address: string location: string terminal: string - status: string[] + status: string[] | string last_ping: number print_count: number created_at?: Date diff --git a/storage/framework/requests/ProductVariantRequest.ts b/storage/framework/requests/ProductVariantRequest.ts index acb656089b..7bd2ec4b49 100644 --- a/storage/framework/requests/ProductVariantRequest.ts +++ b/storage/framework/requests/ProductVariantRequest.ts @@ -17,7 +17,7 @@ interface RequestDataProductVariant { type: string description: string options: string - status: string[] + status: string[] | string product_id: number created_at?: Date updated_at?: Date diff --git a/storage/framework/requests/ReceiptRequest.ts b/storage/framework/requests/ReceiptRequest.ts index 223a2c3a9d..1184169455 100644 --- a/storage/framework/requests/ReceiptRequest.ts +++ b/storage/framework/requests/ReceiptRequest.ts @@ -16,7 +16,7 @@ interface RequestDataReceipt { printer: string document: string timestamp: number - status: string[] + status: string[] | string size: number pages: number duration: number diff --git a/storage/framework/requests/RequestRequest.ts b/storage/framework/requests/RequestRequest.ts index 0ecc1129fe..a7f854f577 100644 --- a/storage/framework/requests/RequestRequest.ts +++ b/storage/framework/requests/RequestRequest.ts @@ -13,7 +13,7 @@ interface CustomAttributes { } interface RequestDataRequest { id: number - method: string[] + method: string[] | string path: string status_code: number duration_ms: number diff --git a/storage/framework/requests/ShippingMethodRequest.ts b/storage/framework/requests/ShippingMethodRequest.ts index 23e2ca4945..92d4d6d082 100644 --- a/storage/framework/requests/ShippingMethodRequest.ts +++ b/storage/framework/requests/ShippingMethodRequest.ts @@ -17,7 +17,7 @@ interface RequestDataShippingMethod { description: string base_rate: number free_shipping: number - status: string[] + status: string[] | string created_at?: Date updated_at?: Date } diff --git a/storage/framework/requests/ShippingZoneRequest.ts b/storage/framework/requests/ShippingZoneRequest.ts index d39d3510d1..3eeca38fc6 100644 --- a/storage/framework/requests/ShippingZoneRequest.ts +++ b/storage/framework/requests/ShippingZoneRequest.ts @@ -17,7 +17,7 @@ interface RequestDataShippingZone { countries: string regions: string postal_codes: string - status: string[] + status: string[] | string shipping_method_id: number created_at?: Date updated_at?: Date diff --git a/storage/framework/requests/TaxRateRequest.ts b/storage/framework/requests/TaxRateRequest.ts index b62114d0a0..1f89ed5dee 100644 --- a/storage/framework/requests/TaxRateRequest.ts +++ b/storage/framework/requests/TaxRateRequest.ts @@ -17,8 +17,8 @@ interface RequestDataTaxRate { rate: number type: string country: string - region: string[] - status: string[] + region: string[] | string + status: string[] | string is_default: boolean created_at?: Date updated_at?: Date diff --git a/storage/framework/requests/WaitlistProductRequest.ts b/storage/framework/requests/WaitlistProductRequest.ts index 292a7d2354..56badb9ceb 100644 --- a/storage/framework/requests/WaitlistProductRequest.ts +++ b/storage/framework/requests/WaitlistProductRequest.ts @@ -17,10 +17,10 @@ interface RequestDataWaitlistProduct { email: string phone: string party_size: number - notification_preference: string[] + notification_preference: string[] | string source: string notes: string - status: string[] + status: string[] | string notified_at: string purchased_at: string cancelled_at: string diff --git a/storage/framework/requests/WaitlistRestaurantRequest.ts b/storage/framework/requests/WaitlistRestaurantRequest.ts index bac630281a..25450d3559 100644 --- a/storage/framework/requests/WaitlistRestaurantRequest.ts +++ b/storage/framework/requests/WaitlistRestaurantRequest.ts @@ -18,8 +18,8 @@ interface RequestDataWaitlistRestaurant { phone: string party_size: number check_in_time: string - table_preference: string[] - status: string[] + table_preference: string[] | string + status: string[] | string quoted_wait_time: number actual_wait_time: number queue_position: number diff --git a/storage/framework/types/requests.d.ts b/storage/framework/types/requests.d.ts index 5cd725565f..b2197d5c4e 100644 --- a/storage/framework/types/requests.d.ts +++ b/storage/framework/types/requests.d.ts @@ -55,7 +55,7 @@ interface RequestDataAccessToken { name: string token: string plain_text_token: string - abilities: string[] + abilities: string[] | string last_used_at: date expires_at: date revoked_at: date @@ -74,7 +74,7 @@ export interface AccessTokenRequestType extends Request { name: string token: string plain_text_token: string - abilities: string[] + abilities: string[] | string last_used_at: date expires_at: date revoked_at: date @@ -234,7 +234,7 @@ interface RequestDataPrintDevice { mac_address: string location: string terminal: string - status: string[] + status: string[] | string last_ping: number print_count: number created_at?: Date @@ -249,7 +249,7 @@ export interface PrintDeviceRequestType extends Request { mac_address: string location: string terminal: string - status: string[] + status: string[] | string last_ping: number print_count: number created_at?: Date @@ -330,7 +330,7 @@ interface RequestDataDriver { phone: string vehicle_number: string license: string - status: string[] + status: string[] | string user_id: number created_at?: Date updated_at?: Date @@ -344,7 +344,7 @@ export interface DriverRequestType extends Request { phone: string vehicle_number: string license: string - status: string[] + status: string[] | string user_id: number created_at?: Date updated_at?: Date @@ -356,10 +356,10 @@ interface RequestDataWaitlistProduct { email: string phone: string party_size: number - notification_preference: string[] + notification_preference: string[] | string source: string notes: string - status: string[] + status: string[] | string notified_at: string purchased_at: string cancelled_at: string @@ -377,10 +377,10 @@ export interface WaitlistProductRequestType extends Request { email: string phone: string party_size: number - notification_preference: string[] + notification_preference: string[] | string source: string notes: string - status: string[] + status: string[] | string notified_at: string purchased_at: string cancelled_at: string @@ -398,7 +398,7 @@ interface RequestDataDigitalDelivery { expiry_days: number requires_login: boolean automatic_delivery: boolean - status: string[] + status: string[] | string created_at?: Date updated_at?: Date } @@ -413,7 +413,7 @@ export interface DigitalDeliveryRequestType extends Request { expiry_days: number requires_login: boolean automatic_delivery: boolean - status: string[] + status: string[] | string created_at?: Date updated_at?: Date } @@ -468,7 +468,7 @@ interface RequestDataShippingZone { countries: string regions: string postal_codes: string - status: string[] + status: string[] | string shipping_method_id: number created_at?: Date updated_at?: Date @@ -482,7 +482,7 @@ export interface ShippingZoneRequestType extends Request { countries: string regions: string postal_codes: string - status: string[] + status: string[] | string shipping_method_id: number created_at?: Date updated_at?: Date @@ -495,7 +495,7 @@ interface RequestDataCustomer { phone: string total_spent: number last_order: string - status: string[] + status: string[] | string avatar: string user_id: number created_at?: Date @@ -511,7 +511,7 @@ export interface CustomerRequestType extends Request { phone: string total_spent: number last_order: string - status: string[] + status: string[] | string avatar: string user_id: number created_at?: Date @@ -559,7 +559,7 @@ interface RequestDataReceipt { printer: string document: string timestamp: number - status: string[] + status: string[] | string size: number pages: number duration: number @@ -575,7 +575,7 @@ export interface ReceiptRequestType extends Request { printer: string document: string timestamp: number - status: string[] + status: string[] | string size: number pages: number duration: number @@ -590,7 +590,7 @@ interface RequestDataProductVariant { type: string description: string options: string - status: string[] + status: string[] | string product_id: number created_at?: Date updated_at?: Date @@ -604,7 +604,7 @@ export interface ProductVariantRequestType extends Request { type: string description: string options: string - status: string[] + status: string[] | string product_id: number created_at?: Date updated_at?: Date @@ -613,9 +613,9 @@ export interface ProductVariantRequestType extends Request { interface RequestDataLicenseKey { id: number key: string - template: string[] + template: string[] | string expiry_date: date - status: string[] + status: string[] | string customer_id: number product_id: number order_id: number @@ -628,9 +628,9 @@ export interface LicenseKeyRequestType extends Request { all: () => RequestDataLicenseKey id: number key: string - template: string[] + template: string[] | string expiry_date: date - status: string[] + status: string[] | string customer_id: number product_id: number order_id: number @@ -645,8 +645,8 @@ interface RequestDataWaitlistRestaurant { phone: string party_size: number check_in_time: string - table_preference: string[] - status: string[] + table_preference: string[] | string + status: string[] | string quoted_wait_time: number actual_wait_time: number queue_position: number @@ -667,8 +667,8 @@ export interface WaitlistRestaurantRequestType extends Request { phone: string party_size: number check_in_time: string - table_preference: string[] - status: string[] + table_preference: string[] | string + status: string[] | string quoted_wait_time: number actual_wait_time: number queue_position: number @@ -882,8 +882,8 @@ interface RequestDataTaxRate { rate: number type: string country: string - region: string[] - status: string[] + region: string[] | string + status: string[] | string is_default: boolean created_at?: Date updated_at?: Date @@ -897,8 +897,8 @@ export interface TaxRateRequestType extends Request { rate: number type: string country: string - region: string[] - status: string[] + region: string[] | string + status: string[] | string is_default: boolean created_at?: Date updated_at?: Date @@ -1030,7 +1030,7 @@ interface RequestDataShippingMethod { description: string base_rate: number free_shipping: number - status: string[] + status: string[] | string created_at?: Date updated_at?: Date } @@ -1043,7 +1043,7 @@ export interface ShippingMethodRequestType extends Request { description: string base_rate: number free_shipping: number - status: string[] + status: string[] | string created_at?: Date updated_at?: Date } @@ -1184,7 +1184,7 @@ export interface PaymentTransactionRequestType extends Request { interface RequestDataRequest { id: number - method: string[] + method: string[] | string path: string status_code: number duration_ms: number @@ -1201,7 +1201,7 @@ export interface RequestRequestType extends Request { get: (key: string, defaultValue?: T) => T all: () => RequestDataRequest id: number - method: string[] + method: string[] | string path: string status_code: number duration_ms: number From a084c9c9fb9b6b27376a9694f8fccaf351736e3d Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Mon, 31 Mar 2025 22:57:40 +0800 Subject: [PATCH 35/78] chore: wip --- .../core/commerce/src/tests/device.test.ts | 77 ++++++++++++++++--- 1 file changed, 68 insertions(+), 9 deletions(-) diff --git a/storage/framework/core/commerce/src/tests/device.test.ts b/storage/framework/core/commerce/src/tests/device.test.ts index 592f979553..ecda42dff8 100644 --- a/storage/framework/core/commerce/src/tests/device.test.ts +++ b/storage/framework/core/commerce/src/tests/device.test.ts @@ -484,12 +484,38 @@ describe('Print Device Module', () => { throw new Error('Failed to create test device') } - // Create some test receipts with non-error statuses - // Note: You'll need to implement the receipt creation logic here - // This is a placeholder for the actual receipt creation code - // await createReceipt(deviceId, 'success') - // await createReceipt(deviceId, 'success') - // await createReceipt(deviceId, 'success') + await storeReceipt(new TestRequest({ + printer: 'Main Printer', + document: 'Test Document', + timestamp: Date.now(), + status: 'success', + duration: 100, + size: 100, + pages: 1, + print_device_id: deviceId, + }) as any) + + await storeReceipt(new TestRequest({ + printer: 'Main2 Printer', + document: 'Test Document', + timestamp: Date.now(), + status: 'success', + duration: 100, + size: 100, + pages: 1, + print_device_id: deviceId, + }) as any) + + await storeReceipt(new TestRequest({ + printer: 'Main3 Printer', + document: 'Test Document', + timestamp: Date.now(), + status: 'success', + duration: 100, + size: 100, + pages: 1, + print_device_id: deviceId, + }) as any) const errorRate = await calculateErrorRate() expect(errorRate).toBe(0) @@ -515,8 +541,8 @@ describe('Print Device Module', () => { throw new Error('Failed to create test device') } - await storeReceipt({ - printer: 'Main Printer', + await storeReceipt(new TestRequest({ + printer: 'Main12 Printer', document: 'Test Document', timestamp: Date.now(), status: 'error', @@ -524,7 +550,40 @@ describe('Print Device Module', () => { size: 100, pages: 1, print_device_id: deviceId, - }) + }) as any) + + await storeReceipt(new TestRequest({ + printer: 'Main34 Printer', + document: 'Test Document', + timestamp: Date.now(), + status: 'success', + duration: 100, + size: 100, + pages: 1, + print_device_id: deviceId, + }) as any) + + await storeReceipt(new TestRequest({ + printer: 'Main2 Printer', + document: 'Test Document', + timestamp: Date.now(), + status: 'error', + duration: 100, + size: 100, + pages: 1, + print_device_id: deviceId, + }) as any) + + await storeReceipt(new TestRequest({ + printer: 'Main33 Printer', + document: 'Test Document', + timestamp: Date.now(), + status: 'success', + duration: 100, + size: 100, + pages: 1, + print_device_id: deviceId, + }) as any) const errorRate = await calculateErrorRate() expect(errorRate).toBe(50) // 2 out of 4 receipts have error status From 335b3fad8fa5900000abc34bc97dd219cca16ade Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Mon, 31 Mar 2025 23:16:24 +0800 Subject: [PATCH 36/78] chore: wip --- app/Models/User.ts | 13 ++++- ...=> 1743433898841-create-projects-table.ts} | 0 ...3898866-create-subscriber_emails-table.ts} | 2 +- ...88-create-personal_access_tokens-table.ts} | 0 ... 1743433898891-create-team_users-table.ts} | 0 ...ts => 1743433898910-create-teams-table.ts} | 0 ...1743433898930-create-subscribers-table.ts} | 0 ...1743433898951-create-deployments-table.ts} | 0 ...=> 1743433898971-create-releases-table.ts} | 0 ...=> 1743433898990-create-passkeys-table.ts} | 0 ...ts => 1743433898991-create-users-table.ts} | 3 + ...ts => 1743433899011-create-posts-table.ts} | 0 ...43433899034-create-print_devices-table.ts} | 0 ... 1743433899054-create-categories-table.ts} | 0 ...=> 1743433899074-create-payments-table.ts} | 0 ... => 1743433899094-create-drivers-table.ts} | 0 ...3899113-create-waitlist_products-table.ts} | 0 ...899134-create-digital_deliveries-table.ts} | 0 ...43433899154-create-manufacturers-table.ts} | 0 ...1743433899173-create-order_items-table.ts} | 0 ...3433899195-create-shipping_zones-table.ts} | 0 ...> 1743433899213-create-customers-table.ts} | 0 ...=> 1743433899231-create-products-table.ts} | 0 ...=> 1743433899251-create-receipts-table.ts} | 0 ...33899272-create-product_variants-table.ts} | 0 ...743433899291-create-license_keys-table.ts} | 0 ...9311-create-waitlist_restaurants-table.ts} | 0 ... => 1743433899330-create-reviews-table.ts} | 0 ...43433899349-create-product_units-table.ts} | 0 ... 1743433899369-create-gift_cards-table.ts} | 0 ...s => 1743433899388-create-orders-table.ts} | 0 ... => 1743433899412-create-coupons-table.ts} | 0 ...> 1743433899440-create-tax_rates-table.ts} | 0 ...743433899465-create-transactions-table.ts} | 0 ...3433899490-create-loyalty_points-table.ts} | 0 ...43433899525-create-product_items-table.ts} | 0 ...433899555-create-loyalty_rewards-table.ts} | 0 ...33899576-create-shipping_methods-table.ts} | 0 ...3433899602-create-shipping_rates-table.ts} | 0 ...433899623-create-delivery_routes-table.ts} | 0 ...1743433899645-create-failed_jobs-table.ts} | 0 ...433899666-create-payment_methods-table.ts} | 0 ...9687-create-payment_transactions-table.ts} | 0 ...=> 1743433899708-create-requests-table.ts} | 2 +- ....ts => 1743433899727-create-jobs-table.ts} | 0 ...43433899747-create-subscriptions-table.ts} | 0 ...33899767-create-payment_products-table.ts} | 0 ...s => 1743433899787-create-errors-table.ts} | 0 .../core/database/src/drivers/sqlite.ts | 57 +++++++++++++++---- storage/framework/core/types/src/model.ts | 8 ++- storage/framework/models/User.ts | 13 ++++- 51 files changed, 83 insertions(+), 15 deletions(-) rename database/migrations/{1743429399884-create-projects-table.ts => 1743433898841-create-projects-table.ts} (100%) rename database/migrations/{1743429399907-create-subscriber_emails-table.ts => 1743433898866-create-subscriber_emails-table.ts} (100%) rename database/migrations/{1743429399932-create-personal_access_tokens-table.ts => 1743433898888-create-personal_access_tokens-table.ts} (100%) rename database/migrations/{1743429399935-create-team_users-table.ts => 1743433898891-create-team_users-table.ts} (100%) rename database/migrations/{1743429399952-create-teams-table.ts => 1743433898910-create-teams-table.ts} (100%) rename database/migrations/{1743429399974-create-subscribers-table.ts => 1743433898930-create-subscribers-table.ts} (100%) rename database/migrations/{1743429399993-create-deployments-table.ts => 1743433898951-create-deployments-table.ts} (100%) rename database/migrations/{1743429400014-create-releases-table.ts => 1743433898971-create-releases-table.ts} (100%) rename database/migrations/{1743429400032-create-passkeys-table.ts => 1743433898990-create-passkeys-table.ts} (100%) rename database/migrations/{1743429400033-create-users-table.ts => 1743433898991-create-users-table.ts} (80%) rename database/migrations/{1743429400053-create-posts-table.ts => 1743433899011-create-posts-table.ts} (100%) rename database/migrations/{1743429400073-create-print_devices-table.ts => 1743433899034-create-print_devices-table.ts} (100%) rename database/migrations/{1743429400092-create-categories-table.ts => 1743433899054-create-categories-table.ts} (100%) rename database/migrations/{1743429400112-create-payments-table.ts => 1743433899074-create-payments-table.ts} (100%) rename database/migrations/{1743429400132-create-drivers-table.ts => 1743433899094-create-drivers-table.ts} (100%) rename database/migrations/{1743429400151-create-waitlist_products-table.ts => 1743433899113-create-waitlist_products-table.ts} (100%) rename database/migrations/{1743429400171-create-digital_deliveries-table.ts => 1743433899134-create-digital_deliveries-table.ts} (100%) rename database/migrations/{1743429400191-create-manufacturers-table.ts => 1743433899154-create-manufacturers-table.ts} (100%) rename database/migrations/{1743429400210-create-order_items-table.ts => 1743433899173-create-order_items-table.ts} (100%) rename database/migrations/{1743429400229-create-shipping_zones-table.ts => 1743433899195-create-shipping_zones-table.ts} (100%) rename database/migrations/{1743429400247-create-customers-table.ts => 1743433899213-create-customers-table.ts} (100%) rename database/migrations/{1743429400265-create-products-table.ts => 1743433899231-create-products-table.ts} (100%) rename database/migrations/{1743429400285-create-receipts-table.ts => 1743433899251-create-receipts-table.ts} (100%) rename database/migrations/{1743429400308-create-product_variants-table.ts => 1743433899272-create-product_variants-table.ts} (100%) rename database/migrations/{1743429400328-create-license_keys-table.ts => 1743433899291-create-license_keys-table.ts} (100%) rename database/migrations/{1743429400349-create-waitlist_restaurants-table.ts => 1743433899311-create-waitlist_restaurants-table.ts} (100%) rename database/migrations/{1743429400375-create-reviews-table.ts => 1743433899330-create-reviews-table.ts} (100%) rename database/migrations/{1743429400398-create-product_units-table.ts => 1743433899349-create-product_units-table.ts} (100%) rename database/migrations/{1743429400419-create-gift_cards-table.ts => 1743433899369-create-gift_cards-table.ts} (100%) rename database/migrations/{1743429400441-create-orders-table.ts => 1743433899388-create-orders-table.ts} (100%) rename database/migrations/{1743429400463-create-coupons-table.ts => 1743433899412-create-coupons-table.ts} (100%) rename database/migrations/{1743429400484-create-tax_rates-table.ts => 1743433899440-create-tax_rates-table.ts} (100%) rename database/migrations/{1743429400505-create-transactions-table.ts => 1743433899465-create-transactions-table.ts} (100%) rename database/migrations/{1743429400527-create-loyalty_points-table.ts => 1743433899490-create-loyalty_points-table.ts} (100%) rename database/migrations/{1743429400547-create-product_items-table.ts => 1743433899525-create-product_items-table.ts} (100%) rename database/migrations/{1743429400567-create-loyalty_rewards-table.ts => 1743433899555-create-loyalty_rewards-table.ts} (100%) rename database/migrations/{1743429400586-create-shipping_methods-table.ts => 1743433899576-create-shipping_methods-table.ts} (100%) rename database/migrations/{1743429400608-create-shipping_rates-table.ts => 1743433899602-create-shipping_rates-table.ts} (100%) rename database/migrations/{1743429400627-create-delivery_routes-table.ts => 1743433899623-create-delivery_routes-table.ts} (100%) rename database/migrations/{1743429400648-create-failed_jobs-table.ts => 1743433899645-create-failed_jobs-table.ts} (100%) rename database/migrations/{1743429400668-create-payment_methods-table.ts => 1743433899666-create-payment_methods-table.ts} (100%) rename database/migrations/{1743429400687-create-payment_transactions-table.ts => 1743433899687-create-payment_transactions-table.ts} (100%) rename database/migrations/{1743429400706-create-requests-table.ts => 1743433899708-create-requests-table.ts} (100%) rename database/migrations/{1743429400726-create-jobs-table.ts => 1743433899727-create-jobs-table.ts} (100%) rename database/migrations/{1743429400744-create-subscriptions-table.ts => 1743433899747-create-subscriptions-table.ts} (100%) rename database/migrations/{1743429400764-create-payment_products-table.ts => 1743433899767-create-payment_products-table.ts} (100%) rename database/migrations/{1743429400784-create-errors-table.ts => 1743433899787-create-errors-table.ts} (100%) diff --git a/app/Models/User.ts b/app/Models/User.ts index 8eb97a7865..d30ebb2175 100644 --- a/app/Models/User.ts +++ b/app/Models/User.ts @@ -8,6 +8,18 @@ export default { primaryKey: 'id', // defaults to `id` autoIncrement: true, // defaults to true + // Define composite indexes + indexes: [ + { + name: 'users_email_name_index', + columns: ['email', 'name'], + }, + { + name: 'users_job_title_status_index', + columns: ['job_title', 'created_at'], + }, + ], + traits: { useAuth: { usePasskey: true, @@ -15,7 +27,6 @@ export default { useUuid: true, useTimestamps: true, // defaults to true, `timestampable` used as an alias useSearch: { - displayable: ['id', 'job_title', 'name', 'email'], // the fields to become d (defaults to all fields) searchable: ['job_title', 'name', 'email'], // the fields to become searchable (defaults to all fields) sortable: ['created_at', 'updated_at'], // the fields to become sortable (defaults to all fields) diff --git a/database/migrations/1743429399884-create-projects-table.ts b/database/migrations/1743433898841-create-projects-table.ts similarity index 100% rename from database/migrations/1743429399884-create-projects-table.ts rename to database/migrations/1743433898841-create-projects-table.ts diff --git a/database/migrations/1743429399907-create-subscriber_emails-table.ts b/database/migrations/1743433898866-create-subscriber_emails-table.ts similarity index 100% rename from database/migrations/1743429399907-create-subscriber_emails-table.ts rename to database/migrations/1743433898866-create-subscriber_emails-table.ts index f004835ee0..74c7cb49b3 100644 --- a/database/migrations/1743429399907-create-subscriber_emails-table.ts +++ b/database/migrations/1743433898866-create-subscriber_emails-table.ts @@ -6,8 +6,8 @@ export async function up(db: Database) { .createTable('subscriber_emails') .addColumn('id', 'integer', col => col.primaryKey().autoIncrement()) .addColumn('email', 'text', col => col.unique().notNull()) + .addColumn('deleted_at', 'timestamp') .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') - .addColumn('deleted_at', 'timestamp') .execute() } diff --git a/database/migrations/1743429399932-create-personal_access_tokens-table.ts b/database/migrations/1743433898888-create-personal_access_tokens-table.ts similarity index 100% rename from database/migrations/1743429399932-create-personal_access_tokens-table.ts rename to database/migrations/1743433898888-create-personal_access_tokens-table.ts diff --git a/database/migrations/1743429399935-create-team_users-table.ts b/database/migrations/1743433898891-create-team_users-table.ts similarity index 100% rename from database/migrations/1743429399935-create-team_users-table.ts rename to database/migrations/1743433898891-create-team_users-table.ts diff --git a/database/migrations/1743429399952-create-teams-table.ts b/database/migrations/1743433898910-create-teams-table.ts similarity index 100% rename from database/migrations/1743429399952-create-teams-table.ts rename to database/migrations/1743433898910-create-teams-table.ts diff --git a/database/migrations/1743429399974-create-subscribers-table.ts b/database/migrations/1743433898930-create-subscribers-table.ts similarity index 100% rename from database/migrations/1743429399974-create-subscribers-table.ts rename to database/migrations/1743433898930-create-subscribers-table.ts diff --git a/database/migrations/1743429399993-create-deployments-table.ts b/database/migrations/1743433898951-create-deployments-table.ts similarity index 100% rename from database/migrations/1743429399993-create-deployments-table.ts rename to database/migrations/1743433898951-create-deployments-table.ts diff --git a/database/migrations/1743429400014-create-releases-table.ts b/database/migrations/1743433898971-create-releases-table.ts similarity index 100% rename from database/migrations/1743429400014-create-releases-table.ts rename to database/migrations/1743433898971-create-releases-table.ts diff --git a/database/migrations/1743429400032-create-passkeys-table.ts b/database/migrations/1743433898990-create-passkeys-table.ts similarity index 100% rename from database/migrations/1743429400032-create-passkeys-table.ts rename to database/migrations/1743433898990-create-passkeys-table.ts diff --git a/database/migrations/1743429400033-create-users-table.ts b/database/migrations/1743433898991-create-users-table.ts similarity index 80% rename from database/migrations/1743429400033-create-users-table.ts rename to database/migrations/1743433898991-create-users-table.ts index 11acc1b25b..efd1c7a80e 100644 --- a/database/migrations/1743429400033-create-users-table.ts +++ b/database/migrations/1743433898991-create-users-table.ts @@ -19,4 +19,7 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('users_team_id_index').on('users').column('team_id').execute() + + await db.schema.createIndex('users_email_name_index').on('users').columns(['email', 'name']).execute() + await db.schema.createIndex('users_job_title_status_index').on('users').columns(['job_title', 'created_at']).execute() } diff --git a/database/migrations/1743429400053-create-posts-table.ts b/database/migrations/1743433899011-create-posts-table.ts similarity index 100% rename from database/migrations/1743429400053-create-posts-table.ts rename to database/migrations/1743433899011-create-posts-table.ts diff --git a/database/migrations/1743429400073-create-print_devices-table.ts b/database/migrations/1743433899034-create-print_devices-table.ts similarity index 100% rename from database/migrations/1743429400073-create-print_devices-table.ts rename to database/migrations/1743433899034-create-print_devices-table.ts diff --git a/database/migrations/1743429400092-create-categories-table.ts b/database/migrations/1743433899054-create-categories-table.ts similarity index 100% rename from database/migrations/1743429400092-create-categories-table.ts rename to database/migrations/1743433899054-create-categories-table.ts diff --git a/database/migrations/1743429400112-create-payments-table.ts b/database/migrations/1743433899074-create-payments-table.ts similarity index 100% rename from database/migrations/1743429400112-create-payments-table.ts rename to database/migrations/1743433899074-create-payments-table.ts diff --git a/database/migrations/1743429400132-create-drivers-table.ts b/database/migrations/1743433899094-create-drivers-table.ts similarity index 100% rename from database/migrations/1743429400132-create-drivers-table.ts rename to database/migrations/1743433899094-create-drivers-table.ts diff --git a/database/migrations/1743429400151-create-waitlist_products-table.ts b/database/migrations/1743433899113-create-waitlist_products-table.ts similarity index 100% rename from database/migrations/1743429400151-create-waitlist_products-table.ts rename to database/migrations/1743433899113-create-waitlist_products-table.ts diff --git a/database/migrations/1743429400171-create-digital_deliveries-table.ts b/database/migrations/1743433899134-create-digital_deliveries-table.ts similarity index 100% rename from database/migrations/1743429400171-create-digital_deliveries-table.ts rename to database/migrations/1743433899134-create-digital_deliveries-table.ts diff --git a/database/migrations/1743429400191-create-manufacturers-table.ts b/database/migrations/1743433899154-create-manufacturers-table.ts similarity index 100% rename from database/migrations/1743429400191-create-manufacturers-table.ts rename to database/migrations/1743433899154-create-manufacturers-table.ts diff --git a/database/migrations/1743429400210-create-order_items-table.ts b/database/migrations/1743433899173-create-order_items-table.ts similarity index 100% rename from database/migrations/1743429400210-create-order_items-table.ts rename to database/migrations/1743433899173-create-order_items-table.ts diff --git a/database/migrations/1743429400229-create-shipping_zones-table.ts b/database/migrations/1743433899195-create-shipping_zones-table.ts similarity index 100% rename from database/migrations/1743429400229-create-shipping_zones-table.ts rename to database/migrations/1743433899195-create-shipping_zones-table.ts diff --git a/database/migrations/1743429400247-create-customers-table.ts b/database/migrations/1743433899213-create-customers-table.ts similarity index 100% rename from database/migrations/1743429400247-create-customers-table.ts rename to database/migrations/1743433899213-create-customers-table.ts diff --git a/database/migrations/1743429400265-create-products-table.ts b/database/migrations/1743433899231-create-products-table.ts similarity index 100% rename from database/migrations/1743429400265-create-products-table.ts rename to database/migrations/1743433899231-create-products-table.ts diff --git a/database/migrations/1743429400285-create-receipts-table.ts b/database/migrations/1743433899251-create-receipts-table.ts similarity index 100% rename from database/migrations/1743429400285-create-receipts-table.ts rename to database/migrations/1743433899251-create-receipts-table.ts diff --git a/database/migrations/1743429400308-create-product_variants-table.ts b/database/migrations/1743433899272-create-product_variants-table.ts similarity index 100% rename from database/migrations/1743429400308-create-product_variants-table.ts rename to database/migrations/1743433899272-create-product_variants-table.ts diff --git a/database/migrations/1743429400328-create-license_keys-table.ts b/database/migrations/1743433899291-create-license_keys-table.ts similarity index 100% rename from database/migrations/1743429400328-create-license_keys-table.ts rename to database/migrations/1743433899291-create-license_keys-table.ts diff --git a/database/migrations/1743429400349-create-waitlist_restaurants-table.ts b/database/migrations/1743433899311-create-waitlist_restaurants-table.ts similarity index 100% rename from database/migrations/1743429400349-create-waitlist_restaurants-table.ts rename to database/migrations/1743433899311-create-waitlist_restaurants-table.ts diff --git a/database/migrations/1743429400375-create-reviews-table.ts b/database/migrations/1743433899330-create-reviews-table.ts similarity index 100% rename from database/migrations/1743429400375-create-reviews-table.ts rename to database/migrations/1743433899330-create-reviews-table.ts diff --git a/database/migrations/1743429400398-create-product_units-table.ts b/database/migrations/1743433899349-create-product_units-table.ts similarity index 100% rename from database/migrations/1743429400398-create-product_units-table.ts rename to database/migrations/1743433899349-create-product_units-table.ts diff --git a/database/migrations/1743429400419-create-gift_cards-table.ts b/database/migrations/1743433899369-create-gift_cards-table.ts similarity index 100% rename from database/migrations/1743429400419-create-gift_cards-table.ts rename to database/migrations/1743433899369-create-gift_cards-table.ts diff --git a/database/migrations/1743429400441-create-orders-table.ts b/database/migrations/1743433899388-create-orders-table.ts similarity index 100% rename from database/migrations/1743429400441-create-orders-table.ts rename to database/migrations/1743433899388-create-orders-table.ts diff --git a/database/migrations/1743429400463-create-coupons-table.ts b/database/migrations/1743433899412-create-coupons-table.ts similarity index 100% rename from database/migrations/1743429400463-create-coupons-table.ts rename to database/migrations/1743433899412-create-coupons-table.ts diff --git a/database/migrations/1743429400484-create-tax_rates-table.ts b/database/migrations/1743433899440-create-tax_rates-table.ts similarity index 100% rename from database/migrations/1743429400484-create-tax_rates-table.ts rename to database/migrations/1743433899440-create-tax_rates-table.ts diff --git a/database/migrations/1743429400505-create-transactions-table.ts b/database/migrations/1743433899465-create-transactions-table.ts similarity index 100% rename from database/migrations/1743429400505-create-transactions-table.ts rename to database/migrations/1743433899465-create-transactions-table.ts diff --git a/database/migrations/1743429400527-create-loyalty_points-table.ts b/database/migrations/1743433899490-create-loyalty_points-table.ts similarity index 100% rename from database/migrations/1743429400527-create-loyalty_points-table.ts rename to database/migrations/1743433899490-create-loyalty_points-table.ts diff --git a/database/migrations/1743429400547-create-product_items-table.ts b/database/migrations/1743433899525-create-product_items-table.ts similarity index 100% rename from database/migrations/1743429400547-create-product_items-table.ts rename to database/migrations/1743433899525-create-product_items-table.ts diff --git a/database/migrations/1743429400567-create-loyalty_rewards-table.ts b/database/migrations/1743433899555-create-loyalty_rewards-table.ts similarity index 100% rename from database/migrations/1743429400567-create-loyalty_rewards-table.ts rename to database/migrations/1743433899555-create-loyalty_rewards-table.ts diff --git a/database/migrations/1743429400586-create-shipping_methods-table.ts b/database/migrations/1743433899576-create-shipping_methods-table.ts similarity index 100% rename from database/migrations/1743429400586-create-shipping_methods-table.ts rename to database/migrations/1743433899576-create-shipping_methods-table.ts diff --git a/database/migrations/1743429400608-create-shipping_rates-table.ts b/database/migrations/1743433899602-create-shipping_rates-table.ts similarity index 100% rename from database/migrations/1743429400608-create-shipping_rates-table.ts rename to database/migrations/1743433899602-create-shipping_rates-table.ts diff --git a/database/migrations/1743429400627-create-delivery_routes-table.ts b/database/migrations/1743433899623-create-delivery_routes-table.ts similarity index 100% rename from database/migrations/1743429400627-create-delivery_routes-table.ts rename to database/migrations/1743433899623-create-delivery_routes-table.ts diff --git a/database/migrations/1743429400648-create-failed_jobs-table.ts b/database/migrations/1743433899645-create-failed_jobs-table.ts similarity index 100% rename from database/migrations/1743429400648-create-failed_jobs-table.ts rename to database/migrations/1743433899645-create-failed_jobs-table.ts diff --git a/database/migrations/1743429400668-create-payment_methods-table.ts b/database/migrations/1743433899666-create-payment_methods-table.ts similarity index 100% rename from database/migrations/1743429400668-create-payment_methods-table.ts rename to database/migrations/1743433899666-create-payment_methods-table.ts diff --git a/database/migrations/1743429400687-create-payment_transactions-table.ts b/database/migrations/1743433899687-create-payment_transactions-table.ts similarity index 100% rename from database/migrations/1743429400687-create-payment_transactions-table.ts rename to database/migrations/1743433899687-create-payment_transactions-table.ts diff --git a/database/migrations/1743429400706-create-requests-table.ts b/database/migrations/1743433899708-create-requests-table.ts similarity index 100% rename from database/migrations/1743429400706-create-requests-table.ts rename to database/migrations/1743433899708-create-requests-table.ts index 40d8e2e6cc..a6d2c95ac6 100644 --- a/database/migrations/1743429400706-create-requests-table.ts +++ b/database/migrations/1743433899708-create-requests-table.ts @@ -13,8 +13,8 @@ export async function up(db: Database) { .addColumn('memory_usage', 'numeric') .addColumn('user_agent', 'text') .addColumn('error_message', 'text') + .addColumn('deleted_at', 'timestamp') .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') - .addColumn('deleted_at', 'timestamp') .execute() } diff --git a/database/migrations/1743429400726-create-jobs-table.ts b/database/migrations/1743433899727-create-jobs-table.ts similarity index 100% rename from database/migrations/1743429400726-create-jobs-table.ts rename to database/migrations/1743433899727-create-jobs-table.ts diff --git a/database/migrations/1743429400744-create-subscriptions-table.ts b/database/migrations/1743433899747-create-subscriptions-table.ts similarity index 100% rename from database/migrations/1743429400744-create-subscriptions-table.ts rename to database/migrations/1743433899747-create-subscriptions-table.ts diff --git a/database/migrations/1743429400764-create-payment_products-table.ts b/database/migrations/1743433899767-create-payment_products-table.ts similarity index 100% rename from database/migrations/1743429400764-create-payment_products-table.ts rename to database/migrations/1743433899767-create-payment_products-table.ts diff --git a/database/migrations/1743429400784-create-errors-table.ts b/database/migrations/1743433899787-create-errors-table.ts similarity index 100% rename from database/migrations/1743429400784-create-errors-table.ts rename to database/migrations/1743433899787-create-errors-table.ts diff --git a/storage/framework/core/database/src/drivers/sqlite.ts b/storage/framework/core/database/src/drivers/sqlite.ts index d09f16abdb..4ad1b8e205 100644 --- a/storage/framework/core/database/src/drivers/sqlite.ts +++ b/storage/framework/core/database/src/drivers/sqlite.ts @@ -217,6 +217,9 @@ async function createTableMigration(modelPath: string) { if (useBillable) migrationContent += ` .addColumn('stripe_id', 'varchar(255)')\n` + if (useSoftDeletes) + migrationContent += ` .addColumn('deleted_at', 'timestamp')\n` + if (otherModelRelations?.length) { for (const modelRelation of otherModelRelations) { if (!modelRelation.foreignKey) @@ -238,17 +241,23 @@ async function createTableMigration(modelPath: string) { migrationContent += ' .addColumn(\'updated_at\', \'timestamp\')\n' } - if (useSoftDeletes) - migrationContent += ` .addColumn('deleted_at', 'timestamp')\n` - - migrationContent += ` .execute()\n` + // Add execute() after all columns are defined + migrationContent += ` .execute()\n\n` if (otherModelRelations?.length) { for (const modelRelation of otherModelRelations) { if (!modelRelation.foreignKey) continue - migrationContent += ` \n await db.schema.createIndex('${tableName}_${modelRelation.foreignKey}_index').on('${tableName}').column('${modelRelation.foreignKey}').execute()\n\n` + migrationContent += generateForeignKeyIndexSQL(tableName, modelRelation.foreignKey) + } + } + + // Add composite indexes if defined + if (model.indexes?.length) { + migrationContent += '\n' + for (const index of model.indexes) { + migrationContent += generateIndexCreationSQL(tableName, index.name, index.columns) } } @@ -388,18 +397,18 @@ async function createAlterTableMigration(modelPath: string) { const tableName = getTableName(model, modelPath) let hasChanged = false + // Get the previous model to compare indexes + const oldModelPath = path.frameworkPath(`models/${modelName}.ts`) + const oldModel = (await import(oldModelPath)).default as Model + // Assuming you have a function to get the fields from the last migration - // For simplicity, this is not implemented here const lastMigrationFields = await getLastMigrationFields(modelName) const lastFields = lastMigrationFields ?? {} const currentFields = model.attributes as AttributesElements // Determine fields to add and remove - const changes = pluckChanges(Object.keys(lastFields), Object.keys(currentFields)) - const fieldsToAdd = changes?.added || [] - const fieldsToRemove = changes?.removed || [] let migrationContent = `import type { Database } from '@stacksjs/database'\n` @@ -465,6 +474,26 @@ async function createAlterTableMigration(modelPath: string) { migrationContent += reArrangeColumns(model.attributes, tableName) } + // Handle index changes + const oldIndexes = oldModel.indexes || [] + const newIndexes = model.indexes || [] + + // Drop removed indexes + for (const oldIndex of oldIndexes) { + if (!newIndexes.find(newIndex => newIndex.name === oldIndex.name)) { + hasChanged = true + migrationContent += ` await db.schema.dropIndex('${oldIndex.name}').execute()\n` + } + } + + // Add new indexes + for (const newIndex of newIndexes) { + if (!oldIndexes.find(oldIndex => oldIndex.name === newIndex.name)) { + hasChanged = true + migrationContent += generateIndexCreationSQL(tableName, newIndex.name, newIndex.columns) + } + } + migrationContent += `}\n` const timestamp = new Date().getTime().toString() @@ -473,7 +502,6 @@ async function createAlterTableMigration(modelPath: string) { if (hasChanged) { Bun.write(migrationFilePath, migrationContent) - log.success(`Created migration: ${italic(migrationFileName)}`) } } @@ -498,3 +526,12 @@ function reArrangeColumns(attributes: AttributesElements | undefined, tableName: return migrationContent } + +function generateIndexCreationSQL(tableName: string, indexName: string, columns: string[]): string { + const columnsStr = columns.map(col => `'${snakeCase(col)}'`).join(', ') + return ` await db.schema.createIndex('${indexName}').on('${tableName}').columns([${columnsStr}]).execute()\n` +} + +function generateForeignKeyIndexSQL(tableName: string, foreignKey: string): string { + return ` await db.schema.createIndex('${tableName}_${foreignKey}_index').on('${tableName}').column('${foreignKey}').execute()\n\n` +} diff --git a/storage/framework/core/types/src/model.ts b/storage/framework/core/types/src/model.ts index 3e3a810662..924a3f37ff 100644 --- a/storage/framework/core/types/src/model.ts +++ b/storage/framework/core/types/src/model.ts @@ -89,7 +89,7 @@ type LogAttribute = string interface ActivityLogOption { exclude: LogAttribute[] - include: LogAttribute[] // default to “*” + include: LogAttribute[] // default to "*" logOnly: LogAttribute[] } @@ -143,6 +143,7 @@ export interface ModelOptions extends Base { table?: string // defaults to the lowercase, plural name of the model name (or the name of the model file) primaryKey?: string // defaults to `id` autoIncrement?: boolean // defaults to true + indexes?: CompositeIndex[] dashboard?: { highlight?: boolean | number // defaults to undefined } @@ -215,6 +216,11 @@ export interface Attribute { } } +export interface CompositeIndex { + name: string + columns: string[] +} + export interface AttributesElements { [key: string]: Attribute } diff --git a/storage/framework/models/User.ts b/storage/framework/models/User.ts index 8eb97a7865..d30ebb2175 100644 --- a/storage/framework/models/User.ts +++ b/storage/framework/models/User.ts @@ -8,6 +8,18 @@ export default { primaryKey: 'id', // defaults to `id` autoIncrement: true, // defaults to true + // Define composite indexes + indexes: [ + { + name: 'users_email_name_index', + columns: ['email', 'name'], + }, + { + name: 'users_job_title_status_index', + columns: ['job_title', 'created_at'], + }, + ], + traits: { useAuth: { usePasskey: true, @@ -15,7 +27,6 @@ export default { useUuid: true, useTimestamps: true, // defaults to true, `timestampable` used as an alias useSearch: { - displayable: ['id', 'job_title', 'name', 'email'], // the fields to become d (defaults to all fields) searchable: ['job_title', 'name', 'email'], // the fields to become searchable (defaults to all fields) sortable: ['created_at', 'updated_at'], // the fields to become sortable (defaults to all fields) From 2e47b6e1336a58e56199ef30e917dc669f5aa676 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Mon, 31 Mar 2025 23:37:48 +0800 Subject: [PATCH 37/78] chore: wip --- ...jects-table.ts => 1743435417511-create-projects-table.ts} | 2 ++ ...le.ts => 1743435417538-create-subscriber_emails-table.ts} | 2 ++ ... => 1743435417560-create-personal_access_tokens-table.ts} | 2 ++ ...ers-table.ts => 1743435417563-create-team_users-table.ts} | 0 ...te-teams-table.ts => 1743435417582-create-teams-table.ts} | 2 ++ ...rs-table.ts => 1743435417602-create-subscribers-table.ts} | 2 ++ ...ts-table.ts => 1743435417624-create-deployments-table.ts} | 2 ++ ...eases-table.ts => 1743435417644-create-releases-table.ts} | 2 ++ ...skeys-table.ts => 1743435417667-create-passkeys-table.ts} | 0 ...te-users-table.ts => 1743435417668-create-users-table.ts} | 1 + ...te-posts-table.ts => 1743435417690-create-posts-table.ts} | 2 ++ ...-table.ts => 1743435417713-create-print_devices-table.ts} | 2 ++ ...ies-table.ts => 1743435417741-create-categories-table.ts} | 2 ++ ...ments-table.ts => 1743435417760-create-payments-table.ts} | 2 ++ ...rivers-table.ts => 1743435417780-create-drivers-table.ts} | 2 ++ ...le.ts => 1743435417799-create-waitlist_products-table.ts} | 2 ++ ...e.ts => 1743435417820-create-digital_deliveries-table.ts} | 2 ++ ...-table.ts => 1743435417841-create-manufacturers-table.ts} | 2 ++ ...ms-table.ts => 1743435417861-create-order_items-table.ts} | 2 ++ ...table.ts => 1743435417881-create-shipping_zones-table.ts} | 2 ++ ...mers-table.ts => 1743435417900-create-customers-table.ts} | 2 ++ ...ducts-table.ts => 1743435417919-create-products-table.ts} | 2 ++ ...eipts-table.ts => 1743435417941-create-receipts-table.ts} | 2 ++ ...ble.ts => 1743435417963-create-product_variants-table.ts} | 2 ++ ...s-table.ts => 1743435418042-create-license_keys-table.ts} | 2 ++ ...ts => 1743435418137-create-waitlist_restaurants-table.ts} | 2 ++ ...eviews-table.ts => 1743435418180-create-reviews-table.ts} | 2 ++ ...-table.ts => 1743435418200-create-product_units-table.ts} | 2 ++ ...rds-table.ts => 1743435418220-create-gift_cards-table.ts} | 2 ++ ...-orders-table.ts => 1743435418240-create-orders-table.ts} | 2 ++ ...oupons-table.ts => 1743435418261-create-coupons-table.ts} | 2 ++ ...ates-table.ts => 1743435418282-create-tax_rates-table.ts} | 2 ++ ...s-table.ts => 1743435418301-create-transactions-table.ts} | 2 ++ ...table.ts => 1743435418321-create-loyalty_points-table.ts} | 2 ++ ...-table.ts => 1743435418343-create-product_items-table.ts} | 2 ++ ...able.ts => 1743435418367-create-loyalty_rewards-table.ts} | 2 ++ ...ble.ts => 1743435418439-create-shipping_methods-table.ts} | 2 ++ ...table.ts => 1743435418472-create-shipping_rates-table.ts} | 2 ++ ...able.ts => 1743435418532-create-delivery_routes-table.ts} | 2 ++ ...bs-table.ts => 1743435418560-create-failed_jobs-table.ts} | 2 ++ ...able.ts => 1743435418585-create-payment_methods-table.ts} | 2 ++ ...ts => 1743435418607-create-payment_transactions-table.ts} | 2 ++ ...uests-table.ts => 1743435418638-create-requests-table.ts} | 2 ++ ...eate-jobs-table.ts => 1743435418661-create-jobs-table.ts} | 2 ++ ...-table.ts => 1743435418684-create-subscriptions-table.ts} | 2 ++ ...ble.ts => 1743435418706-create-payment_products-table.ts} | 2 ++ ...-errors-table.ts => 1743435418729-create-errors-table.ts} | 2 ++ storage/framework/core/database/src/drivers/sqlite.ts | 5 +++++ 48 files changed, 94 insertions(+) rename database/migrations/{1743433898841-create-projects-table.ts => 1743435417511-create-projects-table.ts} (87%) rename database/migrations/{1743433898866-create-subscriber_emails-table.ts => 1743435417538-create-subscriber_emails-table.ts} (83%) rename database/migrations/{1743433898888-create-personal_access_tokens-table.ts => 1743435417560-create-personal_access_tokens-table.ts} (90%) rename database/migrations/{1743433898891-create-team_users-table.ts => 1743435417563-create-team_users-table.ts} (100%) rename database/migrations/{1743433898910-create-teams-table.ts => 1743435417582-create-teams-table.ts} (92%) rename database/migrations/{1743433898930-create-subscribers-table.ts => 1743435417602-create-subscribers-table.ts} (87%) rename database/migrations/{1743433898951-create-deployments-table.ts => 1743435417624-create-deployments-table.ts} (91%) rename database/migrations/{1743433898971-create-releases-table.ts => 1743435417644-create-releases-table.ts} (85%) rename database/migrations/{1743433898990-create-passkeys-table.ts => 1743435417667-create-passkeys-table.ts} (100%) rename database/migrations/{1743433898991-create-users-table.ts => 1743435417668-create-users-table.ts} (93%) rename database/migrations/{1743433899011-create-posts-table.ts => 1743435417690-create-posts-table.ts} (89%) rename database/migrations/{1743433899034-create-print_devices-table.ts => 1743435417713-create-print_devices-table.ts} (89%) rename database/migrations/{1743433899054-create-categories-table.ts => 1743435417741-create-categories-table.ts} (88%) rename database/migrations/{1743433899074-create-payments-table.ts => 1743435417760-create-payments-table.ts} (93%) rename database/migrations/{1743433899094-create-drivers-table.ts => 1743435417780-create-drivers-table.ts} (91%) rename database/migrations/{1743433899113-create-waitlist_products-table.ts => 1743435417799-create-waitlist_products-table.ts} (93%) rename database/migrations/{1743433899134-create-digital_deliveries-table.ts => 1743435417820-create-digital_deliveries-table.ts} (89%) rename database/migrations/{1743433899154-create-manufacturers-table.ts => 1743435417841-create-manufacturers-table.ts} (86%) rename database/migrations/{1743433899173-create-order_items-table.ts => 1743435417861-create-order_items-table.ts} (89%) rename database/migrations/{1743433899195-create-shipping_zones-table.ts => 1743435417881-create-shipping_zones-table.ts} (90%) rename database/migrations/{1743433899213-create-customers-table.ts => 1743435417900-create-customers-table.ts} (91%) rename database/migrations/{1743433899231-create-products-table.ts => 1743435417919-create-products-table.ts} (93%) rename database/migrations/{1743433899251-create-receipts-table.ts => 1743435417941-create-receipts-table.ts} (91%) rename database/migrations/{1743433899272-create-product_variants-table.ts => 1743435417963-create-product_variants-table.ts} (89%) rename database/migrations/{1743433899291-create-license_keys-table.ts => 1743435418042-create-license_keys-table.ts} (93%) rename database/migrations/{1743433899311-create-waitlist_restaurants-table.ts => 1743435418137-create-waitlist_restaurants-table.ts} (92%) rename database/migrations/{1743433899330-create-reviews-table.ts => 1743435418180-create-reviews-table.ts} (93%) rename database/migrations/{1743433899349-create-product_units-table.ts => 1743435418200-create-product_units-table.ts} (90%) rename database/migrations/{1743433899369-create-gift_cards-table.ts => 1743435418220-create-gift_cards-table.ts} (93%) rename database/migrations/{1743433899388-create-orders-table.ts => 1743435418240-create-orders-table.ts} (94%) rename database/migrations/{1743433899412-create-coupons-table.ts => 1743435418261-create-coupons-table.ts} (93%) rename database/migrations/{1743433899440-create-tax_rates-table.ts => 1743435418282-create-tax_rates-table.ts} (90%) rename database/migrations/{1743433899465-create-transactions-table.ts => 1743435418301-create-transactions-table.ts} (89%) rename database/migrations/{1743433899490-create-loyalty_points-table.ts => 1743435418321-create-loyalty_points-table.ts} (88%) rename database/migrations/{1743433899525-create-product_items-table.ts => 1743435418343-create-product_items-table.ts} (89%) rename database/migrations/{1743433899555-create-loyalty_rewards-table.ts => 1743435418367-create-loyalty_rewards-table.ts} (89%) rename database/migrations/{1743433899576-create-shipping_methods-table.ts => 1743435418439-create-shipping_methods-table.ts} (86%) rename database/migrations/{1743433899602-create-shipping_rates-table.ts => 1743435418472-create-shipping_rates-table.ts} (87%) rename database/migrations/{1743433899623-create-delivery_routes-table.ts => 1743435418532-create-delivery_routes-table.ts} (90%) rename database/migrations/{1743433899645-create-failed_jobs-table.ts => 1743435418560-create-failed_jobs-table.ts} (87%) rename database/migrations/{1743433899666-create-payment_methods-table.ts => 1743435418585-create-payment_methods-table.ts} (90%) rename database/migrations/{1743433899687-create-payment_transactions-table.ts => 1743435418607-create-payment_transactions-table.ts} (91%) rename database/migrations/{1743433899708-create-requests-table.ts => 1743435418638-create-requests-table.ts} (89%) rename database/migrations/{1743433899727-create-jobs-table.ts => 1743435418661-create-jobs-table.ts} (88%) rename database/migrations/{1743433899747-create-subscriptions-table.ts => 1743435418684-create-subscriptions-table.ts} (92%) rename database/migrations/{1743433899767-create-payment_products-table.ts => 1743435418706-create-payment_products-table.ts} (87%) rename database/migrations/{1743433899787-create-errors-table.ts => 1743435418729-create-errors-table.ts} (88%) diff --git a/database/migrations/1743433898841-create-projects-table.ts b/database/migrations/1743435417511-create-projects-table.ts similarity index 87% rename from database/migrations/1743433898841-create-projects-table.ts rename to database/migrations/1743435417511-create-projects-table.ts index 4f20445f2b..8e50a28315 100644 --- a/database/migrations/1743433898841-create-projects-table.ts +++ b/database/migrations/1743435417511-create-projects-table.ts @@ -12,4 +12,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('projects_id_index').on('projects').column('id').execute() } diff --git a/database/migrations/1743433898866-create-subscriber_emails-table.ts b/database/migrations/1743435417538-create-subscriber_emails-table.ts similarity index 83% rename from database/migrations/1743433898866-create-subscriber_emails-table.ts rename to database/migrations/1743435417538-create-subscriber_emails-table.ts index 74c7cb49b3..7e4f1426ba 100644 --- a/database/migrations/1743433898866-create-subscriber_emails-table.ts +++ b/database/migrations/1743435417538-create-subscriber_emails-table.ts @@ -10,4 +10,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('subscriber_emails_id_index').on('subscriber_emails').column('id').execute() } diff --git a/database/migrations/1743433898888-create-personal_access_tokens-table.ts b/database/migrations/1743435417560-create-personal_access_tokens-table.ts similarity index 90% rename from database/migrations/1743433898888-create-personal_access_tokens-table.ts rename to database/migrations/1743435417560-create-personal_access_tokens-table.ts index b7bf56c8c5..775322a8f3 100644 --- a/database/migrations/1743433898888-create-personal_access_tokens-table.ts +++ b/database/migrations/1743435417560-create-personal_access_tokens-table.ts @@ -22,4 +22,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('personal_access_tokens_team_id_index').on('personal_access_tokens').column('team_id').execute() + + await db.schema.createIndex('personal_access_tokens_id_index').on('personal_access_tokens').column('id').execute() } diff --git a/database/migrations/1743433898891-create-team_users-table.ts b/database/migrations/1743435417563-create-team_users-table.ts similarity index 100% rename from database/migrations/1743433898891-create-team_users-table.ts rename to database/migrations/1743435417563-create-team_users-table.ts diff --git a/database/migrations/1743433898910-create-teams-table.ts b/database/migrations/1743435417582-create-teams-table.ts similarity index 92% rename from database/migrations/1743433898910-create-teams-table.ts rename to database/migrations/1743435417582-create-teams-table.ts index de552ee055..959ac6cca2 100644 --- a/database/migrations/1743433898910-create-teams-table.ts +++ b/database/migrations/1743435417582-create-teams-table.ts @@ -20,4 +20,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('teams_user_id_index').on('teams').column('user_id').execute() + + await db.schema.createIndex('teams_id_index').on('teams').column('id').execute() } diff --git a/database/migrations/1743433898930-create-subscribers-table.ts b/database/migrations/1743435417602-create-subscribers-table.ts similarity index 87% rename from database/migrations/1743433898930-create-subscribers-table.ts rename to database/migrations/1743435417602-create-subscribers-table.ts index 5bf7fa4472..4d8506f781 100644 --- a/database/migrations/1743433898930-create-subscribers-table.ts +++ b/database/migrations/1743435417602-create-subscribers-table.ts @@ -13,4 +13,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('subscribers_user_id_index').on('subscribers').column('user_id').execute() + + await db.schema.createIndex('subscribers_id_index').on('subscribers').column('id').execute() } diff --git a/database/migrations/1743433898951-create-deployments-table.ts b/database/migrations/1743435417624-create-deployments-table.ts similarity index 91% rename from database/migrations/1743433898951-create-deployments-table.ts rename to database/migrations/1743435417624-create-deployments-table.ts index dbd0604fb3..567ffd3102 100644 --- a/database/migrations/1743433898951-create-deployments-table.ts +++ b/database/migrations/1743435417624-create-deployments-table.ts @@ -20,4 +20,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('deployments_user_id_index').on('deployments').column('user_id').execute() + + await db.schema.createIndex('deployments_id_index').on('deployments').column('id').execute() } diff --git a/database/migrations/1743433898971-create-releases-table.ts b/database/migrations/1743435417644-create-releases-table.ts similarity index 85% rename from database/migrations/1743433898971-create-releases-table.ts rename to database/migrations/1743435417644-create-releases-table.ts index b966274b34..5ee65d36c1 100644 --- a/database/migrations/1743433898971-create-releases-table.ts +++ b/database/migrations/1743435417644-create-releases-table.ts @@ -10,4 +10,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('releases_id_index').on('releases').column('id').execute() } diff --git a/database/migrations/1743433898990-create-passkeys-table.ts b/database/migrations/1743435417667-create-passkeys-table.ts similarity index 100% rename from database/migrations/1743433898990-create-passkeys-table.ts rename to database/migrations/1743435417667-create-passkeys-table.ts diff --git a/database/migrations/1743433898991-create-users-table.ts b/database/migrations/1743435417668-create-users-table.ts similarity index 93% rename from database/migrations/1743433898991-create-users-table.ts rename to database/migrations/1743435417668-create-users-table.ts index efd1c7a80e..e87b35d2e2 100644 --- a/database/migrations/1743433898991-create-users-table.ts +++ b/database/migrations/1743435417668-create-users-table.ts @@ -22,4 +22,5 @@ export async function up(db: Database) { await db.schema.createIndex('users_email_name_index').on('users').columns(['email', 'name']).execute() await db.schema.createIndex('users_job_title_status_index').on('users').columns(['job_title', 'created_at']).execute() + await db.schema.createIndex('users_id_index').on('users').column('id').execute() } diff --git a/database/migrations/1743433899011-create-posts-table.ts b/database/migrations/1743435417690-create-posts-table.ts similarity index 89% rename from database/migrations/1743433899011-create-posts-table.ts rename to database/migrations/1743435417690-create-posts-table.ts index 2c2ebd40c9..dec4aaa07b 100644 --- a/database/migrations/1743433899011-create-posts-table.ts +++ b/database/migrations/1743435417690-create-posts-table.ts @@ -14,4 +14,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('posts_user_id_index').on('posts').column('user_id').execute() + + await db.schema.createIndex('posts_id_index').on('posts').column('id').execute() } diff --git a/database/migrations/1743433899034-create-print_devices-table.ts b/database/migrations/1743435417713-create-print_devices-table.ts similarity index 89% rename from database/migrations/1743433899034-create-print_devices-table.ts rename to database/migrations/1743435417713-create-print_devices-table.ts index 948a1c273c..de7bac36b9 100644 --- a/database/migrations/1743433899034-create-print_devices-table.ts +++ b/database/migrations/1743435417713-create-print_devices-table.ts @@ -16,4 +16,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('print_devices_id_index').on('print_devices').column('id').execute() } diff --git a/database/migrations/1743433899054-create-categories-table.ts b/database/migrations/1743435417741-create-categories-table.ts similarity index 88% rename from database/migrations/1743433899054-create-categories-table.ts rename to database/migrations/1743435417741-create-categories-table.ts index 47d553cf91..d6b50a1f2c 100644 --- a/database/migrations/1743433899054-create-categories-table.ts +++ b/database/migrations/1743435417741-create-categories-table.ts @@ -15,4 +15,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('categories_id_index').on('categories').column('id').execute() } diff --git a/database/migrations/1743433899074-create-payments-table.ts b/database/migrations/1743435417760-create-payments-table.ts similarity index 93% rename from database/migrations/1743433899074-create-payments-table.ts rename to database/migrations/1743435417760-create-payments-table.ts index 97db64cc50..861fb37f3a 100644 --- a/database/migrations/1743433899074-create-payments-table.ts +++ b/database/migrations/1743435417760-create-payments-table.ts @@ -29,4 +29,6 @@ export async function up(db: Database) { await db.schema.createIndex('payments_customer_id_index').on('payments').column('customer_id').execute() await db.schema.createIndex('payments_order_id_index').on('payments').column('order_id').execute() + + await db.schema.createIndex('payments_id_index').on('payments').column('id').execute() } diff --git a/database/migrations/1743433899094-create-drivers-table.ts b/database/migrations/1743435417780-create-drivers-table.ts similarity index 91% rename from database/migrations/1743433899094-create-drivers-table.ts rename to database/migrations/1743435417780-create-drivers-table.ts index 0bdcc6b348..5fb1f8cc94 100644 --- a/database/migrations/1743433899094-create-drivers-table.ts +++ b/database/migrations/1743435417780-create-drivers-table.ts @@ -18,4 +18,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('drivers_user_id_index').on('drivers').column('user_id').execute() + + await db.schema.createIndex('drivers_id_index').on('drivers').column('id').execute() } diff --git a/database/migrations/1743433899113-create-waitlist_products-table.ts b/database/migrations/1743435417799-create-waitlist_products-table.ts similarity index 93% rename from database/migrations/1743433899113-create-waitlist_products-table.ts rename to database/migrations/1743435417799-create-waitlist_products-table.ts index 01a90166b2..fa9f5e7d12 100644 --- a/database/migrations/1743433899113-create-waitlist_products-table.ts +++ b/database/migrations/1743435417799-create-waitlist_products-table.ts @@ -28,4 +28,6 @@ export async function up(db: Database) { await db.schema.createIndex('waitlist_products_customer_id_index').on('waitlist_products').column('customer_id').execute() await db.schema.createIndex('waitlist_products_product_id_index').on('waitlist_products').column('product_id').execute() + + await db.schema.createIndex('waitlist_products_id_index').on('waitlist_products').column('id').execute() } diff --git a/database/migrations/1743433899134-create-digital_deliveries-table.ts b/database/migrations/1743435417820-create-digital_deliveries-table.ts similarity index 89% rename from database/migrations/1743433899134-create-digital_deliveries-table.ts rename to database/migrations/1743435417820-create-digital_deliveries-table.ts index 9da6c52705..985ef1662e 100644 --- a/database/migrations/1743433899134-create-digital_deliveries-table.ts +++ b/database/migrations/1743435417820-create-digital_deliveries-table.ts @@ -16,4 +16,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('digital_deliveries_id_index').on('digital_deliveries').column('id').execute() } diff --git a/database/migrations/1743433899154-create-manufacturers-table.ts b/database/migrations/1743435417841-create-manufacturers-table.ts similarity index 86% rename from database/migrations/1743433899154-create-manufacturers-table.ts rename to database/migrations/1743435417841-create-manufacturers-table.ts index 8a6f87e510..9c0708eb89 100644 --- a/database/migrations/1743433899154-create-manufacturers-table.ts +++ b/database/migrations/1743435417841-create-manufacturers-table.ts @@ -13,4 +13,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('manufacturers_id_index').on('manufacturers').column('id').execute() } diff --git a/database/migrations/1743433899173-create-order_items-table.ts b/database/migrations/1743435417861-create-order_items-table.ts similarity index 89% rename from database/migrations/1743433899173-create-order_items-table.ts rename to database/migrations/1743435417861-create-order_items-table.ts index 1ecd5f7528..e5b0d140a8 100644 --- a/database/migrations/1743433899173-create-order_items-table.ts +++ b/database/migrations/1743435417861-create-order_items-table.ts @@ -15,4 +15,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('order_items_order_id_index').on('order_items').column('order_id').execute() + + await db.schema.createIndex('order_items_id_index').on('order_items').column('id').execute() } diff --git a/database/migrations/1743433899195-create-shipping_zones-table.ts b/database/migrations/1743435417881-create-shipping_zones-table.ts similarity index 90% rename from database/migrations/1743433899195-create-shipping_zones-table.ts rename to database/migrations/1743435417881-create-shipping_zones-table.ts index 21bee99092..e64aff74ec 100644 --- a/database/migrations/1743433899195-create-shipping_zones-table.ts +++ b/database/migrations/1743435417881-create-shipping_zones-table.ts @@ -18,4 +18,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('shipping_zones_shipping_method_id_index').on('shipping_zones').column('shipping_method_id').execute() + + await db.schema.createIndex('shipping_zones_id_index').on('shipping_zones').column('id').execute() } diff --git a/database/migrations/1743433899213-create-customers-table.ts b/database/migrations/1743435417900-create-customers-table.ts similarity index 91% rename from database/migrations/1743433899213-create-customers-table.ts rename to database/migrations/1743435417900-create-customers-table.ts index 10e406c2a2..c0ba233722 100644 --- a/database/migrations/1743433899213-create-customers-table.ts +++ b/database/migrations/1743435417900-create-customers-table.ts @@ -20,4 +20,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('customers_user_id_index').on('customers').column('user_id').execute() + + await db.schema.createIndex('customers_id_index').on('customers').column('id').execute() } diff --git a/database/migrations/1743433899231-create-products-table.ts b/database/migrations/1743435417919-create-products-table.ts similarity index 93% rename from database/migrations/1743433899231-create-products-table.ts rename to database/migrations/1743435417919-create-products-table.ts index f5fdcfe3ef..3f13ed8308 100644 --- a/database/migrations/1743433899231-create-products-table.ts +++ b/database/migrations/1743435417919-create-products-table.ts @@ -26,4 +26,6 @@ export async function up(db: Database) { await db.schema.createIndex('products_category_id_index').on('products').column('category_id').execute() await db.schema.createIndex('products_manufacturer_id_index').on('products').column('manufacturer_id').execute() + + await db.schema.createIndex('products_id_index').on('products').column('id').execute() } diff --git a/database/migrations/1743433899251-create-receipts-table.ts b/database/migrations/1743435417941-create-receipts-table.ts similarity index 91% rename from database/migrations/1743433899251-create-receipts-table.ts rename to database/migrations/1743435417941-create-receipts-table.ts index 9be966e656..662ed8471a 100644 --- a/database/migrations/1743433899251-create-receipts-table.ts +++ b/database/migrations/1743435417941-create-receipts-table.ts @@ -20,4 +20,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('receipts_print_device_id_index').on('receipts').column('print_device_id').execute() + + await db.schema.createIndex('receipts_id_index').on('receipts').column('id').execute() } diff --git a/database/migrations/1743433899272-create-product_variants-table.ts b/database/migrations/1743435417963-create-product_variants-table.ts similarity index 89% rename from database/migrations/1743433899272-create-product_variants-table.ts rename to database/migrations/1743435417963-create-product_variants-table.ts index 299576871d..299b4ec582 100644 --- a/database/migrations/1743433899272-create-product_variants-table.ts +++ b/database/migrations/1743435417963-create-product_variants-table.ts @@ -18,4 +18,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('product_variants_product_id_index').on('product_variants').column('product_id').execute() + + await db.schema.createIndex('product_variants_id_index').on('product_variants').column('id').execute() } diff --git a/database/migrations/1743433899291-create-license_keys-table.ts b/database/migrations/1743435418042-create-license_keys-table.ts similarity index 93% rename from database/migrations/1743433899291-create-license_keys-table.ts rename to database/migrations/1743435418042-create-license_keys-table.ts index b5492bfa77..0626a463bd 100644 --- a/database/migrations/1743433899291-create-license_keys-table.ts +++ b/database/migrations/1743435418042-create-license_keys-table.ts @@ -25,4 +25,6 @@ export async function up(db: Database) { await db.schema.createIndex('license_keys_product_id_index').on('license_keys').column('product_id').execute() await db.schema.createIndex('license_keys_order_id_index').on('license_keys').column('order_id').execute() + + await db.schema.createIndex('license_keys_id_index').on('license_keys').column('id').execute() } diff --git a/database/migrations/1743433899311-create-waitlist_restaurants-table.ts b/database/migrations/1743435418137-create-waitlist_restaurants-table.ts similarity index 92% rename from database/migrations/1743433899311-create-waitlist_restaurants-table.ts rename to database/migrations/1743435418137-create-waitlist_restaurants-table.ts index 693cfa5144..207e7edb93 100644 --- a/database/migrations/1743433899311-create-waitlist_restaurants-table.ts +++ b/database/migrations/1743435418137-create-waitlist_restaurants-table.ts @@ -26,4 +26,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('waitlist_restaurants_customer_id_index').on('waitlist_restaurants').column('customer_id').execute() + + await db.schema.createIndex('waitlist_restaurants_id_index').on('waitlist_restaurants').column('id').execute() } diff --git a/database/migrations/1743433899330-create-reviews-table.ts b/database/migrations/1743435418180-create-reviews-table.ts similarity index 93% rename from database/migrations/1743433899330-create-reviews-table.ts rename to database/migrations/1743435418180-create-reviews-table.ts index fa2a97a181..e6700eecab 100644 --- a/database/migrations/1743433899330-create-reviews-table.ts +++ b/database/migrations/1743435418180-create-reviews-table.ts @@ -27,4 +27,6 @@ export async function up(db: Database) { await db.schema.createIndex('reviews_customer_id_index').on('reviews').column('customer_id').execute() await db.schema.createIndex('reviews_product_id_index').on('reviews').column('product_id').execute() + + await db.schema.createIndex('reviews_id_index').on('reviews').column('id').execute() } diff --git a/database/migrations/1743433899349-create-product_units-table.ts b/database/migrations/1743435418200-create-product_units-table.ts similarity index 90% rename from database/migrations/1743433899349-create-product_units-table.ts rename to database/migrations/1743435418200-create-product_units-table.ts index e3dd8c680b..38d206d56f 100644 --- a/database/migrations/1743433899349-create-product_units-table.ts +++ b/database/migrations/1743435418200-create-product_units-table.ts @@ -18,4 +18,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('product_units_product_id_index').on('product_units').column('product_id').execute() + + await db.schema.createIndex('product_units_id_index').on('product_units').column('id').execute() } diff --git a/database/migrations/1743433899369-create-gift_cards-table.ts b/database/migrations/1743435418220-create-gift_cards-table.ts similarity index 93% rename from database/migrations/1743433899369-create-gift_cards-table.ts rename to database/migrations/1743435418220-create-gift_cards-table.ts index 13d74788b2..6a5f190850 100644 --- a/database/migrations/1743433899369-create-gift_cards-table.ts +++ b/database/migrations/1743435418220-create-gift_cards-table.ts @@ -28,4 +28,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('gift_cards_customer_id_index').on('gift_cards').column('customer_id').execute() + + await db.schema.createIndex('gift_cards_id_index').on('gift_cards').column('id').execute() } diff --git a/database/migrations/1743433899388-create-orders-table.ts b/database/migrations/1743435418240-create-orders-table.ts similarity index 94% rename from database/migrations/1743433899388-create-orders-table.ts rename to database/migrations/1743435418240-create-orders-table.ts index 47c54cac9e..3c14227067 100644 --- a/database/migrations/1743433899388-create-orders-table.ts +++ b/database/migrations/1743435418240-create-orders-table.ts @@ -32,4 +32,6 @@ export async function up(db: Database) { await db.schema.createIndex('orders_gift_card_id_index').on('orders').column('gift_card_id').execute() await db.schema.createIndex('orders_coupon_id_index').on('orders').column('coupon_id').execute() + + await db.schema.createIndex('orders_id_index').on('orders').column('id').execute() } diff --git a/database/migrations/1743433899412-create-coupons-table.ts b/database/migrations/1743435418261-create-coupons-table.ts similarity index 93% rename from database/migrations/1743433899412-create-coupons-table.ts rename to database/migrations/1743435418261-create-coupons-table.ts index e11fd476e1..dc045c8e60 100644 --- a/database/migrations/1743433899412-create-coupons-table.ts +++ b/database/migrations/1743435418261-create-coupons-table.ts @@ -27,4 +27,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('coupons_product_id_index').on('coupons').column('product_id').execute() + + await db.schema.createIndex('coupons_id_index').on('coupons').column('id').execute() } diff --git a/database/migrations/1743433899440-create-tax_rates-table.ts b/database/migrations/1743435418282-create-tax_rates-table.ts similarity index 90% rename from database/migrations/1743433899440-create-tax_rates-table.ts rename to database/migrations/1743435418282-create-tax_rates-table.ts index f9e20902ea..c952597a66 100644 --- a/database/migrations/1743433899440-create-tax_rates-table.ts +++ b/database/migrations/1743435418282-create-tax_rates-table.ts @@ -16,4 +16,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('tax_rates_id_index').on('tax_rates').column('id').execute() } diff --git a/database/migrations/1743433899465-create-transactions-table.ts b/database/migrations/1743435418301-create-transactions-table.ts similarity index 89% rename from database/migrations/1743433899465-create-transactions-table.ts rename to database/migrations/1743435418301-create-transactions-table.ts index 769b885b6c..87e122798d 100644 --- a/database/migrations/1743433899465-create-transactions-table.ts +++ b/database/migrations/1743435418301-create-transactions-table.ts @@ -16,4 +16,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('transactions_id_index').on('transactions').column('id').execute() } diff --git a/database/migrations/1743433899490-create-loyalty_points-table.ts b/database/migrations/1743435418321-create-loyalty_points-table.ts similarity index 88% rename from database/migrations/1743433899490-create-loyalty_points-table.ts rename to database/migrations/1743435418321-create-loyalty_points-table.ts index 3d9b07b29c..fe5964f8c5 100644 --- a/database/migrations/1743433899490-create-loyalty_points-table.ts +++ b/database/migrations/1743435418321-create-loyalty_points-table.ts @@ -16,4 +16,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('loyalty_points_id_index').on('loyalty_points').column('id').execute() } diff --git a/database/migrations/1743433899525-create-product_items-table.ts b/database/migrations/1743435418343-create-product_items-table.ts similarity index 89% rename from database/migrations/1743433899525-create-product_items-table.ts rename to database/migrations/1743435418343-create-product_items-table.ts index 44999f0e4d..470005e02b 100644 --- a/database/migrations/1743433899525-create-product_items-table.ts +++ b/database/migrations/1743435418343-create-product_items-table.ts @@ -18,4 +18,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('product_items_id_index').on('product_items').column('id').execute() } diff --git a/database/migrations/1743433899555-create-loyalty_rewards-table.ts b/database/migrations/1743435418367-create-loyalty_rewards-table.ts similarity index 89% rename from database/migrations/1743433899555-create-loyalty_rewards-table.ts rename to database/migrations/1743435418367-create-loyalty_rewards-table.ts index 6863dda459..a93884c04f 100644 --- a/database/migrations/1743433899555-create-loyalty_rewards-table.ts +++ b/database/migrations/1743435418367-create-loyalty_rewards-table.ts @@ -18,4 +18,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('loyalty_rewards_id_index').on('loyalty_rewards').column('id').execute() } diff --git a/database/migrations/1743433899576-create-shipping_methods-table.ts b/database/migrations/1743435418439-create-shipping_methods-table.ts similarity index 86% rename from database/migrations/1743433899576-create-shipping_methods-table.ts rename to database/migrations/1743435418439-create-shipping_methods-table.ts index cf02d7cac1..bc9628cb91 100644 --- a/database/migrations/1743433899576-create-shipping_methods-table.ts +++ b/database/migrations/1743435418439-create-shipping_methods-table.ts @@ -14,4 +14,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('shipping_methods_id_index').on('shipping_methods').column('id').execute() } diff --git a/database/migrations/1743433899602-create-shipping_rates-table.ts b/database/migrations/1743435418472-create-shipping_rates-table.ts similarity index 87% rename from database/migrations/1743433899602-create-shipping_rates-table.ts rename to database/migrations/1743435418472-create-shipping_rates-table.ts index a7261a26d5..aa7e7df2b0 100644 --- a/database/migrations/1743433899602-create-shipping_rates-table.ts +++ b/database/migrations/1743435418472-create-shipping_rates-table.ts @@ -14,4 +14,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('shipping_rates_id_index').on('shipping_rates').column('id').execute() } diff --git a/database/migrations/1743433899623-create-delivery_routes-table.ts b/database/migrations/1743435418532-create-delivery_routes-table.ts similarity index 90% rename from database/migrations/1743433899623-create-delivery_routes-table.ts rename to database/migrations/1743435418532-create-delivery_routes-table.ts index bc38214fd6..d5ad6310fa 100644 --- a/database/migrations/1743433899623-create-delivery_routes-table.ts +++ b/database/migrations/1743435418532-create-delivery_routes-table.ts @@ -19,4 +19,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('delivery_routes_driver_id_index').on('delivery_routes').column('driver_id').execute() + + await db.schema.createIndex('delivery_routes_id_index').on('delivery_routes').column('id').execute() } diff --git a/database/migrations/1743433899645-create-failed_jobs-table.ts b/database/migrations/1743435418560-create-failed_jobs-table.ts similarity index 87% rename from database/migrations/1743433899645-create-failed_jobs-table.ts rename to database/migrations/1743435418560-create-failed_jobs-table.ts index 420c368107..cc9aeec222 100644 --- a/database/migrations/1743433899645-create-failed_jobs-table.ts +++ b/database/migrations/1743435418560-create-failed_jobs-table.ts @@ -13,4 +13,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('failed_jobs_id_index').on('failed_jobs').column('id').execute() } diff --git a/database/migrations/1743433899666-create-payment_methods-table.ts b/database/migrations/1743435418585-create-payment_methods-table.ts similarity index 90% rename from database/migrations/1743433899666-create-payment_methods-table.ts rename to database/migrations/1743435418585-create-payment_methods-table.ts index 29646d87e3..82a484596b 100644 --- a/database/migrations/1743433899666-create-payment_methods-table.ts +++ b/database/migrations/1743435418585-create-payment_methods-table.ts @@ -20,4 +20,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('payment_methods_user_id_index').on('payment_methods').column('user_id').execute() + + await db.schema.createIndex('payment_methods_id_index').on('payment_methods').column('id').execute() } diff --git a/database/migrations/1743433899687-create-payment_transactions-table.ts b/database/migrations/1743435418607-create-payment_transactions-table.ts similarity index 91% rename from database/migrations/1743433899687-create-payment_transactions-table.ts rename to database/migrations/1743435418607-create-payment_transactions-table.ts index 992f4a53f7..77e25a24e5 100644 --- a/database/migrations/1743433899687-create-payment_transactions-table.ts +++ b/database/migrations/1743435418607-create-payment_transactions-table.ts @@ -22,4 +22,6 @@ export async function up(db: Database) { await db.schema.createIndex('payment_transactions_user_id_index').on('payment_transactions').column('user_id').execute() await db.schema.createIndex('payment_transactions_payment_method_id_index').on('payment_transactions').column('payment_method_id').execute() + + await db.schema.createIndex('payment_transactions_id_index').on('payment_transactions').column('id').execute() } diff --git a/database/migrations/1743433899708-create-requests-table.ts b/database/migrations/1743435418638-create-requests-table.ts similarity index 89% rename from database/migrations/1743433899708-create-requests-table.ts rename to database/migrations/1743435418638-create-requests-table.ts index a6d2c95ac6..d5b2ae1746 100644 --- a/database/migrations/1743433899708-create-requests-table.ts +++ b/database/migrations/1743435418638-create-requests-table.ts @@ -17,4 +17,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('requests_id_index').on('requests').column('id').execute() } diff --git a/database/migrations/1743433899727-create-jobs-table.ts b/database/migrations/1743435418661-create-jobs-table.ts similarity index 88% rename from database/migrations/1743433899727-create-jobs-table.ts rename to database/migrations/1743435418661-create-jobs-table.ts index 6f04b84f21..15ca452fe4 100644 --- a/database/migrations/1743433899727-create-jobs-table.ts +++ b/database/migrations/1743435418661-create-jobs-table.ts @@ -13,4 +13,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('jobs_id_index').on('jobs').column('id').execute() } diff --git a/database/migrations/1743433899747-create-subscriptions-table.ts b/database/migrations/1743435418684-create-subscriptions-table.ts similarity index 92% rename from database/migrations/1743433899747-create-subscriptions-table.ts rename to database/migrations/1743435418684-create-subscriptions-table.ts index 391c483ad9..1d4d96b9d6 100644 --- a/database/migrations/1743433899747-create-subscriptions-table.ts +++ b/database/migrations/1743435418684-create-subscriptions-table.ts @@ -24,4 +24,6 @@ export async function up(db: Database) { .execute() await db.schema.createIndex('subscriptions_user_id_index').on('subscriptions').column('user_id').execute() + + await db.schema.createIndex('subscriptions_id_index').on('subscriptions').column('id').execute() } diff --git a/database/migrations/1743433899767-create-payment_products-table.ts b/database/migrations/1743435418706-create-payment_products-table.ts similarity index 87% rename from database/migrations/1743433899767-create-payment_products-table.ts rename to database/migrations/1743435418706-create-payment_products-table.ts index bdc3d444bc..ea71c3b932 100644 --- a/database/migrations/1743433899767-create-payment_products-table.ts +++ b/database/migrations/1743435418706-create-payment_products-table.ts @@ -16,4 +16,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('payment_products_id_index').on('payment_products').column('id').execute() } diff --git a/database/migrations/1743433899787-create-errors-table.ts b/database/migrations/1743435418729-create-errors-table.ts similarity index 88% rename from database/migrations/1743433899787-create-errors-table.ts rename to database/migrations/1743435418729-create-errors-table.ts index 4ccf53494c..96e04e0525 100644 --- a/database/migrations/1743433899787-create-errors-table.ts +++ b/database/migrations/1743435418729-create-errors-table.ts @@ -13,4 +13,6 @@ export async function up(db: Database) { .addColumn('created_at', 'timestamp', col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)) .addColumn('updated_at', 'timestamp') .execute() + + await db.schema.createIndex('errors_id_index').on('errors').column('id').execute() } diff --git a/storage/framework/core/database/src/drivers/sqlite.ts b/storage/framework/core/database/src/drivers/sqlite.ts index 4ad1b8e205..125a578d1a 100644 --- a/storage/framework/core/database/src/drivers/sqlite.ts +++ b/storage/framework/core/database/src/drivers/sqlite.ts @@ -261,6 +261,8 @@ async function createTableMigration(modelPath: string) { } } + migrationContent += generatePrimaryKeyIndexSQL(tableName) + migrationContent += `}\n` const timestamp = new Date().getTime().toString() @@ -531,6 +533,9 @@ function generateIndexCreationSQL(tableName: string, indexName: string, columns: const columnsStr = columns.map(col => `'${snakeCase(col)}'`).join(', ') return ` await db.schema.createIndex('${indexName}').on('${tableName}').columns([${columnsStr}]).execute()\n` } +function generatePrimaryKeyIndexSQL(tableName: string): string { + return ` await db.schema.createIndex('${tableName}_id_index').on('${tableName}').column('id').execute()\n` +} function generateForeignKeyIndexSQL(tableName: string, foreignKey: string): string { return ` await db.schema.createIndex('${tableName}_${foreignKey}_index').on('${tableName}').column('${foreignKey}').execute()\n\n` From 608ae78b297f75354abc1c50bd2d71641bf0fe51 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 31 Mar 2025 20:12:30 -0700 Subject: [PATCH 38/78] chore: wip --- .../defaults/vcs/github/workflows/release.yml | 166 +++++++++++++++++- 1 file changed, 160 insertions(+), 6 deletions(-) diff --git a/storage/framework/defaults/vcs/github/workflows/release.yml b/storage/framework/defaults/vcs/github/workflows/release.yml index bad4439778..ff891cce0a 100644 --- a/storage/framework/defaults/vcs/github/workflows/release.yml +++ b/storage/framework/defaults/vcs/github/workflows/release.yml @@ -1,15 +1,20 @@ -name: CI +name: Release on: push: tags: - 'v*' +permissions: + contents: write + packages: write + id-token: write + jobs: - release: - # name: Release + npm: runs-on: ubuntu-latest - + outputs: + version: ${{ env.VERSION }} steps: - name: Checkout Code uses: actions/checkout@v4 @@ -49,7 +54,156 @@ jobs: env: VSCE_PAT: ${{ secrets.VSCE_PAT }} + - name: Extract tag version + id: get_version + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + - name: Create GitHub Release - run: bunx changelogithub + id: create_release + uses: softprops/action-gh-release@v2 + with: + files: | + storage/framework/core/buddy/bin/buddy-linux-x64.zip + storage/framework/core/buddy/bin/buddy-linux-arm64.zip + storage/framework/core/buddy/bin/buddy-windows-x64.zip + storage/framework/core/buddy/bin/buddy-darwin-x64.zip + storage/framework/core/buddy/bin/buddy-darwin-arm64.zip + name: ${{ env.VERSION }} + tag_name: ${{ env.VERSION }} + generate_release_notes: true env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + homebrew: + needs: npm + runs-on: macos-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Debug Tag + run: | + echo "Tag: ${GITHUB_REF#refs/tags/}" + echo "Version from previous job: ${{ needs.release.outputs.version }}" + + - name: Generate GitHub App Token + id: generate-token + uses: tibdex/github-app-token@v2 + with: + app_id: ${{ secrets.GH_APP_ID }} + private_key: ${{ secrets.GH_APP_PRIVATE_KEY }} + + - name: Setup GitHub CLI with PAT + run: | + echo "${{ secrets.GH_PAT }}" | gh auth login --with-token + + - name: Ensure Homebrew Tap Repository Exists + env: + GH_TOKEN: ${{ secrets.GH_PAT }} + run: | + if ! gh repo view stacksjs/homebrew-tap &>/dev/null; then + echo "Creating homebrew-tap repository..." + gh repo create stacksjs/homebrew-tap --public --description "Homebrew tap for Stacks packages" + else + echo "homebrew-tap repository already exists" + fi + + - name: Authenticate GitHub CLI with App Token + run: echo "${{ steps.generate-token.outputs.token }}" | gh auth login --with-token + + - name: Wait for Release Assets + run: | + VERSION=${GITHUB_REF#refs/tags/} + echo "Waiting for release assets to be available..." + + # Wait for assets to be available (max 10 minutes) + TIMEOUT=600 + START_TIME=$(date +%s) + + while [ $(( $(date +%s) - START_TIME )) -lt $TIMEOUT ]; do + HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" https://github.com/stacksjs/stacks/releases/download/$VERSION/buddy-darwin-arm64) + echo "HTTP response code: $HTTP_CODE" + + if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "302" ]; then + echo "Assets are available!" + break + fi + + echo "Assets not ready yet, waiting 10 seconds..." + sleep 10 + done + + if [ $(( $(date +%s) - START_TIME )) -ge $TIMEOUT ]; then + echo "Timed out waiting for assets, proceeding anyway..." + fi + + # Force continue even if we couldn't detect the file + # Sometimes GitHub's API can be inconsistent + echo "Continuing with asset download..." + + - name: Download Binaries Directly + run: | + VERSION=${GITHUB_REF#refs/tags/} + mkdir -p .github/temp + cd .github/temp + + # Try direct download with retries + download_with_retry() { + local url=$1 + local output=$2 + local max_retries=5 + local retry=0 + + while [ $retry -lt $max_retries ]; do + echo "Downloading $url (attempt $(($retry + 1))/$max_retries)" + if curl -L -s -f "$url" -o "$output"; then + echo "Downloaded $output successfully" + return 0 + fi + echo "Download failed, retrying in 5 seconds..." + retry=$((retry + 1)) + sleep 5 + done + + echo "Failed to download $url after $max_retries attempts" + return 1 + } + + download_with_retry "https://github.com/stacksjs/stacks/releases/download/$VERSION/buddy-darwin-arm64" "buddy-darwin-arm64" + download_with_retry "https://github.com/stacksjs/stacks/releases/download/$VERSION/buddy-darwin-x64" "buddy-darwin-x64" + download_with_retry "https://github.com/stacksjs/stacks/releases/download/$VERSION/buddy-linux-arm64" "buddy-linux-arm64" + download_with_retry "https://github.com/stacksjs/stacks/releases/download/$VERSION/buddy-linux-x64" "buddy-linux-x64" + + cd ../.. + + - name: Update Homebrew Formula + run: | + VERSION=${GITHUB_REF#refs/tags/} + bash .github/scripts/update-homebrew-formula.sh $VERSION + + - name: Push to Homebrew Tap Repository + run: | + # Clone the tap repo using GitHub App token + git clone https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com/stacksjs/homebrew-tap.git + + # Set up Git config + cd homebrew-tap + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + # Copy the formula to the tap repo + mkdir -p Formula + cp ../.github/homebrew/stacks.rb Formula/ + + # Check if there are changes to commit + if git status --porcelain | grep -q .; then + # Push the changes to the tap repo + git add Formula/stacks.rb + git commit -m "chore: update stacks formula to ${GITHUB_REF#refs/tags/}" + git push + echo "Successfully updated homebrew formula!" + else + echo "No changes to commit" + fi From c89977746b4f00c81e4588f5c653f44985574590 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Tue, 1 Apr 2025 20:58:03 +0800 Subject: [PATCH 39/78] chore: wip --- .../core/commerce/src/device/fetch.ts | 35 ++++++- .../core/commerce/src/tests/device.test.ts | 98 ++++++++++++++++++- 2 files changed, 131 insertions(+), 2 deletions(-) diff --git a/storage/framework/core/commerce/src/device/fetch.ts b/storage/framework/core/commerce/src/device/fetch.ts index fc6050fec2..4f64e8ace6 100644 --- a/storage/framework/core/commerce/src/device/fetch.ts +++ b/storage/framework/core/commerce/src/device/fetch.ts @@ -1,4 +1,4 @@ -import type { PrintDeviceJsonResponse } from '@stacksjs/orm' +import type { PrintDeviceJsonResponse, ReceiptJsonResponse } from '@stacksjs/orm' import { db } from '@stacksjs/database' /** @@ -75,3 +75,36 @@ export async function calculateErrorRate(): Promise { return Number(((result.error_count ?? 0) / result.total) * 100) } + +/** + * Fetch all errors from receipts for a specific print device + */ +export async function fetchErrorsByDeviceId(printDeviceId: number): Promise { + return await db + .selectFrom('receipts') + .where('print_device_id', '=', printDeviceId) + .where('status', '=', 'error') + .selectAll() + .execute() +} + +/** + * Calculate printer health percentage based on online status + */ +export async function calculatePrinterHealth(): Promise { + const result = await db + .selectFrom('print_devices') + .select([ + db.fn.count('id').as('total'), + db.fn.count('id') + .filterWhere('status', '=', 'online') + .as('online_count'), + ]) + .executeTakeFirst() + + if (!result?.total || result.total === 0) { + return 0 + } + + return Number(((result.online_count ?? 0) / result.total) * 100) +} diff --git a/storage/framework/core/commerce/src/tests/device.test.ts b/storage/framework/core/commerce/src/tests/device.test.ts index ecda42dff8..1e26e79cab 100644 --- a/storage/framework/core/commerce/src/tests/device.test.ts +++ b/storage/framework/core/commerce/src/tests/device.test.ts @@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { refreshDatabase } from '@stacksjs/testing' import { bulkDestroy, destroy } from '../device/destroy' import { exportPrintDevices } from '../device/export' -import { calculateErrorRate, countPrintsByDeviceId, countTotalPrints, fetchAll, fetchById } from '../device/fetch' +import { calculateErrorRate, calculatePrinterHealth, countPrintsByDeviceId, countTotalPrints, fetchAll, fetchById } from '../device/fetch' import { bulkStore, store } from '../device/store' import { update, updatePrintCount, updateStatus } from '../device/update' import { store as storeReceipt } from '../receipts/store' @@ -589,4 +589,100 @@ describe('Print Device Module', () => { expect(errorRate).toBe(50) // 2 out of 4 receipts have error status }) }) + + describe('printer health calculation', () => { + it('should calculate 0% health when no printers exist', async () => { + const health = await calculatePrinterHealth() + expect(health).toBe(0) + }) + + it('should calculate 100% health when all printers are online', async () => { + // Create multiple online printers + const printers = [ + { + name: 'Printer 1', + mac_address: '00:11:22:33:44:55', + location: 'Office 101', + terminal: 'TERM001', + status: 'online', + last_ping: Date.now(), + print_count: 0, + }, + { + name: 'Printer 2', + mac_address: 'AA:BB:CC:DD:EE:FF', + location: 'Office 102', + terminal: 'TERM002', + status: 'online', + last_ping: Date.now(), + print_count: 0, + }, + { + name: 'Printer 3', + mac_address: '11:22:33:44:55:66', + location: 'Office 103', + terminal: 'TERM003', + status: 'online', + last_ping: Date.now(), + print_count: 0, + }, + ] + + for (const printer of printers) { + await store(new TestRequest(printer) as any) + } + + const health = await calculatePrinterHealth() + expect(health).toBe(100) + }) + + it('should calculate correct health percentage with mixed printer statuses', async () => { + // Create printers with different statuses + const printers = [ + { + name: 'Online Printer', + mac_address: '00:11:22:33:44:55', + location: 'Office 101', + terminal: 'TERM001', + status: 'online', + last_ping: Date.now(), + print_count: 0, + }, + { + name: 'Offline Printer', + mac_address: 'AA:BB:CC:DD:EE:FF', + location: 'Office 102', + terminal: 'TERM002', + status: 'offline', + last_ping: Date.now(), + print_count: 0, + }, + { + name: 'Warning Printer', + mac_address: '11:22:33:44:55:66', + location: 'Office 103', + terminal: 'TERM003', + status: 'warning', + last_ping: Date.now(), + print_count: 0, + }, + { + name: 'Online Printer 2', + mac_address: '22:33:44:55:66:77', + location: 'Office 104', + terminal: 'TERM004', + status: 'online', + last_ping: Date.now(), + print_count: 0, + }, + ] + + for (const printer of printers) { + await store(new TestRequest(printer) as any) + } + + const health = await calculatePrinterHealth() + expect(health).toBe(50) // 2 out of 4 printers are online + }) + }) }) From 8f053157b5c1cb62a643dc399070fca55c0f5ddd Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Tue, 1 Apr 2025 21:09:00 +0800 Subject: [PATCH 40/78] chore: wip --- .../core/commerce/src/device/fetch.ts | 20 ++++++ .../core/commerce/src/tests/device.test.ts | 62 ++++++++++++++++++- 2 files changed, 81 insertions(+), 1 deletion(-) diff --git a/storage/framework/core/commerce/src/device/fetch.ts b/storage/framework/core/commerce/src/device/fetch.ts index 4f64e8ace6..ca43994c71 100644 --- a/storage/framework/core/commerce/src/device/fetch.ts +++ b/storage/framework/core/commerce/src/device/fetch.ts @@ -108,3 +108,23 @@ export async function calculatePrinterHealth(): Promise { return Number(((result.online_count ?? 0) / result.total) * 100) } + +/** + * Get printer counts by status for visualization + */ +export async function getPrinterStatusCounts(): Promise> { + const result = await db + .selectFrom('print_devices') + .select([ + 'status', + db.fn.count('id').as('count'), + ]) + .groupBy('status') + .execute() + + // Convert array to object with status as key and count as value + return result.reduce((acc, curr) => { + acc[curr.status as string] = curr.count + return acc + }, {} as Record) +} diff --git a/storage/framework/core/commerce/src/tests/device.test.ts b/storage/framework/core/commerce/src/tests/device.test.ts index 1e26e79cab..f67d4671a6 100644 --- a/storage/framework/core/commerce/src/tests/device.test.ts +++ b/storage/framework/core/commerce/src/tests/device.test.ts @@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { refreshDatabase } from '@stacksjs/testing' import { bulkDestroy, destroy } from '../device/destroy' import { exportPrintDevices } from '../device/export' -import { calculateErrorRate, calculatePrinterHealth, countPrintsByDeviceId, countTotalPrints, fetchAll, fetchById } from '../device/fetch' +import { calculateErrorRate, calculatePrinterHealth, countPrintsByDeviceId, countTotalPrints, fetchAll, fetchById, getPrinterStatusCounts } from '../device/fetch' import { bulkStore, store } from '../device/store' import { update, updatePrintCount, updateStatus } from '../device/update' import { store as storeReceipt } from '../receipts/store' @@ -685,4 +685,64 @@ describe('Print Device Module', () => { expect(health).toBe(50) // 2 out of 4 printers are online }) }) + + describe('printer status counts', () => { + it('should return empty object when no printers exist', async () => { + const counts = await getPrinterStatusCounts() + expect(counts).toEqual({}) + }) + + it('should return correct counts for each status', async () => { + // Create printers with different statuses + const printers = [ + { + name: 'Online Printer 1', + mac_address: '00:11:22:33:44:55', + location: 'Office 101', + terminal: 'TERM001', + status: 'online', + last_ping: Date.now(), + print_count: 0, + }, + { + name: 'Online Printer 2', + mac_address: 'AA:BB:CC:DD:EE:FF', + location: 'Office 102', + terminal: 'TERM002', + status: 'online', + last_ping: Date.now(), + print_count: 0, + }, + { + name: 'Offline Printer', + mac_address: '11:22:33:44:55:66', + location: 'Office 103', + terminal: 'TERM003', + status: 'offline', + last_ping: Date.now(), + print_count: 0, + }, + { + name: 'Warning Printer', + mac_address: '22:33:44:55:66:77', + location: 'Office 104', + terminal: 'TERM004', + status: 'warning', + last_ping: Date.now(), + print_count: 0, + }, + ] + + for (const printer of printers) { + await store(new TestRequest(printer) as any) + } + + const counts = await getPrinterStatusCounts() + expect(counts).toEqual({ + online: 2, + offline: 1, + warning: 1, + }) + }) + }) }) From d690da1b87f6055a5c5aab74e547ea1eeabbd77c Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Tue, 1 Apr 2025 21:55:59 +0800 Subject: [PATCH 41/78] chore: wip --- .../core/commerce/src/orders/fetch.ts | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/storage/framework/core/commerce/src/orders/fetch.ts b/storage/framework/core/commerce/src/orders/fetch.ts index 4137295d22..fe9377e253 100644 --- a/storage/framework/core/commerce/src/orders/fetch.ts +++ b/storage/framework/core/commerce/src/orders/fetch.ts @@ -8,12 +8,19 @@ import { db } from '@stacksjs/database' /** * Fetch all orders from the database with their items + * @param limit Optional limit on number of orders to fetch */ -export async function fetchAll(): Promise { - const orders = await db +export async function fetchAll(limit?: number): Promise { + let query = db .selectFrom('orders') .selectAll() - .execute() + .orderBy('created_at', 'desc') + + if (limit) { + query = query.limit(limit) + } + + const orders = await query.execute() // Fetch items for each order return await Promise.all(orders.map(async (order) => { @@ -30,6 +37,14 @@ export async function fetchAll(): Promise { })) } +/** + * Fetch the most recent orders + * @param limit Number of recent orders to fetch (default: 10) + */ +export async function fetchRecent(limit: number = 10): Promise { + return fetchAll(limit) +} + /** * Fetch an order by ID */ From 7909bda0d4578f927627aec5d490546bf9432b50 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Tue, 1 Apr 2025 22:03:11 +0800 Subject: [PATCH 42/78] chore: wip --- .../Actions/Commerce/CustomerIndexAction.ts | 0 .../Actions/Commerce/CustomerShowAction.ts | 0 .../Actions/Commerce/CustomerStoreAction.ts | 0 .../Actions/Commerce/CustomerUpdateAction.ts | 0 .../Actions/Commerce/DeliveryRouteDestroyAction.ts | 0 .../Actions/Commerce/DeliveryRouteIndexAction.ts | 0 .../Actions/Commerce/DeliveryRouteShowAction.ts | 0 .../Actions/Commerce/DeliveryRouteStoreAction.ts | 0 .../Actions/Commerce/DeliveryRouteUpdateAction.ts | 0 .../Actions/Commerce/DigitalDeliveryDestroyAction.ts | 0 .../Actions/Commerce/DigitalDeliveryIndexAction.ts | 0 .../Actions/Commerce/DigitalDeliveryShowAction.ts | 0 .../Actions/Commerce/DigitalDeliveryStoreAction.ts | 0 .../Actions/Commerce/DigitalDeliveryUpdateAction.ts | 0 .../Actions/Commerce/DriverIndexAction.ts | 0 .../Actions/Commerce/DriverShowAction.ts | 0 .../Actions/Commerce/DriverStoreAction.ts | 0 .../Actions/Commerce/DriverUpdateAction.ts | 0 .../Actions/Commerce/GiftCardIndexAction.ts | 0 .../Actions/Commerce/GiftCardShowAction.ts | 0 .../Actions/Commerce/GiftCardStoreAction.ts | 0 .../Actions/Commerce/LicenseKeyDestroyAction.ts | 0 .../Actions/Commerce/LicenseKeyIndexAction.ts | 0 .../Actions/Commerce/LicenseKeyShowAction.ts | 0 .../Actions/Commerce/LicenseKeyStoreAction.ts | 0 .../Actions/Commerce/LicenseKeyUpdateAction.ts | 0 .../Actions/Commerce/LoyaltyPointIndexAction.ts | 0 .../Actions/Commerce/LoyaltyPointShowAction.ts | 0 .../Actions/Commerce/LoyaltyPointStoreAction.ts | 0 .../Actions/Commerce/LoyaltyRewardIndexAction.ts | 0 .../Actions/Commerce/LoyaltyRewardShowAction.ts | 0 .../Actions/Commerce/LoyaltyRewardStoreAction.ts | 0 .../Actions/Commerce/ManufacturerIndexAction.ts | 0 .../Actions/Commerce/ManufacturerShowAction.ts | 0 .../Actions/Commerce/ManufacturerStoreAction.ts | 0 .../Actions/Commerce/OrderIndexAction.ts | 0 .../Actions/Commerce/OrderShowAction.ts | 0 .../Actions/Commerce/OrderStoreAction.ts | 0 .../Actions/Commerce/PaymentIndexAction.ts | 0 .../Actions/Commerce/PaymentShowAction.ts | 0 .../Actions/Commerce/PaymentStoreAction.ts | 0 .../Actions/Commerce/PrintDeviceDestroyAction.ts | 0 .../Actions/Commerce/PrintDeviceIndexAction.ts | 0 .../Actions/Commerce/PrintDeviceShowAction.ts | 0 .../Actions/Commerce/PrintDeviceStoreAction.ts | 0 .../Actions/Commerce/PrintDeviceUpdateAction.ts | 0 .../Actions/Commerce/ProductIndexAction.ts | 0 .../Actions/Commerce/ProductItemIndexAction.ts | 0 .../Actions/Commerce/ProductItemShowAction.ts | 0 .../Actions/Commerce/ProductItemStoreAction.ts | 0 .../Actions/Commerce/ProductManufacturerIndexAction.ts | 0 .../Actions/Commerce/ProductManufacturerShowAction.ts | 0 .../Actions/Commerce/ProductManufacturerStoreAction.ts | 0 .../Actions/Commerce/ProductShowAction.ts | 0 .../Actions/Commerce/ProductStoreAction.ts | 0 .../Actions/Commerce/ProductUnitIndexAction.ts | 0 .../Actions/Commerce/ProductUnitShowAction.ts | 0 .../Actions/Commerce/ProductUnitStoreAction.ts | 0 .../Actions/Commerce/ProductVariantDestroyAction.ts | 0 .../Actions/Commerce/ProductVariantIndexAction.ts | 0 .../Actions/Commerce/ProductVariantShowAction.ts | 0 .../Actions/Commerce/ProductVariantStoreAction.ts | 0 .../Actions/Commerce/ProductVariantUpdateAction.ts | 0 .../Actions/Commerce/ReceiptDestroyAction.ts | 0 .../Actions/Commerce/ReceiptIndexAction.ts | 0 .../Actions/Commerce/ReceiptShowAction.ts | 0 .../Actions/Commerce/ReceiptStoreAction.ts | 0 .../Actions/Commerce/ReceiptUpdateAction.ts | 0 .../Actions/Commerce/ReviewIndexAction.ts | 0 .../Actions/Commerce/ReviewShowAction.ts | 0 .../Actions/Commerce/ReviewStoreAction.ts | 0 .../Actions/Commerce/ShippingMethodDestroyAction.ts | 0 .../Actions/Commerce/ShippingMethodIndexAction.ts | 0 .../Actions/Commerce/ShippingMethodShowAction.ts | 0 .../Actions/Commerce/ShippingMethodStoreAction.ts | 0 .../Actions/Commerce/ShippingMethodUpdateAction.ts | 0 .../Actions/Commerce/ShippingRateDestroyAction.ts | 0 .../Actions/Commerce/ShippingRateIndexAction.ts | 0 .../Actions/Commerce/ShippingRateShowAction.ts | 0 .../Actions/Commerce/ShippingRateStoreAction.ts | 0 .../Actions/Commerce/ShippingRateUpdateAction.ts | 0 .../Actions/Commerce/ShippingZoneDestroyAction.ts | 0 .../Actions/Commerce/ShippingZoneIndexAction.ts | 0 .../Actions/Commerce/ShippingZoneShowAction.ts | 0 .../Actions/Commerce/ShippingZoneStoreAction.ts | 0 .../Actions/Commerce/ShippingZoneUpdateAction.ts | 0 .../Actions/Commerce/TaxRateDestroyAction.ts | 0 .../Actions/Commerce/TaxRateIndexAction.ts | 0 .../Actions/Commerce/TaxRateShowAction.ts | 0 .../Actions/Commerce/TaxRateStoreAction.ts | 0 .../Actions/Commerce/TaxRateUpdateAction.ts | 0 .../Actions/Commerce/TransactionIndexAction.ts | 0 .../Actions/Commerce/TransactionShowAction.ts | 0 .../Actions/Commerce/TransactionStoreAction.ts | 0 .../Actions/Commerce/WaitlistProductDestroyAction.ts | 0 .../Actions/Commerce/WaitlistProductIndexAction.ts | 0 .../Actions/Commerce/WaitlistProductShowAction.ts | 0 .../Actions/Commerce/WaitlistProductStoreAction.ts | 0 .../Actions/Commerce/WaitlistProductUpdateAction.ts | 0 .../Actions/Commerce/WaitlistRestaurantDestroyAction.ts | 0 .../Actions/Commerce/WaitlistRestaurantIndexAction.ts | 0 .../Actions/Commerce/WaitlistRestaurantShowAction.ts | 0 .../Actions/Commerce/WaitlistRestaurantStoreAction.ts | 0 .../Actions/Commerce/WaitlistRestaurantUpdateAction.ts | 0 104 files changed, 0 insertions(+), 0 deletions(-) rename storage/framework/actions/src/CustomerIndexOrmAction.ts => app/Actions/Commerce/CustomerIndexAction.ts (100%) rename storage/framework/actions/src/CustomerShowOrmAction.ts => app/Actions/Commerce/CustomerShowAction.ts (100%) rename storage/framework/actions/src/CustomerStoreOrmAction.ts => app/Actions/Commerce/CustomerStoreAction.ts (100%) rename storage/framework/actions/src/CustomerUpdateOrmAction.ts => app/Actions/Commerce/CustomerUpdateAction.ts (100%) rename storage/framework/actions/src/DeliveryRouteDestroyOrmAction.ts => app/Actions/Commerce/DeliveryRouteDestroyAction.ts (100%) rename storage/framework/actions/src/DeliveryRouteIndexOrmAction.ts => app/Actions/Commerce/DeliveryRouteIndexAction.ts (100%) rename storage/framework/actions/src/DeliveryRouteShowOrmAction.ts => app/Actions/Commerce/DeliveryRouteShowAction.ts (100%) rename storage/framework/actions/src/DeliveryRouteStoreOrmAction.ts => app/Actions/Commerce/DeliveryRouteStoreAction.ts (100%) rename storage/framework/actions/src/DeliveryRouteUpdateOrmAction.ts => app/Actions/Commerce/DeliveryRouteUpdateAction.ts (100%) rename storage/framework/actions/src/DigitalDeliveryDestroyOrmAction.ts => app/Actions/Commerce/DigitalDeliveryDestroyAction.ts (100%) rename storage/framework/actions/src/DigitalDeliveryIndexOrmAction.ts => app/Actions/Commerce/DigitalDeliveryIndexAction.ts (100%) rename storage/framework/actions/src/DigitalDeliveryShowOrmAction.ts => app/Actions/Commerce/DigitalDeliveryShowAction.ts (100%) rename storage/framework/actions/src/DigitalDeliveryStoreOrmAction.ts => app/Actions/Commerce/DigitalDeliveryStoreAction.ts (100%) rename storage/framework/actions/src/DigitalDeliveryUpdateOrmAction.ts => app/Actions/Commerce/DigitalDeliveryUpdateAction.ts (100%) rename storage/framework/actions/src/DriverIndexOrmAction.ts => app/Actions/Commerce/DriverIndexAction.ts (100%) rename storage/framework/actions/src/DriverShowOrmAction.ts => app/Actions/Commerce/DriverShowAction.ts (100%) rename storage/framework/actions/src/DriverStoreOrmAction.ts => app/Actions/Commerce/DriverStoreAction.ts (100%) rename storage/framework/actions/src/DriverUpdateOrmAction.ts => app/Actions/Commerce/DriverUpdateAction.ts (100%) rename storage/framework/actions/src/GiftCardIndexOrmAction.ts => app/Actions/Commerce/GiftCardIndexAction.ts (100%) rename storage/framework/actions/src/GiftCardShowOrmAction.ts => app/Actions/Commerce/GiftCardShowAction.ts (100%) rename storage/framework/actions/src/GiftCardStoreOrmAction.ts => app/Actions/Commerce/GiftCardStoreAction.ts (100%) rename storage/framework/actions/src/LicenseKeyDestroyOrmAction.ts => app/Actions/Commerce/LicenseKeyDestroyAction.ts (100%) rename storage/framework/actions/src/LicenseKeyIndexOrmAction.ts => app/Actions/Commerce/LicenseKeyIndexAction.ts (100%) rename storage/framework/actions/src/LicenseKeyShowOrmAction.ts => app/Actions/Commerce/LicenseKeyShowAction.ts (100%) rename storage/framework/actions/src/LicenseKeyStoreOrmAction.ts => app/Actions/Commerce/LicenseKeyStoreAction.ts (100%) rename storage/framework/actions/src/LicenseKeyUpdateOrmAction.ts => app/Actions/Commerce/LicenseKeyUpdateAction.ts (100%) rename storage/framework/actions/src/LoyaltyPointIndexOrmAction.ts => app/Actions/Commerce/LoyaltyPointIndexAction.ts (100%) rename storage/framework/actions/src/LoyaltyPointShowOrmAction.ts => app/Actions/Commerce/LoyaltyPointShowAction.ts (100%) rename storage/framework/actions/src/LoyaltyPointStoreOrmAction.ts => app/Actions/Commerce/LoyaltyPointStoreAction.ts (100%) rename storage/framework/actions/src/LoyaltyRewardIndexOrmAction.ts => app/Actions/Commerce/LoyaltyRewardIndexAction.ts (100%) rename storage/framework/actions/src/LoyaltyRewardShowOrmAction.ts => app/Actions/Commerce/LoyaltyRewardShowAction.ts (100%) rename storage/framework/actions/src/LoyaltyRewardStoreOrmAction.ts => app/Actions/Commerce/LoyaltyRewardStoreAction.ts (100%) rename storage/framework/actions/src/ManufacturerIndexOrmAction.ts => app/Actions/Commerce/ManufacturerIndexAction.ts (100%) rename storage/framework/actions/src/ManufacturerShowOrmAction.ts => app/Actions/Commerce/ManufacturerShowAction.ts (100%) rename storage/framework/actions/src/ManufacturerStoreOrmAction.ts => app/Actions/Commerce/ManufacturerStoreAction.ts (100%) rename storage/framework/actions/src/OrderIndexOrmAction.ts => app/Actions/Commerce/OrderIndexAction.ts (100%) rename storage/framework/actions/src/OrderShowOrmAction.ts => app/Actions/Commerce/OrderShowAction.ts (100%) rename storage/framework/actions/src/OrderStoreOrmAction.ts => app/Actions/Commerce/OrderStoreAction.ts (100%) rename storage/framework/actions/src/PaymentIndexOrmAction.ts => app/Actions/Commerce/PaymentIndexAction.ts (100%) rename storage/framework/actions/src/PaymentShowOrmAction.ts => app/Actions/Commerce/PaymentShowAction.ts (100%) rename storage/framework/actions/src/PaymentStoreOrmAction.ts => app/Actions/Commerce/PaymentStoreAction.ts (100%) rename storage/framework/actions/src/PrintDeviceDestroyOrmAction.ts => app/Actions/Commerce/PrintDeviceDestroyAction.ts (100%) rename storage/framework/actions/src/PrintDeviceIndexOrmAction.ts => app/Actions/Commerce/PrintDeviceIndexAction.ts (100%) rename storage/framework/actions/src/PrintDeviceShowOrmAction.ts => app/Actions/Commerce/PrintDeviceShowAction.ts (100%) rename storage/framework/actions/src/PrintDeviceStoreOrmAction.ts => app/Actions/Commerce/PrintDeviceStoreAction.ts (100%) rename storage/framework/actions/src/PrintDeviceUpdateOrmAction.ts => app/Actions/Commerce/PrintDeviceUpdateAction.ts (100%) rename storage/framework/actions/src/ProductIndexOrmAction.ts => app/Actions/Commerce/ProductIndexAction.ts (100%) rename storage/framework/actions/src/ProductItemIndexOrmAction.ts => app/Actions/Commerce/ProductItemIndexAction.ts (100%) rename storage/framework/actions/src/ProductItemShowOrmAction.ts => app/Actions/Commerce/ProductItemShowAction.ts (100%) rename storage/framework/actions/src/ProductItemStoreOrmAction.ts => app/Actions/Commerce/ProductItemStoreAction.ts (100%) rename storage/framework/actions/src/ProductManufacturerIndexOrmAction.ts => app/Actions/Commerce/ProductManufacturerIndexAction.ts (100%) rename storage/framework/actions/src/ProductManufacturerShowOrmAction.ts => app/Actions/Commerce/ProductManufacturerShowAction.ts (100%) rename storage/framework/actions/src/ProductManufacturerStoreOrmAction.ts => app/Actions/Commerce/ProductManufacturerStoreAction.ts (100%) rename storage/framework/actions/src/ProductShowOrmAction.ts => app/Actions/Commerce/ProductShowAction.ts (100%) rename storage/framework/actions/src/ProductStoreOrmAction.ts => app/Actions/Commerce/ProductStoreAction.ts (100%) rename storage/framework/actions/src/ProductUnitIndexOrmAction.ts => app/Actions/Commerce/ProductUnitIndexAction.ts (100%) rename storage/framework/actions/src/ProductUnitShowOrmAction.ts => app/Actions/Commerce/ProductUnitShowAction.ts (100%) rename storage/framework/actions/src/ProductUnitStoreOrmAction.ts => app/Actions/Commerce/ProductUnitStoreAction.ts (100%) rename storage/framework/actions/src/ProductVariantDestroyOrmAction.ts => app/Actions/Commerce/ProductVariantDestroyAction.ts (100%) rename storage/framework/actions/src/ProductVariantIndexOrmAction.ts => app/Actions/Commerce/ProductVariantIndexAction.ts (100%) rename storage/framework/actions/src/ProductVariantShowOrmAction.ts => app/Actions/Commerce/ProductVariantShowAction.ts (100%) rename storage/framework/actions/src/ProductVariantStoreOrmAction.ts => app/Actions/Commerce/ProductVariantStoreAction.ts (100%) rename storage/framework/actions/src/ProductVariantUpdateOrmAction.ts => app/Actions/Commerce/ProductVariantUpdateAction.ts (100%) rename storage/framework/actions/src/ReceiptDestroyOrmAction.ts => app/Actions/Commerce/ReceiptDestroyAction.ts (100%) rename storage/framework/actions/src/ReceiptIndexOrmAction.ts => app/Actions/Commerce/ReceiptIndexAction.ts (100%) rename storage/framework/actions/src/ReceiptShowOrmAction.ts => app/Actions/Commerce/ReceiptShowAction.ts (100%) rename storage/framework/actions/src/ReceiptStoreOrmAction.ts => app/Actions/Commerce/ReceiptStoreAction.ts (100%) rename storage/framework/actions/src/ReceiptUpdateOrmAction.ts => app/Actions/Commerce/ReceiptUpdateAction.ts (100%) rename storage/framework/actions/src/ReviewIndexOrmAction.ts => app/Actions/Commerce/ReviewIndexAction.ts (100%) rename storage/framework/actions/src/ReviewShowOrmAction.ts => app/Actions/Commerce/ReviewShowAction.ts (100%) rename storage/framework/actions/src/ReviewStoreOrmAction.ts => app/Actions/Commerce/ReviewStoreAction.ts (100%) rename storage/framework/actions/src/ShippingMethodDestroyOrmAction.ts => app/Actions/Commerce/ShippingMethodDestroyAction.ts (100%) rename storage/framework/actions/src/ShippingMethodIndexOrmAction.ts => app/Actions/Commerce/ShippingMethodIndexAction.ts (100%) rename storage/framework/actions/src/ShippingMethodShowOrmAction.ts => app/Actions/Commerce/ShippingMethodShowAction.ts (100%) rename storage/framework/actions/src/ShippingMethodStoreOrmAction.ts => app/Actions/Commerce/ShippingMethodStoreAction.ts (100%) rename storage/framework/actions/src/ShippingMethodUpdateOrmAction.ts => app/Actions/Commerce/ShippingMethodUpdateAction.ts (100%) rename storage/framework/actions/src/ShippingRateDestroyOrmAction.ts => app/Actions/Commerce/ShippingRateDestroyAction.ts (100%) rename storage/framework/actions/src/ShippingRateIndexOrmAction.ts => app/Actions/Commerce/ShippingRateIndexAction.ts (100%) rename storage/framework/actions/src/ShippingRateShowOrmAction.ts => app/Actions/Commerce/ShippingRateShowAction.ts (100%) rename storage/framework/actions/src/ShippingRateStoreOrmAction.ts => app/Actions/Commerce/ShippingRateStoreAction.ts (100%) rename storage/framework/actions/src/ShippingRateUpdateOrmAction.ts => app/Actions/Commerce/ShippingRateUpdateAction.ts (100%) rename storage/framework/actions/src/ShippingZoneDestroyOrmAction.ts => app/Actions/Commerce/ShippingZoneDestroyAction.ts (100%) rename storage/framework/actions/src/ShippingZoneIndexOrmAction.ts => app/Actions/Commerce/ShippingZoneIndexAction.ts (100%) rename storage/framework/actions/src/ShippingZoneShowOrmAction.ts => app/Actions/Commerce/ShippingZoneShowAction.ts (100%) rename storage/framework/actions/src/ShippingZoneStoreOrmAction.ts => app/Actions/Commerce/ShippingZoneStoreAction.ts (100%) rename storage/framework/actions/src/ShippingZoneUpdateOrmAction.ts => app/Actions/Commerce/ShippingZoneUpdateAction.ts (100%) rename storage/framework/actions/src/TaxRateDestroyOrmAction.ts => app/Actions/Commerce/TaxRateDestroyAction.ts (100%) rename storage/framework/actions/src/TaxRateIndexOrmAction.ts => app/Actions/Commerce/TaxRateIndexAction.ts (100%) rename storage/framework/actions/src/TaxRateShowOrmAction.ts => app/Actions/Commerce/TaxRateShowAction.ts (100%) rename storage/framework/actions/src/TaxRateStoreOrmAction.ts => app/Actions/Commerce/TaxRateStoreAction.ts (100%) rename storage/framework/actions/src/TaxRateUpdateOrmAction.ts => app/Actions/Commerce/TaxRateUpdateAction.ts (100%) rename storage/framework/actions/src/TransactionIndexOrmAction.ts => app/Actions/Commerce/TransactionIndexAction.ts (100%) rename storage/framework/actions/src/TransactionShowOrmAction.ts => app/Actions/Commerce/TransactionShowAction.ts (100%) rename storage/framework/actions/src/TransactionStoreOrmAction.ts => app/Actions/Commerce/TransactionStoreAction.ts (100%) rename storage/framework/actions/src/WaitlistProductDestroyOrmAction.ts => app/Actions/Commerce/WaitlistProductDestroyAction.ts (100%) rename storage/framework/actions/src/WaitlistProductIndexOrmAction.ts => app/Actions/Commerce/WaitlistProductIndexAction.ts (100%) rename storage/framework/actions/src/WaitlistProductShowOrmAction.ts => app/Actions/Commerce/WaitlistProductShowAction.ts (100%) rename storage/framework/actions/src/WaitlistProductStoreOrmAction.ts => app/Actions/Commerce/WaitlistProductStoreAction.ts (100%) rename storage/framework/actions/src/WaitlistProductUpdateOrmAction.ts => app/Actions/Commerce/WaitlistProductUpdateAction.ts (100%) rename storage/framework/actions/src/WaitlistRestaurantDestroyOrmAction.ts => app/Actions/Commerce/WaitlistRestaurantDestroyAction.ts (100%) rename storage/framework/actions/src/WaitlistRestaurantIndexOrmAction.ts => app/Actions/Commerce/WaitlistRestaurantIndexAction.ts (100%) rename storage/framework/actions/src/WaitlistRestaurantShowOrmAction.ts => app/Actions/Commerce/WaitlistRestaurantShowAction.ts (100%) rename storage/framework/actions/src/WaitlistRestaurantStoreOrmAction.ts => app/Actions/Commerce/WaitlistRestaurantStoreAction.ts (100%) rename storage/framework/actions/src/WaitlistRestaurantUpdateOrmAction.ts => app/Actions/Commerce/WaitlistRestaurantUpdateAction.ts (100%) diff --git a/storage/framework/actions/src/CustomerIndexOrmAction.ts b/app/Actions/Commerce/CustomerIndexAction.ts similarity index 100% rename from storage/framework/actions/src/CustomerIndexOrmAction.ts rename to app/Actions/Commerce/CustomerIndexAction.ts diff --git a/storage/framework/actions/src/CustomerShowOrmAction.ts b/app/Actions/Commerce/CustomerShowAction.ts similarity index 100% rename from storage/framework/actions/src/CustomerShowOrmAction.ts rename to app/Actions/Commerce/CustomerShowAction.ts diff --git a/storage/framework/actions/src/CustomerStoreOrmAction.ts b/app/Actions/Commerce/CustomerStoreAction.ts similarity index 100% rename from storage/framework/actions/src/CustomerStoreOrmAction.ts rename to app/Actions/Commerce/CustomerStoreAction.ts diff --git a/storage/framework/actions/src/CustomerUpdateOrmAction.ts b/app/Actions/Commerce/CustomerUpdateAction.ts similarity index 100% rename from storage/framework/actions/src/CustomerUpdateOrmAction.ts rename to app/Actions/Commerce/CustomerUpdateAction.ts diff --git a/storage/framework/actions/src/DeliveryRouteDestroyOrmAction.ts b/app/Actions/Commerce/DeliveryRouteDestroyAction.ts similarity index 100% rename from storage/framework/actions/src/DeliveryRouteDestroyOrmAction.ts rename to app/Actions/Commerce/DeliveryRouteDestroyAction.ts diff --git a/storage/framework/actions/src/DeliveryRouteIndexOrmAction.ts b/app/Actions/Commerce/DeliveryRouteIndexAction.ts similarity index 100% rename from storage/framework/actions/src/DeliveryRouteIndexOrmAction.ts rename to app/Actions/Commerce/DeliveryRouteIndexAction.ts diff --git a/storage/framework/actions/src/DeliveryRouteShowOrmAction.ts b/app/Actions/Commerce/DeliveryRouteShowAction.ts similarity index 100% rename from storage/framework/actions/src/DeliveryRouteShowOrmAction.ts rename to app/Actions/Commerce/DeliveryRouteShowAction.ts diff --git a/storage/framework/actions/src/DeliveryRouteStoreOrmAction.ts b/app/Actions/Commerce/DeliveryRouteStoreAction.ts similarity index 100% rename from storage/framework/actions/src/DeliveryRouteStoreOrmAction.ts rename to app/Actions/Commerce/DeliveryRouteStoreAction.ts diff --git a/storage/framework/actions/src/DeliveryRouteUpdateOrmAction.ts b/app/Actions/Commerce/DeliveryRouteUpdateAction.ts similarity index 100% rename from storage/framework/actions/src/DeliveryRouteUpdateOrmAction.ts rename to app/Actions/Commerce/DeliveryRouteUpdateAction.ts diff --git a/storage/framework/actions/src/DigitalDeliveryDestroyOrmAction.ts b/app/Actions/Commerce/DigitalDeliveryDestroyAction.ts similarity index 100% rename from storage/framework/actions/src/DigitalDeliveryDestroyOrmAction.ts rename to app/Actions/Commerce/DigitalDeliveryDestroyAction.ts diff --git a/storage/framework/actions/src/DigitalDeliveryIndexOrmAction.ts b/app/Actions/Commerce/DigitalDeliveryIndexAction.ts similarity index 100% rename from storage/framework/actions/src/DigitalDeliveryIndexOrmAction.ts rename to app/Actions/Commerce/DigitalDeliveryIndexAction.ts diff --git a/storage/framework/actions/src/DigitalDeliveryShowOrmAction.ts b/app/Actions/Commerce/DigitalDeliveryShowAction.ts similarity index 100% rename from storage/framework/actions/src/DigitalDeliveryShowOrmAction.ts rename to app/Actions/Commerce/DigitalDeliveryShowAction.ts diff --git a/storage/framework/actions/src/DigitalDeliveryStoreOrmAction.ts b/app/Actions/Commerce/DigitalDeliveryStoreAction.ts similarity index 100% rename from storage/framework/actions/src/DigitalDeliveryStoreOrmAction.ts rename to app/Actions/Commerce/DigitalDeliveryStoreAction.ts diff --git a/storage/framework/actions/src/DigitalDeliveryUpdateOrmAction.ts b/app/Actions/Commerce/DigitalDeliveryUpdateAction.ts similarity index 100% rename from storage/framework/actions/src/DigitalDeliveryUpdateOrmAction.ts rename to app/Actions/Commerce/DigitalDeliveryUpdateAction.ts diff --git a/storage/framework/actions/src/DriverIndexOrmAction.ts b/app/Actions/Commerce/DriverIndexAction.ts similarity index 100% rename from storage/framework/actions/src/DriverIndexOrmAction.ts rename to app/Actions/Commerce/DriverIndexAction.ts diff --git a/storage/framework/actions/src/DriverShowOrmAction.ts b/app/Actions/Commerce/DriverShowAction.ts similarity index 100% rename from storage/framework/actions/src/DriverShowOrmAction.ts rename to app/Actions/Commerce/DriverShowAction.ts diff --git a/storage/framework/actions/src/DriverStoreOrmAction.ts b/app/Actions/Commerce/DriverStoreAction.ts similarity index 100% rename from storage/framework/actions/src/DriverStoreOrmAction.ts rename to app/Actions/Commerce/DriverStoreAction.ts diff --git a/storage/framework/actions/src/DriverUpdateOrmAction.ts b/app/Actions/Commerce/DriverUpdateAction.ts similarity index 100% rename from storage/framework/actions/src/DriverUpdateOrmAction.ts rename to app/Actions/Commerce/DriverUpdateAction.ts diff --git a/storage/framework/actions/src/GiftCardIndexOrmAction.ts b/app/Actions/Commerce/GiftCardIndexAction.ts similarity index 100% rename from storage/framework/actions/src/GiftCardIndexOrmAction.ts rename to app/Actions/Commerce/GiftCardIndexAction.ts diff --git a/storage/framework/actions/src/GiftCardShowOrmAction.ts b/app/Actions/Commerce/GiftCardShowAction.ts similarity index 100% rename from storage/framework/actions/src/GiftCardShowOrmAction.ts rename to app/Actions/Commerce/GiftCardShowAction.ts diff --git a/storage/framework/actions/src/GiftCardStoreOrmAction.ts b/app/Actions/Commerce/GiftCardStoreAction.ts similarity index 100% rename from storage/framework/actions/src/GiftCardStoreOrmAction.ts rename to app/Actions/Commerce/GiftCardStoreAction.ts diff --git a/storage/framework/actions/src/LicenseKeyDestroyOrmAction.ts b/app/Actions/Commerce/LicenseKeyDestroyAction.ts similarity index 100% rename from storage/framework/actions/src/LicenseKeyDestroyOrmAction.ts rename to app/Actions/Commerce/LicenseKeyDestroyAction.ts diff --git a/storage/framework/actions/src/LicenseKeyIndexOrmAction.ts b/app/Actions/Commerce/LicenseKeyIndexAction.ts similarity index 100% rename from storage/framework/actions/src/LicenseKeyIndexOrmAction.ts rename to app/Actions/Commerce/LicenseKeyIndexAction.ts diff --git a/storage/framework/actions/src/LicenseKeyShowOrmAction.ts b/app/Actions/Commerce/LicenseKeyShowAction.ts similarity index 100% rename from storage/framework/actions/src/LicenseKeyShowOrmAction.ts rename to app/Actions/Commerce/LicenseKeyShowAction.ts diff --git a/storage/framework/actions/src/LicenseKeyStoreOrmAction.ts b/app/Actions/Commerce/LicenseKeyStoreAction.ts similarity index 100% rename from storage/framework/actions/src/LicenseKeyStoreOrmAction.ts rename to app/Actions/Commerce/LicenseKeyStoreAction.ts diff --git a/storage/framework/actions/src/LicenseKeyUpdateOrmAction.ts b/app/Actions/Commerce/LicenseKeyUpdateAction.ts similarity index 100% rename from storage/framework/actions/src/LicenseKeyUpdateOrmAction.ts rename to app/Actions/Commerce/LicenseKeyUpdateAction.ts diff --git a/storage/framework/actions/src/LoyaltyPointIndexOrmAction.ts b/app/Actions/Commerce/LoyaltyPointIndexAction.ts similarity index 100% rename from storage/framework/actions/src/LoyaltyPointIndexOrmAction.ts rename to app/Actions/Commerce/LoyaltyPointIndexAction.ts diff --git a/storage/framework/actions/src/LoyaltyPointShowOrmAction.ts b/app/Actions/Commerce/LoyaltyPointShowAction.ts similarity index 100% rename from storage/framework/actions/src/LoyaltyPointShowOrmAction.ts rename to app/Actions/Commerce/LoyaltyPointShowAction.ts diff --git a/storage/framework/actions/src/LoyaltyPointStoreOrmAction.ts b/app/Actions/Commerce/LoyaltyPointStoreAction.ts similarity index 100% rename from storage/framework/actions/src/LoyaltyPointStoreOrmAction.ts rename to app/Actions/Commerce/LoyaltyPointStoreAction.ts diff --git a/storage/framework/actions/src/LoyaltyRewardIndexOrmAction.ts b/app/Actions/Commerce/LoyaltyRewardIndexAction.ts similarity index 100% rename from storage/framework/actions/src/LoyaltyRewardIndexOrmAction.ts rename to app/Actions/Commerce/LoyaltyRewardIndexAction.ts diff --git a/storage/framework/actions/src/LoyaltyRewardShowOrmAction.ts b/app/Actions/Commerce/LoyaltyRewardShowAction.ts similarity index 100% rename from storage/framework/actions/src/LoyaltyRewardShowOrmAction.ts rename to app/Actions/Commerce/LoyaltyRewardShowAction.ts diff --git a/storage/framework/actions/src/LoyaltyRewardStoreOrmAction.ts b/app/Actions/Commerce/LoyaltyRewardStoreAction.ts similarity index 100% rename from storage/framework/actions/src/LoyaltyRewardStoreOrmAction.ts rename to app/Actions/Commerce/LoyaltyRewardStoreAction.ts diff --git a/storage/framework/actions/src/ManufacturerIndexOrmAction.ts b/app/Actions/Commerce/ManufacturerIndexAction.ts similarity index 100% rename from storage/framework/actions/src/ManufacturerIndexOrmAction.ts rename to app/Actions/Commerce/ManufacturerIndexAction.ts diff --git a/storage/framework/actions/src/ManufacturerShowOrmAction.ts b/app/Actions/Commerce/ManufacturerShowAction.ts similarity index 100% rename from storage/framework/actions/src/ManufacturerShowOrmAction.ts rename to app/Actions/Commerce/ManufacturerShowAction.ts diff --git a/storage/framework/actions/src/ManufacturerStoreOrmAction.ts b/app/Actions/Commerce/ManufacturerStoreAction.ts similarity index 100% rename from storage/framework/actions/src/ManufacturerStoreOrmAction.ts rename to app/Actions/Commerce/ManufacturerStoreAction.ts diff --git a/storage/framework/actions/src/OrderIndexOrmAction.ts b/app/Actions/Commerce/OrderIndexAction.ts similarity index 100% rename from storage/framework/actions/src/OrderIndexOrmAction.ts rename to app/Actions/Commerce/OrderIndexAction.ts diff --git a/storage/framework/actions/src/OrderShowOrmAction.ts b/app/Actions/Commerce/OrderShowAction.ts similarity index 100% rename from storage/framework/actions/src/OrderShowOrmAction.ts rename to app/Actions/Commerce/OrderShowAction.ts diff --git a/storage/framework/actions/src/OrderStoreOrmAction.ts b/app/Actions/Commerce/OrderStoreAction.ts similarity index 100% rename from storage/framework/actions/src/OrderStoreOrmAction.ts rename to app/Actions/Commerce/OrderStoreAction.ts diff --git a/storage/framework/actions/src/PaymentIndexOrmAction.ts b/app/Actions/Commerce/PaymentIndexAction.ts similarity index 100% rename from storage/framework/actions/src/PaymentIndexOrmAction.ts rename to app/Actions/Commerce/PaymentIndexAction.ts diff --git a/storage/framework/actions/src/PaymentShowOrmAction.ts b/app/Actions/Commerce/PaymentShowAction.ts similarity index 100% rename from storage/framework/actions/src/PaymentShowOrmAction.ts rename to app/Actions/Commerce/PaymentShowAction.ts diff --git a/storage/framework/actions/src/PaymentStoreOrmAction.ts b/app/Actions/Commerce/PaymentStoreAction.ts similarity index 100% rename from storage/framework/actions/src/PaymentStoreOrmAction.ts rename to app/Actions/Commerce/PaymentStoreAction.ts diff --git a/storage/framework/actions/src/PrintDeviceDestroyOrmAction.ts b/app/Actions/Commerce/PrintDeviceDestroyAction.ts similarity index 100% rename from storage/framework/actions/src/PrintDeviceDestroyOrmAction.ts rename to app/Actions/Commerce/PrintDeviceDestroyAction.ts diff --git a/storage/framework/actions/src/PrintDeviceIndexOrmAction.ts b/app/Actions/Commerce/PrintDeviceIndexAction.ts similarity index 100% rename from storage/framework/actions/src/PrintDeviceIndexOrmAction.ts rename to app/Actions/Commerce/PrintDeviceIndexAction.ts diff --git a/storage/framework/actions/src/PrintDeviceShowOrmAction.ts b/app/Actions/Commerce/PrintDeviceShowAction.ts similarity index 100% rename from storage/framework/actions/src/PrintDeviceShowOrmAction.ts rename to app/Actions/Commerce/PrintDeviceShowAction.ts diff --git a/storage/framework/actions/src/PrintDeviceStoreOrmAction.ts b/app/Actions/Commerce/PrintDeviceStoreAction.ts similarity index 100% rename from storage/framework/actions/src/PrintDeviceStoreOrmAction.ts rename to app/Actions/Commerce/PrintDeviceStoreAction.ts diff --git a/storage/framework/actions/src/PrintDeviceUpdateOrmAction.ts b/app/Actions/Commerce/PrintDeviceUpdateAction.ts similarity index 100% rename from storage/framework/actions/src/PrintDeviceUpdateOrmAction.ts rename to app/Actions/Commerce/PrintDeviceUpdateAction.ts diff --git a/storage/framework/actions/src/ProductIndexOrmAction.ts b/app/Actions/Commerce/ProductIndexAction.ts similarity index 100% rename from storage/framework/actions/src/ProductIndexOrmAction.ts rename to app/Actions/Commerce/ProductIndexAction.ts diff --git a/storage/framework/actions/src/ProductItemIndexOrmAction.ts b/app/Actions/Commerce/ProductItemIndexAction.ts similarity index 100% rename from storage/framework/actions/src/ProductItemIndexOrmAction.ts rename to app/Actions/Commerce/ProductItemIndexAction.ts diff --git a/storage/framework/actions/src/ProductItemShowOrmAction.ts b/app/Actions/Commerce/ProductItemShowAction.ts similarity index 100% rename from storage/framework/actions/src/ProductItemShowOrmAction.ts rename to app/Actions/Commerce/ProductItemShowAction.ts diff --git a/storage/framework/actions/src/ProductItemStoreOrmAction.ts b/app/Actions/Commerce/ProductItemStoreAction.ts similarity index 100% rename from storage/framework/actions/src/ProductItemStoreOrmAction.ts rename to app/Actions/Commerce/ProductItemStoreAction.ts diff --git a/storage/framework/actions/src/ProductManufacturerIndexOrmAction.ts b/app/Actions/Commerce/ProductManufacturerIndexAction.ts similarity index 100% rename from storage/framework/actions/src/ProductManufacturerIndexOrmAction.ts rename to app/Actions/Commerce/ProductManufacturerIndexAction.ts diff --git a/storage/framework/actions/src/ProductManufacturerShowOrmAction.ts b/app/Actions/Commerce/ProductManufacturerShowAction.ts similarity index 100% rename from storage/framework/actions/src/ProductManufacturerShowOrmAction.ts rename to app/Actions/Commerce/ProductManufacturerShowAction.ts diff --git a/storage/framework/actions/src/ProductManufacturerStoreOrmAction.ts b/app/Actions/Commerce/ProductManufacturerStoreAction.ts similarity index 100% rename from storage/framework/actions/src/ProductManufacturerStoreOrmAction.ts rename to app/Actions/Commerce/ProductManufacturerStoreAction.ts diff --git a/storage/framework/actions/src/ProductShowOrmAction.ts b/app/Actions/Commerce/ProductShowAction.ts similarity index 100% rename from storage/framework/actions/src/ProductShowOrmAction.ts rename to app/Actions/Commerce/ProductShowAction.ts diff --git a/storage/framework/actions/src/ProductStoreOrmAction.ts b/app/Actions/Commerce/ProductStoreAction.ts similarity index 100% rename from storage/framework/actions/src/ProductStoreOrmAction.ts rename to app/Actions/Commerce/ProductStoreAction.ts diff --git a/storage/framework/actions/src/ProductUnitIndexOrmAction.ts b/app/Actions/Commerce/ProductUnitIndexAction.ts similarity index 100% rename from storage/framework/actions/src/ProductUnitIndexOrmAction.ts rename to app/Actions/Commerce/ProductUnitIndexAction.ts diff --git a/storage/framework/actions/src/ProductUnitShowOrmAction.ts b/app/Actions/Commerce/ProductUnitShowAction.ts similarity index 100% rename from storage/framework/actions/src/ProductUnitShowOrmAction.ts rename to app/Actions/Commerce/ProductUnitShowAction.ts diff --git a/storage/framework/actions/src/ProductUnitStoreOrmAction.ts b/app/Actions/Commerce/ProductUnitStoreAction.ts similarity index 100% rename from storage/framework/actions/src/ProductUnitStoreOrmAction.ts rename to app/Actions/Commerce/ProductUnitStoreAction.ts diff --git a/storage/framework/actions/src/ProductVariantDestroyOrmAction.ts b/app/Actions/Commerce/ProductVariantDestroyAction.ts similarity index 100% rename from storage/framework/actions/src/ProductVariantDestroyOrmAction.ts rename to app/Actions/Commerce/ProductVariantDestroyAction.ts diff --git a/storage/framework/actions/src/ProductVariantIndexOrmAction.ts b/app/Actions/Commerce/ProductVariantIndexAction.ts similarity index 100% rename from storage/framework/actions/src/ProductVariantIndexOrmAction.ts rename to app/Actions/Commerce/ProductVariantIndexAction.ts diff --git a/storage/framework/actions/src/ProductVariantShowOrmAction.ts b/app/Actions/Commerce/ProductVariantShowAction.ts similarity index 100% rename from storage/framework/actions/src/ProductVariantShowOrmAction.ts rename to app/Actions/Commerce/ProductVariantShowAction.ts diff --git a/storage/framework/actions/src/ProductVariantStoreOrmAction.ts b/app/Actions/Commerce/ProductVariantStoreAction.ts similarity index 100% rename from storage/framework/actions/src/ProductVariantStoreOrmAction.ts rename to app/Actions/Commerce/ProductVariantStoreAction.ts diff --git a/storage/framework/actions/src/ProductVariantUpdateOrmAction.ts b/app/Actions/Commerce/ProductVariantUpdateAction.ts similarity index 100% rename from storage/framework/actions/src/ProductVariantUpdateOrmAction.ts rename to app/Actions/Commerce/ProductVariantUpdateAction.ts diff --git a/storage/framework/actions/src/ReceiptDestroyOrmAction.ts b/app/Actions/Commerce/ReceiptDestroyAction.ts similarity index 100% rename from storage/framework/actions/src/ReceiptDestroyOrmAction.ts rename to app/Actions/Commerce/ReceiptDestroyAction.ts diff --git a/storage/framework/actions/src/ReceiptIndexOrmAction.ts b/app/Actions/Commerce/ReceiptIndexAction.ts similarity index 100% rename from storage/framework/actions/src/ReceiptIndexOrmAction.ts rename to app/Actions/Commerce/ReceiptIndexAction.ts diff --git a/storage/framework/actions/src/ReceiptShowOrmAction.ts b/app/Actions/Commerce/ReceiptShowAction.ts similarity index 100% rename from storage/framework/actions/src/ReceiptShowOrmAction.ts rename to app/Actions/Commerce/ReceiptShowAction.ts diff --git a/storage/framework/actions/src/ReceiptStoreOrmAction.ts b/app/Actions/Commerce/ReceiptStoreAction.ts similarity index 100% rename from storage/framework/actions/src/ReceiptStoreOrmAction.ts rename to app/Actions/Commerce/ReceiptStoreAction.ts diff --git a/storage/framework/actions/src/ReceiptUpdateOrmAction.ts b/app/Actions/Commerce/ReceiptUpdateAction.ts similarity index 100% rename from storage/framework/actions/src/ReceiptUpdateOrmAction.ts rename to app/Actions/Commerce/ReceiptUpdateAction.ts diff --git a/storage/framework/actions/src/ReviewIndexOrmAction.ts b/app/Actions/Commerce/ReviewIndexAction.ts similarity index 100% rename from storage/framework/actions/src/ReviewIndexOrmAction.ts rename to app/Actions/Commerce/ReviewIndexAction.ts diff --git a/storage/framework/actions/src/ReviewShowOrmAction.ts b/app/Actions/Commerce/ReviewShowAction.ts similarity index 100% rename from storage/framework/actions/src/ReviewShowOrmAction.ts rename to app/Actions/Commerce/ReviewShowAction.ts diff --git a/storage/framework/actions/src/ReviewStoreOrmAction.ts b/app/Actions/Commerce/ReviewStoreAction.ts similarity index 100% rename from storage/framework/actions/src/ReviewStoreOrmAction.ts rename to app/Actions/Commerce/ReviewStoreAction.ts diff --git a/storage/framework/actions/src/ShippingMethodDestroyOrmAction.ts b/app/Actions/Commerce/ShippingMethodDestroyAction.ts similarity index 100% rename from storage/framework/actions/src/ShippingMethodDestroyOrmAction.ts rename to app/Actions/Commerce/ShippingMethodDestroyAction.ts diff --git a/storage/framework/actions/src/ShippingMethodIndexOrmAction.ts b/app/Actions/Commerce/ShippingMethodIndexAction.ts similarity index 100% rename from storage/framework/actions/src/ShippingMethodIndexOrmAction.ts rename to app/Actions/Commerce/ShippingMethodIndexAction.ts diff --git a/storage/framework/actions/src/ShippingMethodShowOrmAction.ts b/app/Actions/Commerce/ShippingMethodShowAction.ts similarity index 100% rename from storage/framework/actions/src/ShippingMethodShowOrmAction.ts rename to app/Actions/Commerce/ShippingMethodShowAction.ts diff --git a/storage/framework/actions/src/ShippingMethodStoreOrmAction.ts b/app/Actions/Commerce/ShippingMethodStoreAction.ts similarity index 100% rename from storage/framework/actions/src/ShippingMethodStoreOrmAction.ts rename to app/Actions/Commerce/ShippingMethodStoreAction.ts diff --git a/storage/framework/actions/src/ShippingMethodUpdateOrmAction.ts b/app/Actions/Commerce/ShippingMethodUpdateAction.ts similarity index 100% rename from storage/framework/actions/src/ShippingMethodUpdateOrmAction.ts rename to app/Actions/Commerce/ShippingMethodUpdateAction.ts diff --git a/storage/framework/actions/src/ShippingRateDestroyOrmAction.ts b/app/Actions/Commerce/ShippingRateDestroyAction.ts similarity index 100% rename from storage/framework/actions/src/ShippingRateDestroyOrmAction.ts rename to app/Actions/Commerce/ShippingRateDestroyAction.ts diff --git a/storage/framework/actions/src/ShippingRateIndexOrmAction.ts b/app/Actions/Commerce/ShippingRateIndexAction.ts similarity index 100% rename from storage/framework/actions/src/ShippingRateIndexOrmAction.ts rename to app/Actions/Commerce/ShippingRateIndexAction.ts diff --git a/storage/framework/actions/src/ShippingRateShowOrmAction.ts b/app/Actions/Commerce/ShippingRateShowAction.ts similarity index 100% rename from storage/framework/actions/src/ShippingRateShowOrmAction.ts rename to app/Actions/Commerce/ShippingRateShowAction.ts diff --git a/storage/framework/actions/src/ShippingRateStoreOrmAction.ts b/app/Actions/Commerce/ShippingRateStoreAction.ts similarity index 100% rename from storage/framework/actions/src/ShippingRateStoreOrmAction.ts rename to app/Actions/Commerce/ShippingRateStoreAction.ts diff --git a/storage/framework/actions/src/ShippingRateUpdateOrmAction.ts b/app/Actions/Commerce/ShippingRateUpdateAction.ts similarity index 100% rename from storage/framework/actions/src/ShippingRateUpdateOrmAction.ts rename to app/Actions/Commerce/ShippingRateUpdateAction.ts diff --git a/storage/framework/actions/src/ShippingZoneDestroyOrmAction.ts b/app/Actions/Commerce/ShippingZoneDestroyAction.ts similarity index 100% rename from storage/framework/actions/src/ShippingZoneDestroyOrmAction.ts rename to app/Actions/Commerce/ShippingZoneDestroyAction.ts diff --git a/storage/framework/actions/src/ShippingZoneIndexOrmAction.ts b/app/Actions/Commerce/ShippingZoneIndexAction.ts similarity index 100% rename from storage/framework/actions/src/ShippingZoneIndexOrmAction.ts rename to app/Actions/Commerce/ShippingZoneIndexAction.ts diff --git a/storage/framework/actions/src/ShippingZoneShowOrmAction.ts b/app/Actions/Commerce/ShippingZoneShowAction.ts similarity index 100% rename from storage/framework/actions/src/ShippingZoneShowOrmAction.ts rename to app/Actions/Commerce/ShippingZoneShowAction.ts diff --git a/storage/framework/actions/src/ShippingZoneStoreOrmAction.ts b/app/Actions/Commerce/ShippingZoneStoreAction.ts similarity index 100% rename from storage/framework/actions/src/ShippingZoneStoreOrmAction.ts rename to app/Actions/Commerce/ShippingZoneStoreAction.ts diff --git a/storage/framework/actions/src/ShippingZoneUpdateOrmAction.ts b/app/Actions/Commerce/ShippingZoneUpdateAction.ts similarity index 100% rename from storage/framework/actions/src/ShippingZoneUpdateOrmAction.ts rename to app/Actions/Commerce/ShippingZoneUpdateAction.ts diff --git a/storage/framework/actions/src/TaxRateDestroyOrmAction.ts b/app/Actions/Commerce/TaxRateDestroyAction.ts similarity index 100% rename from storage/framework/actions/src/TaxRateDestroyOrmAction.ts rename to app/Actions/Commerce/TaxRateDestroyAction.ts diff --git a/storage/framework/actions/src/TaxRateIndexOrmAction.ts b/app/Actions/Commerce/TaxRateIndexAction.ts similarity index 100% rename from storage/framework/actions/src/TaxRateIndexOrmAction.ts rename to app/Actions/Commerce/TaxRateIndexAction.ts diff --git a/storage/framework/actions/src/TaxRateShowOrmAction.ts b/app/Actions/Commerce/TaxRateShowAction.ts similarity index 100% rename from storage/framework/actions/src/TaxRateShowOrmAction.ts rename to app/Actions/Commerce/TaxRateShowAction.ts diff --git a/storage/framework/actions/src/TaxRateStoreOrmAction.ts b/app/Actions/Commerce/TaxRateStoreAction.ts similarity index 100% rename from storage/framework/actions/src/TaxRateStoreOrmAction.ts rename to app/Actions/Commerce/TaxRateStoreAction.ts diff --git a/storage/framework/actions/src/TaxRateUpdateOrmAction.ts b/app/Actions/Commerce/TaxRateUpdateAction.ts similarity index 100% rename from storage/framework/actions/src/TaxRateUpdateOrmAction.ts rename to app/Actions/Commerce/TaxRateUpdateAction.ts diff --git a/storage/framework/actions/src/TransactionIndexOrmAction.ts b/app/Actions/Commerce/TransactionIndexAction.ts similarity index 100% rename from storage/framework/actions/src/TransactionIndexOrmAction.ts rename to app/Actions/Commerce/TransactionIndexAction.ts diff --git a/storage/framework/actions/src/TransactionShowOrmAction.ts b/app/Actions/Commerce/TransactionShowAction.ts similarity index 100% rename from storage/framework/actions/src/TransactionShowOrmAction.ts rename to app/Actions/Commerce/TransactionShowAction.ts diff --git a/storage/framework/actions/src/TransactionStoreOrmAction.ts b/app/Actions/Commerce/TransactionStoreAction.ts similarity index 100% rename from storage/framework/actions/src/TransactionStoreOrmAction.ts rename to app/Actions/Commerce/TransactionStoreAction.ts diff --git a/storage/framework/actions/src/WaitlistProductDestroyOrmAction.ts b/app/Actions/Commerce/WaitlistProductDestroyAction.ts similarity index 100% rename from storage/framework/actions/src/WaitlistProductDestroyOrmAction.ts rename to app/Actions/Commerce/WaitlistProductDestroyAction.ts diff --git a/storage/framework/actions/src/WaitlistProductIndexOrmAction.ts b/app/Actions/Commerce/WaitlistProductIndexAction.ts similarity index 100% rename from storage/framework/actions/src/WaitlistProductIndexOrmAction.ts rename to app/Actions/Commerce/WaitlistProductIndexAction.ts diff --git a/storage/framework/actions/src/WaitlistProductShowOrmAction.ts b/app/Actions/Commerce/WaitlistProductShowAction.ts similarity index 100% rename from storage/framework/actions/src/WaitlistProductShowOrmAction.ts rename to app/Actions/Commerce/WaitlistProductShowAction.ts diff --git a/storage/framework/actions/src/WaitlistProductStoreOrmAction.ts b/app/Actions/Commerce/WaitlistProductStoreAction.ts similarity index 100% rename from storage/framework/actions/src/WaitlistProductStoreOrmAction.ts rename to app/Actions/Commerce/WaitlistProductStoreAction.ts diff --git a/storage/framework/actions/src/WaitlistProductUpdateOrmAction.ts b/app/Actions/Commerce/WaitlistProductUpdateAction.ts similarity index 100% rename from storage/framework/actions/src/WaitlistProductUpdateOrmAction.ts rename to app/Actions/Commerce/WaitlistProductUpdateAction.ts diff --git a/storage/framework/actions/src/WaitlistRestaurantDestroyOrmAction.ts b/app/Actions/Commerce/WaitlistRestaurantDestroyAction.ts similarity index 100% rename from storage/framework/actions/src/WaitlistRestaurantDestroyOrmAction.ts rename to app/Actions/Commerce/WaitlistRestaurantDestroyAction.ts diff --git a/storage/framework/actions/src/WaitlistRestaurantIndexOrmAction.ts b/app/Actions/Commerce/WaitlistRestaurantIndexAction.ts similarity index 100% rename from storage/framework/actions/src/WaitlistRestaurantIndexOrmAction.ts rename to app/Actions/Commerce/WaitlistRestaurantIndexAction.ts diff --git a/storage/framework/actions/src/WaitlistRestaurantShowOrmAction.ts b/app/Actions/Commerce/WaitlistRestaurantShowAction.ts similarity index 100% rename from storage/framework/actions/src/WaitlistRestaurantShowOrmAction.ts rename to app/Actions/Commerce/WaitlistRestaurantShowAction.ts diff --git a/storage/framework/actions/src/WaitlistRestaurantStoreOrmAction.ts b/app/Actions/Commerce/WaitlistRestaurantStoreAction.ts similarity index 100% rename from storage/framework/actions/src/WaitlistRestaurantStoreOrmAction.ts rename to app/Actions/Commerce/WaitlistRestaurantStoreAction.ts diff --git a/storage/framework/actions/src/WaitlistRestaurantUpdateOrmAction.ts b/app/Actions/Commerce/WaitlistRestaurantUpdateAction.ts similarity index 100% rename from storage/framework/actions/src/WaitlistRestaurantUpdateOrmAction.ts rename to app/Actions/Commerce/WaitlistRestaurantUpdateAction.ts From dde09fc484c800fff98f01e35862cb825e4270be Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Tue, 1 Apr 2025 22:07:15 +0800 Subject: [PATCH 43/78] chore: wip --- .../Actions/Commerce/CouponIndexAction.ts | 0 .../Actions/Commerce/CouponShowAction.ts | 0 .../Actions/Commerce/CouponStoreAction.ts | 0 .../Actions/Commerce/CustomerDestroyAction.ts | 0 app/Actions/Commerce/CustomerIndexAction.ts | 3 ++- app/Actions/Commerce/CustomerShowAction.ts | 4 +++- app/Actions/Commerce/CustomerStoreAction.ts | 5 ++++- app/Actions/Commerce/CustomerUpdateAction.ts | 5 +++-- .../src => app/Actions/Commerce}/DriverDestroyOrmAction.ts | 0 storage/framework/core/commerce/src/customers/index.ts | 1 + 10 files changed, 13 insertions(+), 5 deletions(-) rename storage/framework/actions/src/CouponIndexOrmAction.ts => app/Actions/Commerce/CouponIndexAction.ts (100%) rename storage/framework/actions/src/CouponShowOrmAction.ts => app/Actions/Commerce/CouponShowAction.ts (100%) rename storage/framework/actions/src/CouponStoreOrmAction.ts => app/Actions/Commerce/CouponStoreAction.ts (100%) rename storage/framework/actions/src/CustomerDestroyOrmAction.ts => app/Actions/Commerce/CustomerDestroyAction.ts (100%) rename {storage/framework/actions/src => app/Actions/Commerce}/DriverDestroyOrmAction.ts (100%) diff --git a/storage/framework/actions/src/CouponIndexOrmAction.ts b/app/Actions/Commerce/CouponIndexAction.ts similarity index 100% rename from storage/framework/actions/src/CouponIndexOrmAction.ts rename to app/Actions/Commerce/CouponIndexAction.ts diff --git a/storage/framework/actions/src/CouponShowOrmAction.ts b/app/Actions/Commerce/CouponShowAction.ts similarity index 100% rename from storage/framework/actions/src/CouponShowOrmAction.ts rename to app/Actions/Commerce/CouponShowAction.ts diff --git a/storage/framework/actions/src/CouponStoreOrmAction.ts b/app/Actions/Commerce/CouponStoreAction.ts similarity index 100% rename from storage/framework/actions/src/CouponStoreOrmAction.ts rename to app/Actions/Commerce/CouponStoreAction.ts diff --git a/storage/framework/actions/src/CustomerDestroyOrmAction.ts b/app/Actions/Commerce/CustomerDestroyAction.ts similarity index 100% rename from storage/framework/actions/src/CustomerDestroyOrmAction.ts rename to app/Actions/Commerce/CustomerDestroyAction.ts diff --git a/app/Actions/Commerce/CustomerIndexAction.ts b/app/Actions/Commerce/CustomerIndexAction.ts index bdd2df3312..9c14f28821 100644 --- a/app/Actions/Commerce/CustomerIndexAction.ts +++ b/app/Actions/Commerce/CustomerIndexAction.ts @@ -1,12 +1,13 @@ import { Action } from '@stacksjs/actions' import { response } from '@stacksjs/router' +import { customers } from '@stacksjs/commerce' export default new Action({ name: 'Customer Index', description: 'Customer Index ORM Action', method: 'GET', async handle() { - const results = Customer.all() + const results = await customers.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/CustomerShowAction.ts b/app/Actions/Commerce/CustomerShowAction.ts index bd043749c6..66a6a4f835 100644 --- a/app/Actions/Commerce/CustomerShowAction.ts +++ b/app/Actions/Commerce/CustomerShowAction.ts @@ -3,6 +3,8 @@ import { Action } from '@stacksjs/actions' import { response } from '@stacksjs/router' +import { customers } from '@stacksjs/commerce' + export default new Action({ name: 'Customer Show', description: 'Customer Show ORM Action', @@ -10,7 +12,7 @@ export default new Action({ async handle(request: CustomerRequestType) { const id = request.getParam('id') - const model = await Customer.findOrFail(Number(id)) + const model = await customers.fetchById(Number(id)) return response.json(model) }, diff --git a/app/Actions/Commerce/CustomerStoreAction.ts b/app/Actions/Commerce/CustomerStoreAction.ts index 4dbb588851..eaedbfbc4d 100644 --- a/app/Actions/Commerce/CustomerStoreAction.ts +++ b/app/Actions/Commerce/CustomerStoreAction.ts @@ -1,6 +1,8 @@ import type { CustomerRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { customers } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -9,7 +11,8 @@ export default new Action({ method: 'POST', async handle(request: CustomerRequestType) { await request.validate() - const model = await Customer.create(request.all()) + + const model = await customers.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/CustomerUpdateAction.ts b/app/Actions/Commerce/CustomerUpdateAction.ts index fe54d80f13..1b08a9a506 100644 --- a/app/Actions/Commerce/CustomerUpdateAction.ts +++ b/app/Actions/Commerce/CustomerUpdateAction.ts @@ -3,6 +3,8 @@ import { Action } from '@stacksjs/actions' import { response } from '@stacksjs/router' +import { customers } from '@stacksjs/commerce' + export default new Action({ name: 'Customer Update', description: 'Customer Update ORM Action', @@ -11,9 +13,8 @@ export default new Action({ await request.validate() const id = request.getParam('id') - const model = await Customer.findOrFail(Number(id)) - const result = model.update(request.all()) + const result = await customers.update(Number(id), request) return response.json(result) }, diff --git a/storage/framework/actions/src/DriverDestroyOrmAction.ts b/app/Actions/Commerce/DriverDestroyOrmAction.ts similarity index 100% rename from storage/framework/actions/src/DriverDestroyOrmAction.ts rename to app/Actions/Commerce/DriverDestroyOrmAction.ts diff --git a/storage/framework/core/commerce/src/customers/index.ts b/storage/framework/core/commerce/src/customers/index.ts index 0487a53623..8a09620a52 100644 --- a/storage/framework/core/commerce/src/customers/index.ts +++ b/storage/framework/core/commerce/src/customers/index.ts @@ -5,6 +5,7 @@ export { export { fetchById, + fetchAll } from './fetch' export { From 8dda08131c4f9ceaee0c5615f7a1dcbf5e20bad8 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Tue, 1 Apr 2025 22:20:21 +0800 Subject: [PATCH 44/78] chore: wip --- app/Actions/Commerce/CouponDestroyAction.ts | 19 ++++++++++++++++++ app/Actions/Commerce/CouponIndexAction.ts | 6 +++++- app/Actions/Commerce/CouponShowAction.ts | 4 +++- app/Actions/Commerce/CouponStoreAction.ts | 5 ++++- app/Actions/Commerce/CouponUpdateAction.ts | 20 +++++++++++++++++++ app/Actions/Commerce/CustomerIndexAction.ts | 3 ++- app/Actions/Commerce/CustomerShowAction.ts | 4 ++-- app/Actions/Commerce/CustomerUpdateAction.ts | 4 ++-- .../Commerce/DeliveryRouteDestroyAction.ts | 10 ++++++---- .../Commerce/DeliveryRouteIndexAction.ts | 6 +++++- .../Commerce/DeliveryRouteShowAction.ts | 4 +++- .../Commerce/DeliveryRouteStoreAction.ts | 5 ++++- .../Commerce/DeliveryRouteUpdateAction.ts | 10 +++++----- .../Commerce/DigitalDeliveryDestroyAction.ts | 10 ++++++---- .../Commerce/DigitalDeliveryIndexAction.ts | 5 ++++- .../Commerce/DigitalDeliveryShowAction.ts | 4 +++- .../Commerce/DigitalDeliveryStoreAction.ts | 5 ++++- .../Commerce/DigitalDeliveryUpdateAction.ts | 10 +++++----- .../core/commerce/src/customers/index.ts | 2 +- storage/framework/core/commerce/src/index.ts | 5 +++++ 20 files changed, 108 insertions(+), 33 deletions(-) create mode 100644 app/Actions/Commerce/CouponDestroyAction.ts create mode 100644 app/Actions/Commerce/CouponUpdateAction.ts diff --git a/app/Actions/Commerce/CouponDestroyAction.ts b/app/Actions/Commerce/CouponDestroyAction.ts new file mode 100644 index 0000000000..87d4456310 --- /dev/null +++ b/app/Actions/Commerce/CouponDestroyAction.ts @@ -0,0 +1,19 @@ +import type { CouponRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { coupons } from '@stacksjs/commerce' + +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'Coupon Destroy', + description: 'Coupon Destroy ORM Action', + method: 'DELETE', + async handle(request: CouponRequestType) { + const id = request.getParam('id') + + await coupons.deleteCoupon(Number(id)) + + return response.json({ message: 'Coupon deleted successfully' }) + }, +}) diff --git a/app/Actions/Commerce/CouponIndexAction.ts b/app/Actions/Commerce/CouponIndexAction.ts index 1cb7729537..716dab5837 100644 --- a/app/Actions/Commerce/CouponIndexAction.ts +++ b/app/Actions/Commerce/CouponIndexAction.ts @@ -1,4 +1,8 @@ +import type { CouponRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' + +import { coupons } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -6,7 +10,7 @@ export default new Action({ description: 'Coupon Index ORM Action', method: 'GET', async handle() { - const results = Coupon.all() + const results = await coupons.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/CouponShowAction.ts b/app/Actions/Commerce/CouponShowAction.ts index 1467fd4617..efdcab1f7d 100644 --- a/app/Actions/Commerce/CouponShowAction.ts +++ b/app/Actions/Commerce/CouponShowAction.ts @@ -1,6 +1,8 @@ import type { CouponRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { coupons } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -10,7 +12,7 @@ export default new Action({ async handle(request: CouponRequestType) { const id = request.getParam('id') - const model = await Coupon.findOrFail(Number(id)) + const model = await coupons.fetchById(Number(id)) return response.json(model) }, diff --git a/app/Actions/Commerce/CouponStoreAction.ts b/app/Actions/Commerce/CouponStoreAction.ts index 9e5238cc11..bd980d8866 100644 --- a/app/Actions/Commerce/CouponStoreAction.ts +++ b/app/Actions/Commerce/CouponStoreAction.ts @@ -1,6 +1,8 @@ import type { CouponRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { coupons } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -9,7 +11,8 @@ export default new Action({ method: 'POST', async handle(request: CouponRequestType) { await request.validate() - const model = await Coupon.create(request.all()) + + const model = await coupons.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/CouponUpdateAction.ts b/app/Actions/Commerce/CouponUpdateAction.ts new file mode 100644 index 0000000000..1e81719aee --- /dev/null +++ b/app/Actions/Commerce/CouponUpdateAction.ts @@ -0,0 +1,20 @@ +import type { CouponRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { coupons } from '@stacksjs/commerce' + +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'Coupon Update', + description: 'Coupon Update ORM Action', + method: 'PUT', + async handle(request: CouponRequestType) { + await request.validate() + const id = request.getParam('id') + + const model = await coupons.update(Number(id), request) + + return response.json(model) + }, +}) diff --git a/app/Actions/Commerce/CustomerIndexAction.ts b/app/Actions/Commerce/CustomerIndexAction.ts index 9c14f28821..2df0227498 100644 --- a/app/Actions/Commerce/CustomerIndexAction.ts +++ b/app/Actions/Commerce/CustomerIndexAction.ts @@ -1,7 +1,8 @@ import { Action } from '@stacksjs/actions' +import { customers } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' -import { customers } from '@stacksjs/commerce' export default new Action({ name: 'Customer Index', description: 'Customer Index ORM Action', diff --git a/app/Actions/Commerce/CustomerShowAction.ts b/app/Actions/Commerce/CustomerShowAction.ts index 66a6a4f835..d5216f4630 100644 --- a/app/Actions/Commerce/CustomerShowAction.ts +++ b/app/Actions/Commerce/CustomerShowAction.ts @@ -1,10 +1,10 @@ import type { CustomerRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { response } from '@stacksjs/router' - import { customers } from '@stacksjs/commerce' +import { response } from '@stacksjs/router' + export default new Action({ name: 'Customer Show', description: 'Customer Show ORM Action', diff --git a/app/Actions/Commerce/CustomerUpdateAction.ts b/app/Actions/Commerce/CustomerUpdateAction.ts index 1b08a9a506..10e9734a6f 100644 --- a/app/Actions/Commerce/CustomerUpdateAction.ts +++ b/app/Actions/Commerce/CustomerUpdateAction.ts @@ -1,10 +1,10 @@ import type { CustomerRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { response } from '@stacksjs/router' - import { customers } from '@stacksjs/commerce' +import { response } from '@stacksjs/router' + export default new Action({ name: 'Customer Update', description: 'Customer Update ORM Action', diff --git a/app/Actions/Commerce/DeliveryRouteDestroyAction.ts b/app/Actions/Commerce/DeliveryRouteDestroyAction.ts index e8efb13e35..02a59ae684 100644 --- a/app/Actions/Commerce/DeliveryRouteDestroyAction.ts +++ b/app/Actions/Commerce/DeliveryRouteDestroyAction.ts @@ -1,6 +1,10 @@ import type { DeliveryRouteRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { deliveryRoutes } from '@stacksjs/commerce' + +import { response } from '@stacksjs/router' + export default new Action({ name: 'DeliveryRoute Destroy', description: 'DeliveryRoute Destroy ORM Action', @@ -8,10 +12,8 @@ export default new Action({ async handle(request: DeliveryRouteRequestType) { const id = request.getParam('id') - const model = await DeliveryRoute.findOrFail(Number(id)) - - model.delete() + await deliveryRoutes.destroy(Number(id)) - return 'Model deleted!' + return response.json({ message: 'DeliveryRoute deleted successfully' }) }, }) diff --git a/app/Actions/Commerce/DeliveryRouteIndexAction.ts b/app/Actions/Commerce/DeliveryRouteIndexAction.ts index 421df55569..d09a0d8e6f 100644 --- a/app/Actions/Commerce/DeliveryRouteIndexAction.ts +++ b/app/Actions/Commerce/DeliveryRouteIndexAction.ts @@ -1,4 +1,8 @@ +import type { DeliveryRouteRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' + +import { deliveryRoutes } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -6,7 +10,7 @@ export default new Action({ description: 'DeliveryRoute Index ORM Action', method: 'GET', async handle() { - const results = DeliveryRoute.all() + const results = await deliveryRoutes.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/DeliveryRouteShowAction.ts b/app/Actions/Commerce/DeliveryRouteShowAction.ts index c5d47e119a..ec1884c29e 100644 --- a/app/Actions/Commerce/DeliveryRouteShowAction.ts +++ b/app/Actions/Commerce/DeliveryRouteShowAction.ts @@ -1,6 +1,8 @@ import type { DeliveryRouteRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { deliveryRoutes } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -10,7 +12,7 @@ export default new Action({ async handle(request: DeliveryRouteRequestType) { const id = request.getParam('id') - const model = await DeliveryRoute.findOrFail(Number(id)) + const model = await deliveryRoutes.fetchById(Number(id)) return response.json(model) }, diff --git a/app/Actions/Commerce/DeliveryRouteStoreAction.ts b/app/Actions/Commerce/DeliveryRouteStoreAction.ts index 6d71c9a67a..2e0c924c1c 100644 --- a/app/Actions/Commerce/DeliveryRouteStoreAction.ts +++ b/app/Actions/Commerce/DeliveryRouteStoreAction.ts @@ -1,6 +1,8 @@ import type { DeliveryRouteRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { deliveryRoutes } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -9,7 +11,8 @@ export default new Action({ method: 'POST', async handle(request: DeliveryRouteRequestType) { await request.validate() - const model = await DeliveryRoute.create(request.all()) + + const model = await deliveryRoutes.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/DeliveryRouteUpdateAction.ts b/app/Actions/Commerce/DeliveryRouteUpdateAction.ts index 3da2771b47..f94d4da004 100644 --- a/app/Actions/Commerce/DeliveryRouteUpdateAction.ts +++ b/app/Actions/Commerce/DeliveryRouteUpdateAction.ts @@ -1,20 +1,20 @@ import type { DeliveryRouteRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { deliveryRoutes } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ name: 'DeliveryRoute Update', description: 'DeliveryRoute Update ORM Action', - method: 'PATCH', + method: 'PUT', async handle(request: DeliveryRouteRequestType) { await request.validate() - const id = request.getParam('id') - const model = await DeliveryRoute.findOrFail(Number(id)) - const result = model.update(request.all()) + const model = await deliveryRoutes.update(Number(id), request) - return response.json(result) + return response.json(model) }, }) diff --git a/app/Actions/Commerce/DigitalDeliveryDestroyAction.ts b/app/Actions/Commerce/DigitalDeliveryDestroyAction.ts index 971c44dc1a..a2fd88f729 100644 --- a/app/Actions/Commerce/DigitalDeliveryDestroyAction.ts +++ b/app/Actions/Commerce/DigitalDeliveryDestroyAction.ts @@ -1,6 +1,10 @@ import type { DigitalDeliveryRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { digital } from '@stacksjs/commerce' + +import { response } from '@stacksjs/router' + export default new Action({ name: 'DigitalDelivery Destroy', description: 'DigitalDelivery Destroy ORM Action', @@ -8,10 +12,8 @@ export default new Action({ async handle(request: DigitalDeliveryRequestType) { const id = request.getParam('id') - const model = await DigitalDelivery.findOrFail(Number(id)) - - model.delete() + await digital.destroy(Number(id)) - return 'Model deleted!' + return response.json({ message: 'DigitalDelivery deleted successfully' }) }, }) diff --git a/app/Actions/Commerce/DigitalDeliveryIndexAction.ts b/app/Actions/Commerce/DigitalDeliveryIndexAction.ts index 21c8d95dda..4f6eed8356 100644 --- a/app/Actions/Commerce/DigitalDeliveryIndexAction.ts +++ b/app/Actions/Commerce/DigitalDeliveryIndexAction.ts @@ -1,4 +1,7 @@ import { Action } from '@stacksjs/actions' + +import { digital } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -6,7 +9,7 @@ export default new Action({ description: 'DigitalDelivery Index ORM Action', method: 'GET', async handle() { - const results = DigitalDelivery.all() + const results = await digital.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/DigitalDeliveryShowAction.ts b/app/Actions/Commerce/DigitalDeliveryShowAction.ts index 02632714c2..db17d7fcf6 100644 --- a/app/Actions/Commerce/DigitalDeliveryShowAction.ts +++ b/app/Actions/Commerce/DigitalDeliveryShowAction.ts @@ -1,6 +1,8 @@ import type { DigitalDeliveryRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { digital } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -10,7 +12,7 @@ export default new Action({ async handle(request: DigitalDeliveryRequestType) { const id = request.getParam('id') - const model = await DigitalDelivery.findOrFail(Number(id)) + const model = await digital.fetchById(Number(id)) return response.json(model) }, diff --git a/app/Actions/Commerce/DigitalDeliveryStoreAction.ts b/app/Actions/Commerce/DigitalDeliveryStoreAction.ts index bdc0f56959..4bbc5c2456 100644 --- a/app/Actions/Commerce/DigitalDeliveryStoreAction.ts +++ b/app/Actions/Commerce/DigitalDeliveryStoreAction.ts @@ -1,6 +1,8 @@ import type { DigitalDeliveryRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { digital } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -9,7 +11,8 @@ export default new Action({ method: 'POST', async handle(request: DigitalDeliveryRequestType) { await request.validate() - const model = await DigitalDelivery.create(request.all()) + + const model = await digital.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/DigitalDeliveryUpdateAction.ts b/app/Actions/Commerce/DigitalDeliveryUpdateAction.ts index 222df17751..4a24d48f0f 100644 --- a/app/Actions/Commerce/DigitalDeliveryUpdateAction.ts +++ b/app/Actions/Commerce/DigitalDeliveryUpdateAction.ts @@ -1,20 +1,20 @@ import type { DigitalDeliveryRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { digital } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ name: 'DigitalDelivery Update', description: 'DigitalDelivery Update ORM Action', - method: 'PATCH', + method: 'PUT', async handle(request: DigitalDeliveryRequestType) { await request.validate() - const id = request.getParam('id') - const model = await DigitalDelivery.findOrFail(Number(id)) - const result = model.update(request.all()) + const model = await digital.update(Number(id), request) - return response.json(result) + return response.json(model) }, }) diff --git a/storage/framework/core/commerce/src/customers/index.ts b/storage/framework/core/commerce/src/customers/index.ts index 8a09620a52..655dc83e02 100644 --- a/storage/framework/core/commerce/src/customers/index.ts +++ b/storage/framework/core/commerce/src/customers/index.ts @@ -4,8 +4,8 @@ export { } from './destroy' export { + fetchAll, fetchById, - fetchAll } from './fetch' export { diff --git a/storage/framework/core/commerce/src/index.ts b/storage/framework/core/commerce/src/index.ts index 0c501512ae..ccbbbf5a80 100644 --- a/storage/framework/core/commerce/src/index.ts +++ b/storage/framework/core/commerce/src/index.ts @@ -11,6 +11,7 @@ import * as payments from './payments' import * as rates from './rates' import * as restaurant from './restaurant' import * as reviews from './reviews' +import * as deliveryRoutes from './routes' import * as shipping from './shipping' import * as tax from './tax' import * as unit from './unit' @@ -35,6 +36,7 @@ type DriversModule = typeof drivers type LicensesModule = typeof licenses type DigitalModule = typeof digital type TaxModule = typeof tax +type DeliveryRoutesModule = typeof deliveryRoutes type WaitlistModule = typeof waitlist export interface EcommerceNamespace { coupons: CouponsModule @@ -51,6 +53,7 @@ export interface EcommerceNamespace { zones: ZonesModule variants: VariantsModule unit: UnitModule + deliveryRoutes: DeliveryRoutesModule licenses: LicensesModule digital: DigitalModule tax: TaxModule @@ -68,6 +71,7 @@ export const ecommerce: EcommerceNamespace = { reviews, restaurant, shipping, + deliveryRoutes, rates, zones, variants, @@ -83,6 +87,7 @@ export default ecommerce export { coupons, customers, + deliveryRoutes, digital, drivers, giftCards, From f709cfee829b12f5a6a5d8a2f0e00af2d4dc4d86 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Tue, 1 Apr 2025 22:28:15 +0800 Subject: [PATCH 45/78] chore: wip --- ...riverDestroyOrmAction.ts => DriverDestroyAction.ts} | 10 ++++++---- app/Actions/Commerce/DriverIndexAction.ts | 8 ++++++-- app/Actions/Commerce/DriverShowAction.ts | 4 +++- app/Actions/Commerce/DriverStoreAction.ts | 5 ++++- app/Actions/Commerce/DriverUpdateAction.ts | 10 +++++----- .../framework/defaults/models/ecommerce/Category.ts | 1 - storage/framework/defaults/models/ecommerce/Coupon.ts | 1 - .../framework/defaults/models/ecommerce/Customer.ts | 1 - .../defaults/models/ecommerce/DeliveryRoute.ts | 1 - .../defaults/models/ecommerce/DigitalDelivery.ts | 1 - storage/framework/defaults/models/ecommerce/Driver.ts | 1 - .../framework/defaults/models/ecommerce/GiftCard.ts | 1 - .../framework/defaults/models/ecommerce/LicenseKey.ts | 1 - .../defaults/models/ecommerce/LoyaltyPoint.ts | 1 - .../defaults/models/ecommerce/LoyaltyReward.ts | 1 - .../defaults/models/ecommerce/Manufacturer.ts | 1 - storage/framework/defaults/models/ecommerce/Order.ts | 1 - storage/framework/defaults/models/ecommerce/Payment.ts | 1 - .../framework/defaults/models/ecommerce/PrintDevice.ts | 1 - storage/framework/defaults/models/ecommerce/Product.ts | 1 - .../framework/defaults/models/ecommerce/ProductItem.ts | 1 - .../framework/defaults/models/ecommerce/ProductUnit.ts | 1 - .../defaults/models/ecommerce/ProductVariant.ts | 1 - storage/framework/defaults/models/ecommerce/Receipt.ts | 1 - storage/framework/defaults/models/ecommerce/Review.ts | 1 - .../defaults/models/ecommerce/ShippingMethod.ts | 1 - .../defaults/models/ecommerce/ShippingRate.ts | 1 - .../defaults/models/ecommerce/ShippingZone.ts | 1 - storage/framework/defaults/models/ecommerce/TaxRate.ts | 1 - .../framework/defaults/models/ecommerce/Transaction.ts | 1 - .../defaults/models/ecommerce/WaitlistProduct.ts | 1 - .../defaults/models/ecommerce/WaitlistRestaurant.ts | 1 - 32 files changed, 24 insertions(+), 40 deletions(-) rename app/Actions/Commerce/{DriverDestroyOrmAction.ts => DriverDestroyAction.ts} (61%) diff --git a/app/Actions/Commerce/DriverDestroyOrmAction.ts b/app/Actions/Commerce/DriverDestroyAction.ts similarity index 61% rename from app/Actions/Commerce/DriverDestroyOrmAction.ts rename to app/Actions/Commerce/DriverDestroyAction.ts index c49adab9b1..6f81722fb5 100644 --- a/app/Actions/Commerce/DriverDestroyOrmAction.ts +++ b/app/Actions/Commerce/DriverDestroyAction.ts @@ -1,6 +1,10 @@ import type { DriverRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { drivers } from '@stacksjs/commerce' + +import { response } from '@stacksjs/router' + export default new Action({ name: 'Driver Destroy', description: 'Driver Destroy ORM Action', @@ -8,10 +12,8 @@ export default new Action({ async handle(request: DriverRequestType) { const id = request.getParam('id') - const model = await Driver.findOrFail(Number(id)) - - model.delete() + await drivers.destroy(Number(id)) - return 'Model deleted!' + return response.json({ message: 'Driver deleted successfully' }) }, }) diff --git a/app/Actions/Commerce/DriverIndexAction.ts b/app/Actions/Commerce/DriverIndexAction.ts index 1703f2a1af..12d8843808 100644 --- a/app/Actions/Commerce/DriverIndexAction.ts +++ b/app/Actions/Commerce/DriverIndexAction.ts @@ -1,12 +1,16 @@ +import type { DriverRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' + +import { drivers } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ name: 'Driver Index', description: 'Driver Index ORM Action', method: 'GET', - async handle() { - const results = Driver.all() + async handle(request: DriverRequestType) { + const results = await drivers.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/DriverShowAction.ts b/app/Actions/Commerce/DriverShowAction.ts index da7455a426..98fbf4115d 100644 --- a/app/Actions/Commerce/DriverShowAction.ts +++ b/app/Actions/Commerce/DriverShowAction.ts @@ -1,6 +1,8 @@ import type { DriverRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { drivers } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -10,7 +12,7 @@ export default new Action({ async handle(request: DriverRequestType) { const id = request.getParam('id') - const model = await Driver.findOrFail(Number(id)) + const model = await drivers.fetchById(Number(id)) return response.json(model) }, diff --git a/app/Actions/Commerce/DriverStoreAction.ts b/app/Actions/Commerce/DriverStoreAction.ts index 7c398093bc..a30855d677 100644 --- a/app/Actions/Commerce/DriverStoreAction.ts +++ b/app/Actions/Commerce/DriverStoreAction.ts @@ -1,6 +1,8 @@ import type { DriverRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { drivers } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -9,7 +11,8 @@ export default new Action({ method: 'POST', async handle(request: DriverRequestType) { await request.validate() - const model = await Driver.create(request.all()) + + const model = await drivers.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/DriverUpdateAction.ts b/app/Actions/Commerce/DriverUpdateAction.ts index 24ea49c639..5bef0d43e3 100644 --- a/app/Actions/Commerce/DriverUpdateAction.ts +++ b/app/Actions/Commerce/DriverUpdateAction.ts @@ -1,20 +1,20 @@ import type { DriverRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { drivers } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ name: 'Driver Update', description: 'Driver Update ORM Action', - method: 'PATCH', + method: 'PUT', async handle(request: DriverRequestType) { await request.validate() - const id = request.getParam('id') - const model = await Driver.findOrFail(Number(id)) - const result = model.update(request.all()) + const model = await drivers.update(Number(id), request) - return response.json(result) + return response.json(model) }, }) diff --git a/storage/framework/defaults/models/ecommerce/Category.ts b/storage/framework/defaults/models/ecommerce/Category.ts index da8e95f3b7..129d341699 100644 --- a/storage/framework/defaults/models/ecommerce/Category.ts +++ b/storage/framework/defaults/models/ecommerce/Category.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'product-categories', - routes: ['index', 'store', 'show'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/Coupon.ts b/storage/framework/defaults/models/ecommerce/Coupon.ts index a1db710eec..c64bee309e 100644 --- a/storage/framework/defaults/models/ecommerce/Coupon.ts +++ b/storage/framework/defaults/models/ecommerce/Coupon.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'coupons', - routes: ['index', 'store', 'show'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/Customer.ts b/storage/framework/defaults/models/ecommerce/Customer.ts index eb1a547eda..3f2e0f207e 100644 --- a/storage/framework/defaults/models/ecommerce/Customer.ts +++ b/storage/framework/defaults/models/ecommerce/Customer.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'customers', - routes: ['index', 'store', 'show', 'update', 'destroy'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/DeliveryRoute.ts b/storage/framework/defaults/models/ecommerce/DeliveryRoute.ts index 4457a33551..b20b0cd15e 100644 --- a/storage/framework/defaults/models/ecommerce/DeliveryRoute.ts +++ b/storage/framework/defaults/models/ecommerce/DeliveryRoute.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'delivery-routes', - routes: ['index', 'store', 'show', 'update', 'destroy'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/DigitalDelivery.ts b/storage/framework/defaults/models/ecommerce/DigitalDelivery.ts index 7192c8a0c2..06807d99df 100644 --- a/storage/framework/defaults/models/ecommerce/DigitalDelivery.ts +++ b/storage/framework/defaults/models/ecommerce/DigitalDelivery.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'digital-deliveries', - routes: ['index', 'store', 'show', 'update', 'destroy'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/Driver.ts b/storage/framework/defaults/models/ecommerce/Driver.ts index 90d4ac555f..ecf3f095e8 100644 --- a/storage/framework/defaults/models/ecommerce/Driver.ts +++ b/storage/framework/defaults/models/ecommerce/Driver.ts @@ -26,7 +26,6 @@ export default { useApi: { uri: 'drivers', - routes: ['index', 'store', 'show', 'update', 'destroy'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/GiftCard.ts b/storage/framework/defaults/models/ecommerce/GiftCard.ts index 68ac1b82b1..357b2c914d 100644 --- a/storage/framework/defaults/models/ecommerce/GiftCard.ts +++ b/storage/framework/defaults/models/ecommerce/GiftCard.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'gift-cards', - routes: ['index', 'store', 'show'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/LicenseKey.ts b/storage/framework/defaults/models/ecommerce/LicenseKey.ts index 0dcbac42a7..f6748c1d6e 100644 --- a/storage/framework/defaults/models/ecommerce/LicenseKey.ts +++ b/storage/framework/defaults/models/ecommerce/LicenseKey.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'license-keys', - routes: ['index', 'store', 'show', 'update', 'destroy'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/LoyaltyPoint.ts b/storage/framework/defaults/models/ecommerce/LoyaltyPoint.ts index 94af8b65eb..130eed4604 100644 --- a/storage/framework/defaults/models/ecommerce/LoyaltyPoint.ts +++ b/storage/framework/defaults/models/ecommerce/LoyaltyPoint.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'loyalty-points', - routes: ['index', 'store', 'show'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/LoyaltyReward.ts b/storage/framework/defaults/models/ecommerce/LoyaltyReward.ts index 9ecf2d9bae..53b5aa5fc4 100644 --- a/storage/framework/defaults/models/ecommerce/LoyaltyReward.ts +++ b/storage/framework/defaults/models/ecommerce/LoyaltyReward.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'loyalty-rewards', - routes: ['index', 'store', 'show'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/Manufacturer.ts b/storage/framework/defaults/models/ecommerce/Manufacturer.ts index c853dbe22c..c7562816c6 100644 --- a/storage/framework/defaults/models/ecommerce/Manufacturer.ts +++ b/storage/framework/defaults/models/ecommerce/Manufacturer.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'product-manufacturers', - routes: ['index', 'store', 'show'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/Order.ts b/storage/framework/defaults/models/ecommerce/Order.ts index eca8f8eac2..b07fb3de2c 100644 --- a/storage/framework/defaults/models/ecommerce/Order.ts +++ b/storage/framework/defaults/models/ecommerce/Order.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'orders', - routes: ['index', 'store', 'show'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/Payment.ts b/storage/framework/defaults/models/ecommerce/Payment.ts index 4ac0169172..5b2241fee7 100644 --- a/storage/framework/defaults/models/ecommerce/Payment.ts +++ b/storage/framework/defaults/models/ecommerce/Payment.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'payments', - routes: ['index', 'store', 'show'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/PrintDevice.ts b/storage/framework/defaults/models/ecommerce/PrintDevice.ts index e8eb5bd0f3..98d408eacb 100644 --- a/storage/framework/defaults/models/ecommerce/PrintDevice.ts +++ b/storage/framework/defaults/models/ecommerce/PrintDevice.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'print-devices', - routes: ['index', 'store', 'show', 'update', 'destroy'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/Product.ts b/storage/framework/defaults/models/ecommerce/Product.ts index 727e46609f..4b45a5a30e 100644 --- a/storage/framework/defaults/models/ecommerce/Product.ts +++ b/storage/framework/defaults/models/ecommerce/Product.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'products', - routes: ['index', 'store', 'show'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/ProductItem.ts b/storage/framework/defaults/models/ecommerce/ProductItem.ts index 61a220ed79..d4e5f4f94f 100644 --- a/storage/framework/defaults/models/ecommerce/ProductItem.ts +++ b/storage/framework/defaults/models/ecommerce/ProductItem.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'product-items', - routes: ['index', 'store', 'show'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/ProductUnit.ts b/storage/framework/defaults/models/ecommerce/ProductUnit.ts index 70d9a70b32..3a5a996a50 100644 --- a/storage/framework/defaults/models/ecommerce/ProductUnit.ts +++ b/storage/framework/defaults/models/ecommerce/ProductUnit.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'product-units', - routes: ['index', 'store', 'show'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/ProductVariant.ts b/storage/framework/defaults/models/ecommerce/ProductVariant.ts index 9ea0d50376..874acec963 100644 --- a/storage/framework/defaults/models/ecommerce/ProductVariant.ts +++ b/storage/framework/defaults/models/ecommerce/ProductVariant.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'product-variants', - routes: ['index', 'store', 'show', 'update', 'destroy'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/Receipt.ts b/storage/framework/defaults/models/ecommerce/Receipt.ts index 85eea01281..73bc8c350b 100644 --- a/storage/framework/defaults/models/ecommerce/Receipt.ts +++ b/storage/framework/defaults/models/ecommerce/Receipt.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'print-logs', - routes: ['index', 'store', 'show', 'update', 'destroy'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/Review.ts b/storage/framework/defaults/models/ecommerce/Review.ts index 4cbac464be..97bd3657af 100644 --- a/storage/framework/defaults/models/ecommerce/Review.ts +++ b/storage/framework/defaults/models/ecommerce/Review.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'product-reviews', - routes: ['index', 'store', 'show'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/ShippingMethod.ts b/storage/framework/defaults/models/ecommerce/ShippingMethod.ts index 0b7418254c..7295ef513e 100644 --- a/storage/framework/defaults/models/ecommerce/ShippingMethod.ts +++ b/storage/framework/defaults/models/ecommerce/ShippingMethod.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'shipping-methods', - routes: ['index', 'store', 'show', 'update', 'destroy'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/ShippingRate.ts b/storage/framework/defaults/models/ecommerce/ShippingRate.ts index 08b21dc6c7..bd1ad29529 100644 --- a/storage/framework/defaults/models/ecommerce/ShippingRate.ts +++ b/storage/framework/defaults/models/ecommerce/ShippingRate.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'shipping-rates', - routes: ['index', 'store', 'show', 'update', 'destroy'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/ShippingZone.ts b/storage/framework/defaults/models/ecommerce/ShippingZone.ts index 403dfbcb66..1e43eb16f6 100644 --- a/storage/framework/defaults/models/ecommerce/ShippingZone.ts +++ b/storage/framework/defaults/models/ecommerce/ShippingZone.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'shipping-zones', - routes: ['index', 'store', 'show', 'update', 'destroy'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/TaxRate.ts b/storage/framework/defaults/models/ecommerce/TaxRate.ts index 3d92d3327e..72ae2916a4 100644 --- a/storage/framework/defaults/models/ecommerce/TaxRate.ts +++ b/storage/framework/defaults/models/ecommerce/TaxRate.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'tax-rates', - routes: ['index', 'store', 'show', 'update', 'destroy'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/Transaction.ts b/storage/framework/defaults/models/ecommerce/Transaction.ts index f526c200a9..e09a8d9e7b 100644 --- a/storage/framework/defaults/models/ecommerce/Transaction.ts +++ b/storage/framework/defaults/models/ecommerce/Transaction.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'transactions', - routes: ['index', 'store', 'show'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/WaitlistProduct.ts b/storage/framework/defaults/models/ecommerce/WaitlistProduct.ts index b07ec3b59b..30f7bf69ba 100644 --- a/storage/framework/defaults/models/ecommerce/WaitlistProduct.ts +++ b/storage/framework/defaults/models/ecommerce/WaitlistProduct.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'waitlist-products', - routes: ['index', 'store', 'show', 'update', 'destroy'], }, observe: true, diff --git a/storage/framework/defaults/models/ecommerce/WaitlistRestaurant.ts b/storage/framework/defaults/models/ecommerce/WaitlistRestaurant.ts index 91eb15a924..d23c5e4a63 100644 --- a/storage/framework/defaults/models/ecommerce/WaitlistRestaurant.ts +++ b/storage/framework/defaults/models/ecommerce/WaitlistRestaurant.ts @@ -23,7 +23,6 @@ export default { useApi: { uri: 'waitlist-restaurants', - routes: ['index', 'store', 'show', 'update', 'destroy'], }, observe: true, From 2d7e94a87a51d407df915b1f0cf3c1e7d8a1c78e Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Tue, 1 Apr 2025 23:00:44 +0800 Subject: [PATCH 46/78] chore: wip --- app/Actions/Commerce/GiftCardDestroyAction.ts | 19 ++++++++ app/Actions/Commerce/GiftCardIndexAction.ts | 8 +++- app/Actions/Commerce/GiftCardShowAction.ts | 4 +- app/Actions/Commerce/GiftCardStoreAction.ts | 5 +- app/Actions/Commerce/GiftCardUpdateAction.ts | 20 ++++++++ .../Commerce/LicenseKeyDestroyAction.ts | 12 +++-- app/Actions/Commerce/LicenseKeyIndexAction.ts | 8 +++- app/Actions/Commerce/LicenseKeyShowAction.ts | 4 +- app/Actions/Commerce/LicenseKeyStoreAction.ts | 7 +-- .../Commerce/LicenseKeyUpdateAction.ts | 11 ++--- .../Commerce/LoyaltyPointIndexAction.ts | 13 ----- .../Commerce/LoyaltyPointShowAction.ts | 17 ------- .../Commerce/LoyaltyPointStoreAction.ts | 16 ------- .../Commerce/ManufacturerDestroyAction.ts | 1 + .../Commerce/ManufacturerIndexAction.ts | 8 +++- .../core/commerce/src/gift-cards/destroy.ts | 9 ++-- .../core/commerce/src/manufacturer/fetch.ts | 47 +++---------------- storage/framework/core/commerce/src/types.ts | 4 +- 18 files changed, 99 insertions(+), 114 deletions(-) create mode 100644 app/Actions/Commerce/GiftCardDestroyAction.ts create mode 100644 app/Actions/Commerce/GiftCardUpdateAction.ts delete mode 100644 app/Actions/Commerce/LoyaltyPointIndexAction.ts delete mode 100644 app/Actions/Commerce/LoyaltyPointShowAction.ts delete mode 100644 app/Actions/Commerce/LoyaltyPointStoreAction.ts create mode 100644 app/Actions/Commerce/ManufacturerDestroyAction.ts diff --git a/app/Actions/Commerce/GiftCardDestroyAction.ts b/app/Actions/Commerce/GiftCardDestroyAction.ts new file mode 100644 index 0000000000..f973da420b --- /dev/null +++ b/app/Actions/Commerce/GiftCardDestroyAction.ts @@ -0,0 +1,19 @@ +import type { GiftCardRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { giftCards } from '@stacksjs/commerce' + +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'GiftCard Destroy', + description: 'GiftCard Destroy ORM Action', + method: 'DELETE', + async handle(request: GiftCardRequestType) { + const id = request.getParam('id') + + await giftCards.destroy(Number(id)) + + return response.json({ message: 'GiftCard deleted successfully' }) + }, +}) \ No newline at end of file diff --git a/app/Actions/Commerce/GiftCardIndexAction.ts b/app/Actions/Commerce/GiftCardIndexAction.ts index e55abe31b2..803294c990 100644 --- a/app/Actions/Commerce/GiftCardIndexAction.ts +++ b/app/Actions/Commerce/GiftCardIndexAction.ts @@ -1,12 +1,16 @@ +import type { GiftCardRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' + +import { giftCards } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ name: 'GiftCard Index', description: 'GiftCard Index ORM Action', method: 'GET', - async handle() { - const results = GiftCard.all() + async handle(request: GiftCardRequestType) { + const results = await giftCards.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/GiftCardShowAction.ts b/app/Actions/Commerce/GiftCardShowAction.ts index f51834261b..0ad50598b3 100644 --- a/app/Actions/Commerce/GiftCardShowAction.ts +++ b/app/Actions/Commerce/GiftCardShowAction.ts @@ -1,6 +1,8 @@ import type { GiftCardRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { giftCards } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -10,7 +12,7 @@ export default new Action({ async handle(request: GiftCardRequestType) { const id = request.getParam('id') - const model = await GiftCard.findOrFail(Number(id)) + const model = await giftCards.fetchById(Number(id)) return response.json(model) }, diff --git a/app/Actions/Commerce/GiftCardStoreAction.ts b/app/Actions/Commerce/GiftCardStoreAction.ts index 6f07156885..00613c89df 100644 --- a/app/Actions/Commerce/GiftCardStoreAction.ts +++ b/app/Actions/Commerce/GiftCardStoreAction.ts @@ -1,6 +1,8 @@ import type { GiftCardRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { giftCards } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -9,7 +11,8 @@ export default new Action({ method: 'POST', async handle(request: GiftCardRequestType) { await request.validate() - const model = await GiftCard.create(request.all()) + + const model = await giftCards.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/GiftCardUpdateAction.ts b/app/Actions/Commerce/GiftCardUpdateAction.ts new file mode 100644 index 0000000000..4b16eafbd3 --- /dev/null +++ b/app/Actions/Commerce/GiftCardUpdateAction.ts @@ -0,0 +1,20 @@ +import type { GiftCardRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { giftCards } from '@stacksjs/commerce' + +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'GiftCard Update', + description: 'GiftCard Update ORM Action', + method: 'PUT', + async handle(request: GiftCardRequestType) { + await request.validate() + const id = request.getParam('id') + + const model = await giftCards.update(Number(id), request) + + return response.json(model) + }, +}) \ No newline at end of file diff --git a/app/Actions/Commerce/LicenseKeyDestroyAction.ts b/app/Actions/Commerce/LicenseKeyDestroyAction.ts index 28262690cf..e45ec9bba2 100644 --- a/app/Actions/Commerce/LicenseKeyDestroyAction.ts +++ b/app/Actions/Commerce/LicenseKeyDestroyAction.ts @@ -1,6 +1,10 @@ import type { LicenseKeyRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { licenses } from '@stacksjs/commerce' + +import { response } from '@stacksjs/router' + export default new Action({ name: 'LicenseKey Destroy', description: 'LicenseKey Destroy ORM Action', @@ -8,10 +12,10 @@ export default new Action({ async handle(request: LicenseKeyRequestType) { const id = request.getParam('id') - const model = await LicenseKey.findOrFail(Number(id)) - - model.delete() + await licenses.destroy(Number(id)) - return 'Model deleted!' + return response.json({ + message: 'License key deleted successfully', + }) }, }) diff --git a/app/Actions/Commerce/LicenseKeyIndexAction.ts b/app/Actions/Commerce/LicenseKeyIndexAction.ts index faa329da8b..43688244e6 100644 --- a/app/Actions/Commerce/LicenseKeyIndexAction.ts +++ b/app/Actions/Commerce/LicenseKeyIndexAction.ts @@ -1,12 +1,16 @@ +import type { LicenseKeyRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' + +import { licenses } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ name: 'LicenseKey Index', description: 'LicenseKey Index ORM Action', method: 'GET', - async handle() { - const results = LicenseKey.all() + async handle(request: LicenseKeyRequestType) { + const results = await licenses.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/LicenseKeyShowAction.ts b/app/Actions/Commerce/LicenseKeyShowAction.ts index 7a7aab1937..205e9f7cf1 100644 --- a/app/Actions/Commerce/LicenseKeyShowAction.ts +++ b/app/Actions/Commerce/LicenseKeyShowAction.ts @@ -1,6 +1,8 @@ import type { LicenseKeyRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { licenses } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -10,7 +12,7 @@ export default new Action({ async handle(request: LicenseKeyRequestType) { const id = request.getParam('id') - const model = await LicenseKey.findOrFail(Number(id)) + const model = await licenses.fetchById(Number(id)) return response.json(model) }, diff --git a/app/Actions/Commerce/LicenseKeyStoreAction.ts b/app/Actions/Commerce/LicenseKeyStoreAction.ts index a50e5be931..d1d960a575 100644 --- a/app/Actions/Commerce/LicenseKeyStoreAction.ts +++ b/app/Actions/Commerce/LicenseKeyStoreAction.ts @@ -1,6 +1,8 @@ import type { LicenseKeyRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { licenses } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -8,9 +10,8 @@ export default new Action({ description: 'LicenseKey Store ORM Action', method: 'POST', async handle(request: LicenseKeyRequestType) { - await request.validate() - const model = await LicenseKey.create(request.all()) + const results = await licenses.store(request) - return response.json(model) + return response.json(results) }, }) diff --git a/app/Actions/Commerce/LicenseKeyUpdateAction.ts b/app/Actions/Commerce/LicenseKeyUpdateAction.ts index 0543b99803..a8b536560a 100644 --- a/app/Actions/Commerce/LicenseKeyUpdateAction.ts +++ b/app/Actions/Commerce/LicenseKeyUpdateAction.ts @@ -1,20 +1,19 @@ import type { LicenseKeyRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { licenses } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ name: 'LicenseKey Update', description: 'LicenseKey Update ORM Action', - method: 'PATCH', + method: 'PUT', async handle(request: LicenseKeyRequestType) { - await request.validate() - const id = request.getParam('id') - const model = await LicenseKey.findOrFail(Number(id)) - const result = model.update(request.all()) + const results = await licenses.update(Number(id), request) - return response.json(result) + return response.json(results) }, }) diff --git a/app/Actions/Commerce/LoyaltyPointIndexAction.ts b/app/Actions/Commerce/LoyaltyPointIndexAction.ts deleted file mode 100644 index 6275be6256..0000000000 --- a/app/Actions/Commerce/LoyaltyPointIndexAction.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Action } from '@stacksjs/actions' -import { response } from '@stacksjs/router' - -export default new Action({ - name: 'LoyaltyPoint Index', - description: 'LoyaltyPoint Index ORM Action', - method: 'GET', - async handle() { - const results = LoyaltyPoint.all() - - return response.json(results) - }, -}) diff --git a/app/Actions/Commerce/LoyaltyPointShowAction.ts b/app/Actions/Commerce/LoyaltyPointShowAction.ts deleted file mode 100644 index 771c10d95a..0000000000 --- a/app/Actions/Commerce/LoyaltyPointShowAction.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { LoyaltyPointRequestType } from '@stacksjs/orm' -import { Action } from '@stacksjs/actions' - -import { response } from '@stacksjs/router' - -export default new Action({ - name: 'LoyaltyPoint Show', - description: 'LoyaltyPoint Show ORM Action', - method: 'GET', - async handle(request: LoyaltyPointRequestType) { - const id = request.getParam('id') - - const model = await LoyaltyPoint.findOrFail(Number(id)) - - return response.json(model) - }, -}) diff --git a/app/Actions/Commerce/LoyaltyPointStoreAction.ts b/app/Actions/Commerce/LoyaltyPointStoreAction.ts deleted file mode 100644 index 82b682d822..0000000000 --- a/app/Actions/Commerce/LoyaltyPointStoreAction.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { LoyaltyPointRequestType } from '@stacksjs/orm' -import { Action } from '@stacksjs/actions' - -import { response } from '@stacksjs/router' - -export default new Action({ - name: 'LoyaltyPoint Store', - description: 'LoyaltyPoint Store ORM Action', - method: 'POST', - async handle(request: LoyaltyPointRequestType) { - await request.validate() - const model = await LoyaltyPoint.create(request.all()) - - return response.json(model) - }, -}) diff --git a/app/Actions/Commerce/ManufacturerDestroyAction.ts b/app/Actions/Commerce/ManufacturerDestroyAction.ts new file mode 100644 index 0000000000..0519ecba6e --- /dev/null +++ b/app/Actions/Commerce/ManufacturerDestroyAction.ts @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/Actions/Commerce/ManufacturerIndexAction.ts b/app/Actions/Commerce/ManufacturerIndexAction.ts index 0fc413535d..27077eaaf1 100644 --- a/app/Actions/Commerce/ManufacturerIndexAction.ts +++ b/app/Actions/Commerce/ManufacturerIndexAction.ts @@ -1,12 +1,16 @@ +import type { ManufacturerRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' + +import { manufacturer } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ name: 'Manufacturer Index', description: 'Manufacturer Index ORM Action', method: 'GET', - async handle() { - const results = Manufacturer.all() + async handle(request: ManufacturerRequestType) { + const results = await manufacturer.fetchWithProductCount() return response.json(results) }, diff --git a/storage/framework/core/commerce/src/gift-cards/destroy.ts b/storage/framework/core/commerce/src/gift-cards/destroy.ts index 15dca72322..b9480b7a7d 100644 --- a/storage/framework/core/commerce/src/gift-cards/destroy.ts +++ b/storage/framework/core/commerce/src/gift-cards/destroy.ts @@ -1,12 +1,13 @@ import { db } from '@stacksjs/database' import { fetchById } from './fetch' +import { formatDate } from '@stacksjs/orm' /** * Delete a gift card by ID * @param id The ID of the gift card to delete * @returns A boolean indicating whether the deletion was successful */ -export async function remove(id: number): Promise { +export async function destroy(id: number): Promise { // First check if the gift card exists const giftCard = await fetchById(id) @@ -28,7 +29,7 @@ export async function remove(id: number): Promise { * @param ids Array of gift card IDs to delete * @returns Number of gift cards successfully deleted */ -export async function bulkRemove(ids: number[]): Promise { +export async function bulkDestroy(ids: number[]): Promise { if (!ids.length) { return 0 } @@ -46,7 +47,7 @@ export async function bulkRemove(ids: number[]): Promise { * Delete expired gift cards * @returns Number of gift cards deleted */ -export async function removeExpired(): Promise { +export async function destroyExpired(): Promise { const currentDate = new Date().toISOString().split('T')[0] // Delete expired gift cards @@ -77,7 +78,7 @@ export async function deactivate(id: number): Promise { .set({ is_active: false, status: 'DEACTIVATED', - updated_at: new Date(), + updated_at: formatDate(new Date()), }) .where('id', '=', id) .executeTakeFirst() diff --git a/storage/framework/core/commerce/src/manufacturer/fetch.ts b/storage/framework/core/commerce/src/manufacturer/fetch.ts index 6dc845e0cd..936ac67bf8 100644 --- a/storage/framework/core/commerce/src/manufacturer/fetch.ts +++ b/storage/framework/core/commerce/src/manufacturer/fetch.ts @@ -1,5 +1,5 @@ import type { ManufacturerJsonResponse } from '@stacksjs/orm' -import type { FetchProductManufacturersOptions, ProductManufacturerResponse } from '../types' +import type { FetchManufacturersOptions, ManufacturerResponse } from '../types' import { db } from '@stacksjs/database' /** @@ -40,7 +40,7 @@ export async function fetchFeatured(limit: number = 10): Promise { +export async function fetchByCountry(country: string, options: FetchManufacturersOptions = {}): Promise { // Set default values const page = options.page || 1 const limit = options.limit || 10 @@ -83,11 +83,7 @@ export async function fetchByCountry(country: string, options: FetchProductManuf /** * Fetch manufacturers with their product count */ -export async function fetchWithProductCount(options: FetchProductManufacturersOptions = {}): Promise { - // Set default values - const page = options.page || 1 - const limit = options.limit || 10 - +export async function fetchWithProductCount(options: FetchManufacturersOptions = {}): Promise { // Start building the query const query = db.selectFrom('manufacturers as m') .leftJoin('products as p', 'p.manufacturer_id', 'm.id') @@ -104,42 +100,13 @@ export async function fetchWithProductCount(options: FetchProductManufacturersOp ]) .groupBy('m.id') - const countQuery = db.selectFrom('manufacturers') - // Apply filters if provided - if (options.country) { + if (options.country) query.where('m.country', '=', options.country) - countQuery.where('country', '=', options.country) - } - if (options.featured !== undefined) { + if (options.featured !== undefined) query.where('m.featured', '=', options.featured) - countQuery.where('featured', '=', options.featured) - } - // Get total count for pagination - const countResult = await countQuery - .select(eb => eb.fn.count('id').as('total')) - .executeTakeFirst() - - const total = Number(countResult?.total || 0) - - // Apply pagination - const manufacturers = await query - .limit(limit) - .offset((page - 1) * limit) - .execute() - - // Calculate pagination info - const totalPages = Math.ceil(total / limit) - - return { - data: manufacturers, - paging: { - total_records: total, - page, - total_pages: totalPages, - }, - next_cursor: page < totalPages ? page + 1 : null, - } + // Return all manufacturers + return query.execute() } diff --git a/storage/framework/core/commerce/src/types.ts b/storage/framework/core/commerce/src/types.ts index 42b8721da4..6fd3f77fe9 100644 --- a/storage/framework/core/commerce/src/types.ts +++ b/storage/framework/core/commerce/src/types.ts @@ -194,7 +194,7 @@ export interface ReviewResponse extends BaseResponse { data: ReviewJsonResponse[] } -export interface ProductManufacturerResponse extends BaseResponse { +export interface ManufacturerResponse extends BaseResponse { data: ManufacturerJsonResponse[] } export interface ReviewStats { @@ -243,7 +243,7 @@ export interface CategoryStats { /** * Options for fetching product manufacturers */ -export interface FetchProductManufacturersOptions { +export interface FetchManufacturersOptions { /** Page number for pagination */ page?: number From e5b9b474318020c81eb6b4497260cde53ed8fdb1 Mon Sep 17 00:00:00 2001 From: cab-mikee Date: Tue, 1 Apr 2025 23:45:52 +0800 Subject: [PATCH 47/78] chore: stepper improvement on horizon orientation --- .../core/components/stepper/components.d.ts | 1 - .../core/components/stepper/package.json | 4 +- .../stepper/src/components/Step.vue | 182 ----------------- .../stepper/src/components/Stepper.vue | 187 ++++++++++++------ .../core/components/stepper/src/index.ts | 5 - 5 files changed, 126 insertions(+), 253 deletions(-) delete mode 100644 storage/framework/core/components/stepper/src/components/Step.vue diff --git a/storage/framework/core/components/stepper/components.d.ts b/storage/framework/core/components/stepper/components.d.ts index 3a01cb0a65..04f8ba6530 100644 --- a/storage/framework/core/components/stepper/components.d.ts +++ b/storage/framework/core/components/stepper/components.d.ts @@ -12,7 +12,6 @@ declare module 'vue' { RouterView: typeof import('vue-router')['RouterView'] Starport: typeof import('vue-starport')['Starport'] StarportCarrier: typeof import('vue-starport')['StarportCarrier'] - Step: typeof import('./src/components/Step.vue')['default'] Stepper: typeof import('./src/components/Stepper.vue')['default'] } } diff --git a/storage/framework/core/components/stepper/package.json b/storage/framework/core/components/stepper/package.json index 83f65a7063..23064b3be1 100644 --- a/storage/framework/core/components/stepper/package.json +++ b/storage/framework/core/components/stepper/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/stepper", "type": "module", - "version": "0.70.22", + "version": "0.69.5", "description": "A modern stepper component.", "author": "Chris Breuer", "contributors": [ @@ -52,7 +52,7 @@ }, "devDependencies": { "@iconify-json/hugeicons": "^1.2.4", - "@microsoft/api-extractor": "^7.52.2", + "@microsoft/api-extractor": "^7.52.1", "@stacksjs/alias": "workspace:*", "@stacksjs/development": "workspace:*", "@stacksjs/dialog": "workspace:*", diff --git a/storage/framework/core/components/stepper/src/components/Step.vue b/storage/framework/core/components/stepper/src/components/Step.vue deleted file mode 100644 index 94bdc641b9..0000000000 --- a/storage/framework/core/components/stepper/src/components/Step.vue +++ /dev/null @@ -1,182 +0,0 @@ - - - - - diff --git a/storage/framework/core/components/stepper/src/components/Stepper.vue b/storage/framework/core/components/stepper/src/components/Stepper.vue index 6ce0f33a1a..b21eec87d1 100644 --- a/storage/framework/core/components/stepper/src/components/Stepper.vue +++ b/storage/framework/core/components/stepper/src/components/Stepper.vue @@ -1,6 +1,5 @@ diff --git a/storage/framework/core/components/stepper/src/index.ts b/storage/framework/core/components/stepper/src/index.ts index a011781a4a..59be075dcb 100644 --- a/storage/framework/core/components/stepper/src/index.ts +++ b/storage/framework/core/components/stepper/src/index.ts @@ -1,12 +1,8 @@ import type { App, Plugin } from 'vue' import type { OptionParams, StepperProps } from './types' -import Step from './components/Step.vue' import Stepper from './components/Stepper.vue' -// Export all components -export { Step } export { Stepper } -export { Step as StepperStep } // Export types export type { OptionParams, StepperProps } @@ -20,7 +16,6 @@ export interface StepperInstance { // Plugin installation export function install(app: App) { app.component('Stepper', Stepper) - app.component('StepperStep', Step) } // Create plugin From c9ced156b40746a0a08d8eadf14c95eacf31b5c6 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Wed, 2 Apr 2025 00:12:28 +0800 Subject: [PATCH 48/78] chore: wip --- app/Actions/Commerce/CouponIndexAction.ts | 1 - app/Actions/Commerce/CustomerDestroyAction.ts | 8 +- .../Commerce/DeliveryRouteIndexAction.ts | 1 - app/Actions/Commerce/GiftCardDestroyAction.ts | 2 +- app/Actions/Commerce/GiftCardUpdateAction.ts | 2 +- .../Commerce/ManufacturerDestroyAction.ts | 1 - .../Commerce/ManufacturerIndexAction.ts | 3 +- app/Actions/Commerce/OrderDestroyAction.ts | 22 ++ app/Actions/Commerce/OrderIndexAction.ts | 4 +- app/Actions/Commerce/OrderShowAction.ts | 4 +- app/Actions/Commerce/OrderStoreAction.ts | 5 +- app/Actions/Commerce/OrderUpdateAction.ts | 19 ++ app/Actions/Commerce/PaymentIndexAction.ts | 7 +- app/Actions/Commerce/PaymentShowAction.ts | 12 +- app/Actions/Commerce/PaymentStoreAction.ts | 5 +- .../Commerce/PrintDeviceDestroyAction.ts | 9 +- .../Commerce/PrintDeviceIndexAction.ts | 3 +- app/Actions/Commerce/PrintDeviceShowAction.ts | 4 +- .../Commerce/PrintDeviceStoreAction.ts | 4 +- .../Commerce/PrintDeviceUpdateAction.ts | 7 +- app/Actions/Commerce/ProductIndexAction.ts | 13 -- .../core/commerce/src/customers/destroy.ts | 4 +- .../core/commerce/src/customers/index.ts | 4 +- .../src/{device => devices}/destroy.ts | 0 .../src/{device => devices}/export.ts | 0 .../commerce/src/{device => devices}/fetch.ts | 0 .../commerce/src/{device => devices}/index.ts | 0 .../commerce/src/{device => devices}/store.ts | 0 .../src/{device => devices}/update.ts | 0 .../core/commerce/src/gift-cards/destroy.ts | 2 +- storage/framework/core/commerce/src/index.ts | 7 +- .../src/{license => licenses}/destroy.ts | 0 .../src/{license => licenses}/fetch.ts | 0 .../src/{license => licenses}/index.ts | 0 .../src/{license => licenses}/store.ts | 0 .../src/{license => licenses}/update.ts | 0 .../core/commerce/src/orders/index.ts | 11 + .../core/commerce/src/orders/store.ts | 198 ++++-------------- .../core/commerce/src/payments/fetch.ts | 16 ++ .../core/commerce/src/payments/index.ts | 5 +- .../core/commerce/src/tests/device.test.ts | 10 +- .../core/commerce/src/tests/license.test.ts | 8 +- .../src/tests/storage/logs/stacks.log | 71 +++++++ .../views/dashboard/storage/logs/stacks.log | 1 + 44 files changed, 245 insertions(+), 228 deletions(-) create mode 100644 app/Actions/Commerce/OrderDestroyAction.ts create mode 100644 app/Actions/Commerce/OrderUpdateAction.ts delete mode 100644 app/Actions/Commerce/ProductIndexAction.ts rename storage/framework/core/commerce/src/{device => devices}/destroy.ts (100%) rename storage/framework/core/commerce/src/{device => devices}/export.ts (100%) rename storage/framework/core/commerce/src/{device => devices}/fetch.ts (100%) rename storage/framework/core/commerce/src/{device => devices}/index.ts (100%) rename storage/framework/core/commerce/src/{device => devices}/store.ts (100%) rename storage/framework/core/commerce/src/{device => devices}/update.ts (100%) rename storage/framework/core/commerce/src/{license => licenses}/destroy.ts (100%) rename storage/framework/core/commerce/src/{license => licenses}/fetch.ts (100%) rename storage/framework/core/commerce/src/{license => licenses}/index.ts (100%) rename storage/framework/core/commerce/src/{license => licenses}/store.ts (100%) rename storage/framework/core/commerce/src/{license => licenses}/update.ts (100%) diff --git a/app/Actions/Commerce/CouponIndexAction.ts b/app/Actions/Commerce/CouponIndexAction.ts index 716dab5837..d6d6bdbc93 100644 --- a/app/Actions/Commerce/CouponIndexAction.ts +++ b/app/Actions/Commerce/CouponIndexAction.ts @@ -1,4 +1,3 @@ -import type { CouponRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' import { coupons } from '@stacksjs/commerce' diff --git a/app/Actions/Commerce/CustomerDestroyAction.ts b/app/Actions/Commerce/CustomerDestroyAction.ts index 89b85f34c0..72e15de7fe 100644 --- a/app/Actions/Commerce/CustomerDestroyAction.ts +++ b/app/Actions/Commerce/CustomerDestroyAction.ts @@ -1,5 +1,7 @@ import type { CustomerRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { customers } from '@stacksjs/commerce' +import { response } from '@stacksjs/router' export default new Action({ name: 'Customer Destroy', @@ -8,10 +10,8 @@ export default new Action({ async handle(request: CustomerRequestType) { const id = request.getParam('id') - const model = await Customer.findOrFail(Number(id)) + await customers.destroy(Number(id)) - model.delete() - - return 'Model deleted!' + return response.json({ message: 'Customer deleted successfully' }) }, }) diff --git a/app/Actions/Commerce/DeliveryRouteIndexAction.ts b/app/Actions/Commerce/DeliveryRouteIndexAction.ts index d09a0d8e6f..19e2a2a729 100644 --- a/app/Actions/Commerce/DeliveryRouteIndexAction.ts +++ b/app/Actions/Commerce/DeliveryRouteIndexAction.ts @@ -1,4 +1,3 @@ -import type { DeliveryRouteRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' import { deliveryRoutes } from '@stacksjs/commerce' diff --git a/app/Actions/Commerce/GiftCardDestroyAction.ts b/app/Actions/Commerce/GiftCardDestroyAction.ts index f973da420b..44daa3833a 100644 --- a/app/Actions/Commerce/GiftCardDestroyAction.ts +++ b/app/Actions/Commerce/GiftCardDestroyAction.ts @@ -16,4 +16,4 @@ export default new Action({ return response.json({ message: 'GiftCard deleted successfully' }) }, -}) \ No newline at end of file +}) diff --git a/app/Actions/Commerce/GiftCardUpdateAction.ts b/app/Actions/Commerce/GiftCardUpdateAction.ts index 4b16eafbd3..64380e4cb9 100644 --- a/app/Actions/Commerce/GiftCardUpdateAction.ts +++ b/app/Actions/Commerce/GiftCardUpdateAction.ts @@ -17,4 +17,4 @@ export default new Action({ return response.json(model) }, -}) \ No newline at end of file +}) diff --git a/app/Actions/Commerce/ManufacturerDestroyAction.ts b/app/Actions/Commerce/ManufacturerDestroyAction.ts index 0519ecba6e..e69de29bb2 100644 --- a/app/Actions/Commerce/ManufacturerDestroyAction.ts +++ b/app/Actions/Commerce/ManufacturerDestroyAction.ts @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/Actions/Commerce/ManufacturerIndexAction.ts b/app/Actions/Commerce/ManufacturerIndexAction.ts index 27077eaaf1..9702b9ac74 100644 --- a/app/Actions/Commerce/ManufacturerIndexAction.ts +++ b/app/Actions/Commerce/ManufacturerIndexAction.ts @@ -1,4 +1,3 @@ -import type { ManufacturerRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' import { manufacturer } from '@stacksjs/commerce' @@ -9,7 +8,7 @@ export default new Action({ name: 'Manufacturer Index', description: 'Manufacturer Index ORM Action', method: 'GET', - async handle(request: ManufacturerRequestType) { + async handle() { const results = await manufacturer.fetchWithProductCount() return response.json(results) diff --git a/app/Actions/Commerce/OrderDestroyAction.ts b/app/Actions/Commerce/OrderDestroyAction.ts new file mode 100644 index 0000000000..ee9c1a7b77 --- /dev/null +++ b/app/Actions/Commerce/OrderDestroyAction.ts @@ -0,0 +1,22 @@ +import type { OrderRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { orders } from '@stacksjs/commerce' + +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'Order Destroy', + description: 'Order Destroy ORM Action', + method: 'DELETE', + async handle(request: OrderRequestType) { + const id = request.getParam('id') + + await orders.destroy(Number(id)) + + return response.json({ + success: true, + message: 'Order deleted successfully', + }) + }, +}) diff --git a/app/Actions/Commerce/OrderIndexAction.ts b/app/Actions/Commerce/OrderIndexAction.ts index 8140dfeb58..eb9158c2c3 100644 --- a/app/Actions/Commerce/OrderIndexAction.ts +++ b/app/Actions/Commerce/OrderIndexAction.ts @@ -1,4 +1,6 @@ import { Action } from '@stacksjs/actions' +import { orders } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -6,7 +8,7 @@ export default new Action({ description: 'Order Index ORM Action', method: 'GET', async handle() { - const results = Order.all() + const results = await orders.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/OrderShowAction.ts b/app/Actions/Commerce/OrderShowAction.ts index 07ed34fdae..cf61f0af20 100644 --- a/app/Actions/Commerce/OrderShowAction.ts +++ b/app/Actions/Commerce/OrderShowAction.ts @@ -1,6 +1,8 @@ import type { OrderRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { orders } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -10,7 +12,7 @@ export default new Action({ async handle(request: OrderRequestType) { const id = request.getParam('id') - const model = await Order.findOrFail(Number(id)) + const model = await orders.fetchById(Number(id)) return response.json(model) }, diff --git a/app/Actions/Commerce/OrderStoreAction.ts b/app/Actions/Commerce/OrderStoreAction.ts index ad072d4a3a..a4188de607 100644 --- a/app/Actions/Commerce/OrderStoreAction.ts +++ b/app/Actions/Commerce/OrderStoreAction.ts @@ -1,6 +1,8 @@ import type { OrderRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { orders } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -9,7 +11,8 @@ export default new Action({ method: 'POST', async handle(request: OrderRequestType) { await request.validate() - const model = await Order.create(request.all()) + + const model = await orders.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/OrderUpdateAction.ts b/app/Actions/Commerce/OrderUpdateAction.ts new file mode 100644 index 0000000000..8e381448d3 --- /dev/null +++ b/app/Actions/Commerce/OrderUpdateAction.ts @@ -0,0 +1,19 @@ +import type { OrderRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { orders } from '@stacksjs/commerce' + +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'Order Update', + description: 'Order Update ORM Action', + method: 'PUT', + async handle(request: OrderRequestType) { + const id = request.getParam('id') + + const model = await orders.update(Number(id), request) + + return response.json(model) + }, +}) diff --git a/app/Actions/Commerce/PaymentIndexAction.ts b/app/Actions/Commerce/PaymentIndexAction.ts index 41b1e73055..868ce5ab41 100644 --- a/app/Actions/Commerce/PaymentIndexAction.ts +++ b/app/Actions/Commerce/PaymentIndexAction.ts @@ -1,12 +1,15 @@ +import type { PaymentRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { payments } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ name: 'Payment Index', description: 'Payment Index ORM Action', method: 'GET', - async handle() { - const results = Payment.all() + + async handle(request: PaymentRequestType) { + const results = await payments.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/PaymentShowAction.ts b/app/Actions/Commerce/PaymentShowAction.ts index acf7bd7011..7683254416 100644 --- a/app/Actions/Commerce/PaymentShowAction.ts +++ b/app/Actions/Commerce/PaymentShowAction.ts @@ -1,19 +1,17 @@ import type { PaymentRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { payments } from '@stacksjs/commerce' import { response } from '@stacksjs/router' -import Payment from '../../orm/src/models/Payment' - export default new Action({ name: 'Payment Show', description: 'Payment Show ORM Action', method: 'GET', - async handle(request: PaymentRequestType) { - const id = request.getParam('id') - const model = await Payment.findOrFail(Number(id)) + async handle(request: PaymentRequestType) { + const id = request.get('id') + const payment = await payments.fetchById(Number(id)) - return response.json(model) + return response.json(payment) }, }) diff --git a/app/Actions/Commerce/PaymentStoreAction.ts b/app/Actions/Commerce/PaymentStoreAction.ts index 219d8af903..d3b8966707 100644 --- a/app/Actions/Commerce/PaymentStoreAction.ts +++ b/app/Actions/Commerce/PaymentStoreAction.ts @@ -1,6 +1,6 @@ import type { PaymentRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { payments } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -9,7 +9,8 @@ export default new Action({ method: 'POST', async handle(request: PaymentRequestType) { await request.validate() - const model = await Payment.create(request.all()) + + const model = await payments.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/PrintDeviceDestroyAction.ts b/app/Actions/Commerce/PrintDeviceDestroyAction.ts index 450c79a75d..504cf36f27 100644 --- a/app/Actions/Commerce/PrintDeviceDestroyAction.ts +++ b/app/Actions/Commerce/PrintDeviceDestroyAction.ts @@ -1,7 +1,8 @@ import type { PrintDeviceRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { PrintDevice } from '@stacksjs/orm' +import { devices } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -11,10 +12,8 @@ export default new Action({ async handle(request: PrintDeviceRequestType) { const id = request.getParam('id') - const model = await PrintDevice.findOrFail(Number(id)) - - model.delete() + await devices.destroy(Number(id)) - return response.json({ message: 'Model deleted!' }) + return response.json({ message: 'PrintDevice deleted successfully' }) }, }) diff --git a/app/Actions/Commerce/PrintDeviceIndexAction.ts b/app/Actions/Commerce/PrintDeviceIndexAction.ts index 96b441936a..c0d012fbaa 100644 --- a/app/Actions/Commerce/PrintDeviceIndexAction.ts +++ b/app/Actions/Commerce/PrintDeviceIndexAction.ts @@ -1,4 +1,5 @@ import { Action } from '@stacksjs/actions' +import { devices } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -6,7 +7,7 @@ export default new Action({ description: 'PrintDevice Index ORM Action', method: 'GET', async handle() { - const results = PrintDevice.all() + const results = await devices.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/PrintDeviceShowAction.ts b/app/Actions/Commerce/PrintDeviceShowAction.ts index ffaf530b9c..b7ab63edf1 100644 --- a/app/Actions/Commerce/PrintDeviceShowAction.ts +++ b/app/Actions/Commerce/PrintDeviceShowAction.ts @@ -1,7 +1,7 @@ import type { PrintDeviceRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { PrintDevice } from '@stacksjs/orm' +import { devices } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -11,7 +11,7 @@ export default new Action({ async handle(request: PrintDeviceRequestType) { const id = request.getParam('id') - const model = await PrintDevice.findOrFail(Number(id)) + const model = await devices.fetchById(Number(id)) return response.json(model) }, diff --git a/app/Actions/Commerce/PrintDeviceStoreAction.ts b/app/Actions/Commerce/PrintDeviceStoreAction.ts index 715d9c6d31..2dcc91cb7c 100644 --- a/app/Actions/Commerce/PrintDeviceStoreAction.ts +++ b/app/Actions/Commerce/PrintDeviceStoreAction.ts @@ -1,7 +1,7 @@ import type { PrintDeviceRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { PrintDevice } from '@stacksjs/orm' +import { devices } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -10,7 +10,7 @@ export default new Action({ method: 'POST', async handle(request: PrintDeviceRequestType) { await request.validate() - const model = await PrintDevice.create(request.all()) + const model = await devices.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/PrintDeviceUpdateAction.ts b/app/Actions/Commerce/PrintDeviceUpdateAction.ts index b4f4f033d2..4dc24cf55b 100644 --- a/app/Actions/Commerce/PrintDeviceUpdateAction.ts +++ b/app/Actions/Commerce/PrintDeviceUpdateAction.ts @@ -1,7 +1,7 @@ import type { PrintDeviceRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { PrintDevice } from '@stacksjs/orm' +import { devices } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -12,10 +12,9 @@ export default new Action({ await request.validate() const id = request.getParam('id') - const model = await PrintDevice.findOrFail(Number(id)) - const result = model.update(request.all()) + const model = await devices.update(Number(id), request) - return response.json(result) + return response.json(model) }, }) diff --git a/app/Actions/Commerce/ProductIndexAction.ts b/app/Actions/Commerce/ProductIndexAction.ts deleted file mode 100644 index 4c6dc05a17..0000000000 --- a/app/Actions/Commerce/ProductIndexAction.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Action } from '@stacksjs/actions' -import { response } from '@stacksjs/router' - -export default new Action({ - name: 'Product Index', - description: 'Product Index ORM Action', - method: 'GET', - async handle() { - const results = Product.all() - - return response.json(results) - }, -}) diff --git a/storage/framework/core/commerce/src/customers/destroy.ts b/storage/framework/core/commerce/src/customers/destroy.ts index fef8cfab85..eff8d161fe 100644 --- a/storage/framework/core/commerce/src/customers/destroy.ts +++ b/storage/framework/core/commerce/src/customers/destroy.ts @@ -7,7 +7,7 @@ import { fetchById } from './fetch' * @param id The ID of the customer to delete * @returns True if the deletion was successful, false otherwise */ -export async function remove(id: number): Promise { +export async function destroy(id: number): Promise { try { // First check if the customer exists const customer = await fetchById(id) @@ -39,7 +39,7 @@ export async function remove(id: number): Promise { * @param ids Array of customer IDs to delete * @returns Number of customers successfully deleted */ -export async function bulkRemove(ids: number[]): Promise { +export async function bulkDestroy(ids: number[]): Promise { if (!ids.length) return 0 diff --git a/storage/framework/core/commerce/src/customers/index.ts b/storage/framework/core/commerce/src/customers/index.ts index 655dc83e02..eae4aba34e 100644 --- a/storage/framework/core/commerce/src/customers/index.ts +++ b/storage/framework/core/commerce/src/customers/index.ts @@ -1,6 +1,6 @@ export { - bulkRemove, - remove, + bulkDestroy, + destroy, } from './destroy' export { diff --git a/storage/framework/core/commerce/src/device/destroy.ts b/storage/framework/core/commerce/src/devices/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/device/destroy.ts rename to storage/framework/core/commerce/src/devices/destroy.ts diff --git a/storage/framework/core/commerce/src/device/export.ts b/storage/framework/core/commerce/src/devices/export.ts similarity index 100% rename from storage/framework/core/commerce/src/device/export.ts rename to storage/framework/core/commerce/src/devices/export.ts diff --git a/storage/framework/core/commerce/src/device/fetch.ts b/storage/framework/core/commerce/src/devices/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/device/fetch.ts rename to storage/framework/core/commerce/src/devices/fetch.ts diff --git a/storage/framework/core/commerce/src/device/index.ts b/storage/framework/core/commerce/src/devices/index.ts similarity index 100% rename from storage/framework/core/commerce/src/device/index.ts rename to storage/framework/core/commerce/src/devices/index.ts diff --git a/storage/framework/core/commerce/src/device/store.ts b/storage/framework/core/commerce/src/devices/store.ts similarity index 100% rename from storage/framework/core/commerce/src/device/store.ts rename to storage/framework/core/commerce/src/devices/store.ts diff --git a/storage/framework/core/commerce/src/device/update.ts b/storage/framework/core/commerce/src/devices/update.ts similarity index 100% rename from storage/framework/core/commerce/src/device/update.ts rename to storage/framework/core/commerce/src/devices/update.ts diff --git a/storage/framework/core/commerce/src/gift-cards/destroy.ts b/storage/framework/core/commerce/src/gift-cards/destroy.ts index b9480b7a7d..a7b41d5b02 100644 --- a/storage/framework/core/commerce/src/gift-cards/destroy.ts +++ b/storage/framework/core/commerce/src/gift-cards/destroy.ts @@ -1,6 +1,6 @@ import { db } from '@stacksjs/database' -import { fetchById } from './fetch' import { formatDate } from '@stacksjs/orm' +import { fetchById } from './fetch' /** * Delete a gift card by ID diff --git a/storage/framework/core/commerce/src/index.ts b/storage/framework/core/commerce/src/index.ts index ccbbbf5a80..273eb5e0a3 100644 --- a/storage/framework/core/commerce/src/index.ts +++ b/storage/framework/core/commerce/src/index.ts @@ -1,10 +1,11 @@ // Main ecommerce module index file import * as coupons from './coupons' import * as customers from './customers' +import * as devices from './devices' import * as digital from './digital' import * as drivers from './drivers' import * as giftCards from './gift-cards' -import * as licenses from './license' +import * as licenses from './licenses' import * as manufacturer from './manufacturer' import * as orders from './orders' import * as payments from './payments' @@ -38,6 +39,7 @@ type DigitalModule = typeof digital type TaxModule = typeof tax type DeliveryRoutesModule = typeof deliveryRoutes type WaitlistModule = typeof waitlist +type DevicesModule = typeof devices export interface EcommerceNamespace { coupons: CouponsModule customers: CustomersModule @@ -58,6 +60,7 @@ export interface EcommerceNamespace { digital: DigitalModule tax: TaxModule waitlist: WaitlistModule + devices: DevicesModule } export const ecommerce: EcommerceNamespace = { @@ -78,6 +81,7 @@ export const ecommerce: EcommerceNamespace = { licenses, unit, digital, + devices, tax, waitlist, } @@ -88,6 +92,7 @@ export { coupons, customers, deliveryRoutes, + devices, digital, drivers, giftCards, diff --git a/storage/framework/core/commerce/src/license/destroy.ts b/storage/framework/core/commerce/src/licenses/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/license/destroy.ts rename to storage/framework/core/commerce/src/licenses/destroy.ts diff --git a/storage/framework/core/commerce/src/license/fetch.ts b/storage/framework/core/commerce/src/licenses/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/license/fetch.ts rename to storage/framework/core/commerce/src/licenses/fetch.ts diff --git a/storage/framework/core/commerce/src/license/index.ts b/storage/framework/core/commerce/src/licenses/index.ts similarity index 100% rename from storage/framework/core/commerce/src/license/index.ts rename to storage/framework/core/commerce/src/licenses/index.ts diff --git a/storage/framework/core/commerce/src/license/store.ts b/storage/framework/core/commerce/src/licenses/store.ts similarity index 100% rename from storage/framework/core/commerce/src/license/store.ts rename to storage/framework/core/commerce/src/licenses/store.ts diff --git a/storage/framework/core/commerce/src/license/update.ts b/storage/framework/core/commerce/src/licenses/update.ts similarity index 100% rename from storage/framework/core/commerce/src/license/update.ts rename to storage/framework/core/commerce/src/licenses/update.ts diff --git a/storage/framework/core/commerce/src/orders/index.ts b/storage/framework/core/commerce/src/orders/index.ts index b10f6192b8..39d8b1ccb6 100644 --- a/storage/framework/core/commerce/src/orders/index.ts +++ b/storage/framework/core/commerce/src/orders/index.ts @@ -19,3 +19,14 @@ export { fetchDailyOrderTrends, fetchStats, } from './fetch' + +export { + bulkStore, + store, +} from './store' + +export { + update, + updateDeliveryInfo, + updateStatus, +} from './update' diff --git a/storage/framework/core/commerce/src/orders/store.ts b/storage/framework/core/commerce/src/orders/store.ts index 447b7c59b9..3db1e5aa02 100644 --- a/storage/framework/core/commerce/src/orders/store.ts +++ b/storage/framework/core/commerce/src/orders/store.ts @@ -1,180 +1,62 @@ // Import dependencies -import type { NewProductUnit, ProductUnitJsonResponse, ProductUnitRequestType } from '@stacksjs/orm' +import type { NewOrder, OrderJsonResponse, OrderRequestType } from '@stacksjs/orm' import { randomUUIDv7 } from 'bun' import { db } from '@stacksjs/database' +import { formatDate } from '@stacksjs/orm' /** - * Create a new product unit + * Create a new order * - * @param request Product unit data to store - * @returns The newly created product unit record + * @param request The order data to store + * @returns The newly created order record */ -export async function store(request: ProductUnitRequestType): Promise { - // Validate the request data +export async function store(request: OrderRequestType): Promise { await request.validate() - try { - // Prepare product unit data - const unitData: NewProductUnit = { - name: request.get('name'), - product_id: request.get('product_id'), - abbreviation: request.get('abbreviation'), - type: request.get('type'), - description: request.get('description'), - is_default: request.get('is_default', false), - } - - unitData.uuid = randomUUIDv7() - - // Insert the product unit - const result = await db - .insertInto('product_units') - .values(unitData) - .executeTakeFirst() - - const unitId = Number(result.insertId) - - // If this unit is set as default, update all other units of the same type - if (unitData.is_default) { - await db - .updateTable('product_units') - .set({ is_default: false }) - .where('type', '=', unitData.type) - .where('id', '!=', unitId) - .execute() - } - - // Retrieve the newly created product unit - const unit = await db - .selectFrom('product_units') - .where('id', '=', unitId) - .selectAll() - .executeTakeFirst() - - return unit + const orderData: NewOrder = { + customer_id: request.get('customer_id'), + coupon_id: request.get('coupon_id'), + status: request.get('status') || 'PENDING', + total_amount: request.get('total_amount'), + tax_amount: request.get('tax_amount'), + discount_amount: request.get('discount_amount'), + delivery_fee: request.get('delivery_fee'), + tip_amount: request.get('tip_amount'), + order_type: request.get('order_type'), + delivery_address: request.get('delivery_address'), + special_instructions: request.get('special_instructions'), + estimated_delivery_time: request.get('estimated_delivery_time'), + applied_coupon_id: request.get('applied_coupon_id'), + uuid: randomUUIDv7(), + created_at: formatDate(new Date()), + updated_at: formatDate(new Date()), } - catch (error) { - if (error instanceof Error) { - throw new TypeError(`Failed to create product unit: ${error.message}`) - } - - throw error - } -} - -/** - * Create multiple product units at once - * - * @param requests Array of product unit data to store - * @returns Number of product units created - */ -export async function bulkStore(requests: ProductUnitRequestType[]): Promise { - if (!requests.length) - return 0 - - let createdCount = 0 try { - // Process each product unit - await db.transaction().execute(async (trx) => { - for (const request of requests) { - // Validate request data - request.validate() - - // Prepare product unit data - const unitData: NewProductUnit = { - name: request.get('name'), - product_id: request.get('product_id'), - abbreviation: request.get('abbreviation'), - type: request.get('type'), - description: request.get('description'), - is_default: request.get('is_default') || false, - } - - // Insert the product unit - const result = await trx - .insertInto('product_units') - .values(unitData) - .executeTakeFirst() - - const unitId = Number(result.insertId) - - // If this unit is set as default, update all other units of the same type - if (unitData.is_default) { - await trx - .updateTable('product_units') - .set({ is_default: false }) - .where('type', '=', unitData.type) - .where('id', '!=', unitId) - .execute() - } - - createdCount++ - } - }) - - return createdCount - } - catch (error) { - if (error instanceof Error) { - throw new TypeError(`Failed to create product units in bulk: ${error.message}`) - } - - throw error - } -} + // Insert the order record + const createdOrder = await db + .insertInto('orders') + .values(orderData) + .executeTakeFirst() -/** - * Format product unit options for dropdown menus or selectors - * - * @param type Optional filter by unit type - * @returns Array of formatted unit options with id, name, and abbreviation - */ -export function formatUnitOptions( - type?: string, -): Promise<{ id: number, name: string, abbreviation: string, is_default: boolean | undefined }[]> { - try { - let query = db - .selectFrom('product_units') - .select(['id', 'name', 'abbreviation', 'is_default']) - .orderBy('name') + const insertId = Number(createdOrder?.insertId) || Number(createdOrder?.numInsertedOrUpdatedRows) - // Filter by type if provided - if (type) - query = query.where('type', '=', type) + // If insert was successful, retrieve the newly created order + if (insertId) { + const order = await db + .selectFrom('orders') + .where('id', '=', insertId) + .selectAll() + .executeTakeFirst() - return query.execute() - } - catch (error) { - if (error instanceof Error) { - throw new TypeError(`Failed to format unit options: ${error.message}`) + return order } - throw error - } -} - -/** - * Get the default unit for a specific type - * - * @param type The unit type to get the default for - * @returns The default unit or undefined if none found - */ -export async function getDefaultUnit(type: string): Promise { - try { - const defaultUnit = await db - .selectFrom('product_units') - .selectAll() - .where('type', '=', type) - .where('is_default', '=', true) - .executeTakeFirst() - - return defaultUnit + return undefined } catch (error) { - if (error instanceof Error) { - throw new TypeError(`Failed to get default unit: ${error.message}`) - } + if (error instanceof Error) + throw new Error(`Failed to create order: ${error.message}`) throw error } diff --git a/storage/framework/core/commerce/src/payments/fetch.ts b/storage/framework/core/commerce/src/payments/fetch.ts index a99d161279..d4a387cf70 100644 --- a/storage/framework/core/commerce/src/payments/fetch.ts +++ b/storage/framework/core/commerce/src/payments/fetch.ts @@ -1,3 +1,4 @@ +import type { PaymentJsonResponse } from '@stacksjs/orm' import { db, sql } from '@stacksjs/database' import { formatDate } from '@stacksjs/orm' @@ -28,6 +29,21 @@ export interface PaymentStats { } } +export async function fetchAll(): Promise { + return await db + .selectFrom('payments') + .selectAll() + .execute() +} + +export async function fetchById(id: number): Promise { + return await db + .selectFrom('payments') + .selectAll() + .where('id', '=', id) + .executeTakeFirst() +} + /** * Fetch payment statistics for a specific time period * diff --git a/storage/framework/core/commerce/src/payments/index.ts b/storage/framework/core/commerce/src/payments/index.ts index ec00f5933d..a9daed98fc 100644 --- a/storage/framework/core/commerce/src/payments/index.ts +++ b/storage/framework/core/commerce/src/payments/index.ts @@ -2,13 +2,12 @@ export { bulkDestroy, destroy } from './destroy' // Fetch operations - from fetch.ts export { + fetchAll, + fetchById, fetchMonthlyPaymentTrends, fetchPaymentStats, fetchPaymentStatsByMethod, } from './fetch' -// Export types from fetch.ts -export type { PaymentStats } from './fetch' - // Store operations - from store.ts export { store } from './store' diff --git a/storage/framework/core/commerce/src/tests/device.test.ts b/storage/framework/core/commerce/src/tests/device.test.ts index f67d4671a6..eb0b9c4218 100644 --- a/storage/framework/core/commerce/src/tests/device.test.ts +++ b/storage/framework/core/commerce/src/tests/device.test.ts @@ -1,10 +1,10 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, destroy } from '../device/destroy' -import { exportPrintDevices } from '../device/export' -import { calculateErrorRate, calculatePrinterHealth, countPrintsByDeviceId, countTotalPrints, fetchAll, fetchById, getPrinterStatusCounts } from '../device/fetch' -import { bulkStore, store } from '../device/store' -import { update, updatePrintCount, updateStatus } from '../device/update' +import { bulkDestroy, destroy } from '../devices/destroy' +import { exportPrintDevices } from '../devices/export' +import { calculateErrorRate, calculatePrinterHealth, countPrintsByDeviceId, countTotalPrints, fetchAll, fetchById, getPrinterStatusCounts } from '../devices/fetch' +import { bulkStore, store } from '../devices/store' +import { update, updatePrintCount, updateStatus } from '../devices/update' import { store as storeReceipt } from '../receipts/store' // Create a request-like object for testing diff --git a/storage/framework/core/commerce/src/tests/license.test.ts b/storage/framework/core/commerce/src/tests/license.test.ts index 30a5ccfeee..8d2aa8d49f 100644 --- a/storage/framework/core/commerce/src/tests/license.test.ts +++ b/storage/framework/core/commerce/src/tests/license.test.ts @@ -1,10 +1,10 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { formatDate } from '@stacksjs/orm' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, bulkSoftDelete, destroy, softDelete } from '../license/destroy' -import { fetchAll, fetchById } from '../license/fetch' -import { bulkStore, store } from '../license/store' -import { update, updateExpiration, updateStatus } from '../license/update' +import { bulkDestroy, bulkSoftDelete, destroy, softDelete } from '../licenses/destroy' +import { fetchAll, fetchById } from '../licenses/fetch' +import { bulkStore, store } from '../licenses/store' +import { update, updateExpiration, updateStatus } from '../licenses/update' // Create a request-like object for testing class TestRequest { diff --git a/storage/framework/core/commerce/src/tests/storage/logs/stacks.log b/storage/framework/core/commerce/src/tests/storage/logs/stacks.log index caf39b1a7e..92990a3770 100644 --- a/storage/framework/core/commerce/src/tests/storage/logs/stacks.log +++ b/storage/framework/core/commerce/src/tests/storage/logs/stacks.log @@ -18,3 +18,74 @@ [2025-03-31T14:24:31.402Z] INFO: Migrating database... [2025-03-31T14:24:31.556Z] INFO: Migrating database... [2025-03-31T14:24:31.706Z] INFO: Migrating database... +[2025-04-01T12:57:40.692Z] DEBUG: Using database driver: sqlite +[2025-04-01T12:57:40.925Z] INFO: Migrating database... +[2025-04-01T12:57:41.128Z] INFO: Migrating database... +[2025-04-01T12:57:41.394Z] INFO: Migrating database... +[2025-04-01T12:57:41.583Z] INFO: Migrating database... +[2025-04-01T12:57:41.752Z] INFO: Migrating database... +[2025-04-01T12:57:42.020Z] INFO: Migrating database... +[2025-04-01T12:57:42.201Z] INFO: Migrating database... +[2025-04-01T12:57:42.383Z] INFO: Migrating database... +[2025-04-01T12:57:42.577Z] INFO: Migrating database... +[2025-04-01T12:57:42.766Z] INFO: Migrating database... +[2025-04-01T12:57:42.928Z] INFO: Migrating database... +[2025-04-01T12:57:43.114Z] INFO: Migrating database... +[2025-04-01T12:57:43.320Z] INFO: Migrating database... +[2025-04-01T12:57:43.540Z] INFO: Migrating database... +[2025-04-01T12:57:43.727Z] INFO: Migrating database... +[2025-04-01T12:57:43.912Z] INFO: Migrating database... +[2025-04-01T12:57:44.227Z] INFO: Migrating database... +[2025-04-01T12:57:44.495Z] INFO: Migrating database... +[2025-04-01T12:57:44.680Z] INFO: Migrating database... +[2025-04-01T12:57:44.847Z] INFO: Migrating database... +[2025-04-01T12:57:45.040Z] INFO: Migrating database... +[2025-04-01T12:57:45.218Z] INFO: Migrating database... +[2025-04-01T13:06:46.575Z] DEBUG: Using database driver: sqlite +[2025-04-01T13:06:46.784Z] INFO: Migrating database... +[2025-04-01T13:06:46.980Z] INFO: Migrating database... +[2025-04-01T13:06:47.268Z] INFO: Migrating database... +[2025-04-01T13:06:47.452Z] INFO: Migrating database... +[2025-04-01T13:06:47.713Z] INFO: Migrating database... +[2025-04-01T13:06:47.930Z] INFO: Migrating database... +[2025-04-01T13:06:48.107Z] INFO: Migrating database... +[2025-04-01T13:06:48.294Z] INFO: Migrating database... +[2025-04-01T13:06:48.482Z] INFO: Migrating database... +[2025-04-01T13:06:48.665Z] INFO: Migrating database... +[2025-04-01T13:06:48.850Z] INFO: Migrating database... +[2025-04-01T13:06:49.062Z] INFO: Migrating database... +[2025-04-01T13:06:49.273Z] INFO: Migrating database... +[2025-04-01T13:06:49.465Z] INFO: Migrating database... +[2025-04-01T13:06:49.642Z] INFO: Migrating database... +[2025-04-01T13:06:49.850Z] INFO: Migrating database... +[2025-04-01T13:06:50.090Z] INFO: Migrating database... +[2025-04-01T13:06:50.441Z] INFO: Migrating database... +[2025-04-01T13:06:50.659Z] INFO: Migrating database... +[2025-04-01T13:06:50.890Z] INFO: Migrating database... +[2025-04-01T13:06:51.078Z] INFO: Migrating database... +[2025-04-01T13:06:51.309Z] INFO: Migrating database... +[2025-04-01T13:08:40.197Z] DEBUG: Using database driver: sqlite +[2025-04-01T13:08:40.500Z] INFO: Migrating database... +[2025-04-01T13:08:40.715Z] INFO: Migrating database... +[2025-04-01T13:08:40.961Z] INFO: Migrating database... +[2025-04-01T13:08:41.168Z] INFO: Migrating database... +[2025-04-01T13:08:41.391Z] INFO: Migrating database... +[2025-04-01T13:08:41.614Z] INFO: Migrating database... +[2025-04-01T13:08:41.815Z] INFO: Migrating database... +[2025-04-01T13:08:42.085Z] INFO: Migrating database... +[2025-04-01T13:08:42.280Z] INFO: Migrating database... +[2025-04-01T13:08:42.487Z] INFO: Migrating database... +[2025-04-01T13:08:42.694Z] INFO: Migrating database... +[2025-04-01T13:08:42.907Z] INFO: Migrating database... +[2025-04-01T13:08:43.217Z] INFO: Migrating database... +[2025-04-01T13:08:43.420Z] INFO: Migrating database... +[2025-04-01T13:08:43.616Z] INFO: Migrating database... +[2025-04-01T13:08:43.871Z] INFO: Migrating database... +[2025-04-01T13:08:44.087Z] INFO: Migrating database... +[2025-04-01T13:08:44.255Z] INFO: Migrating database... +[2025-04-01T13:08:44.434Z] INFO: Migrating database... +[2025-04-01T13:08:44.608Z] INFO: Migrating database... +[2025-04-01T13:08:44.810Z] INFO: Migrating database... +[2025-04-01T13:08:45.011Z] INFO: Migrating database... +[2025-04-01T13:08:45.201Z] INFO: Migrating database... +[2025-04-01T13:08:45.395Z] INFO: Migrating database... diff --git a/storage/framework/views/dashboard/storage/logs/stacks.log b/storage/framework/views/dashboard/storage/logs/stacks.log index b70b8422c4..222bc7c325 100644 --- a/storage/framework/views/dashboard/storage/logs/stacks.log +++ b/storage/framework/views/dashboard/storage/logs/stacks.log @@ -8,3 +8,4 @@ [2025-03-29T17:21:36.402Z] DEBUG: Using database driver: sqlite [2025-03-29T17:21:36.423Z] DEBUG: Using database driver: sqlite [2025-03-31T10:59:22.638Z] DEBUG: Using database driver: sqlite +[2025-04-01T12:48:15.683Z] DEBUG: Using database driver: sqlite From 6238bc68616b2286842a8ed4fb3490b012d34f5d Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Wed, 2 Apr 2025 00:34:57 +0800 Subject: [PATCH 49/78] chore: wip --- app/Actions/Commerce/DriverIndexAction.ts | 3 +- app/Actions/Commerce/GiftCardIndexAction.ts | 3 +- app/Actions/Commerce/LicenseKeyIndexAction.ts | 3 +- app/Actions/Commerce/PaymentIndexAction.ts | 3 +- storage/framework/core/commerce/src/index.ts | 26 +-- .../src/{ => products}/categories/destroy.ts | 0 .../src/{ => products}/categories/fetch.ts | 2 +- .../src/{ => products}/categories/index.ts | 0 .../src/{ => products}/categories/store.ts | 2 +- .../src/{ => products}/categories/update.ts | 0 .../core/commerce/src/products/index.ts | 35 ++++ .../commerce/src/products/items/destroy.ts | 54 ++++++ .../core/commerce/src/products/items/fetch.ts | 20 +++ .../core/commerce/src/products/items/index.ts | 24 +++ .../core/commerce/src/products/items/store.ts | 116 +++++++++++++ .../commerce/src/products/items/update.ts | 157 ++++++++++++++++++ .../{ => products}/manufacturer/destroy.ts | 0 .../src/{ => products}/manufacturer/fetch.ts | 0 .../src/{ => products}/manufacturer/index.ts | 0 .../src/{ => products}/manufacturer/store.ts | 0 .../src/{ => products}/manufacturer/update.ts | 0 .../src/{ => products}/reviews/destroy.ts | 0 .../src/{ => products}/reviews/fetch.ts | 0 .../src/{ => products}/reviews/index.ts | 0 .../src/{ => products}/reviews/store.ts | 0 .../src/{ => products}/reviews/update.ts | 0 .../src/{ => products}/unit/destroy.ts | 0 .../commerce/src/{ => products}/unit/index.ts | 0 .../commerce/src/{ => products}/unit/store.ts | 0 .../src/{ => products}/unit/update.ts | 0 .../src/{ => products}/variants/destroy.ts | 0 .../src/{ => products}/variants/index.ts | 0 .../src/{ => products}/variants/store.ts | 0 .../src/{ => products}/variants/update.ts | 0 34 files changed, 418 insertions(+), 30 deletions(-) rename storage/framework/core/commerce/src/{ => products}/categories/destroy.ts (100%) rename storage/framework/core/commerce/src/{ => products}/categories/fetch.ts (99%) rename storage/framework/core/commerce/src/{ => products}/categories/index.ts (100%) rename storage/framework/core/commerce/src/{ => products}/categories/store.ts (98%) rename storage/framework/core/commerce/src/{ => products}/categories/update.ts (100%) create mode 100644 storage/framework/core/commerce/src/products/index.ts create mode 100644 storage/framework/core/commerce/src/products/items/destroy.ts create mode 100644 storage/framework/core/commerce/src/products/items/fetch.ts create mode 100644 storage/framework/core/commerce/src/products/items/index.ts create mode 100644 storage/framework/core/commerce/src/products/items/store.ts create mode 100644 storage/framework/core/commerce/src/products/items/update.ts rename storage/framework/core/commerce/src/{ => products}/manufacturer/destroy.ts (100%) rename storage/framework/core/commerce/src/{ => products}/manufacturer/fetch.ts (100%) rename storage/framework/core/commerce/src/{ => products}/manufacturer/index.ts (100%) rename storage/framework/core/commerce/src/{ => products}/manufacturer/store.ts (100%) rename storage/framework/core/commerce/src/{ => products}/manufacturer/update.ts (100%) rename storage/framework/core/commerce/src/{ => products}/reviews/destroy.ts (100%) rename storage/framework/core/commerce/src/{ => products}/reviews/fetch.ts (100%) rename storage/framework/core/commerce/src/{ => products}/reviews/index.ts (100%) rename storage/framework/core/commerce/src/{ => products}/reviews/store.ts (100%) rename storage/framework/core/commerce/src/{ => products}/reviews/update.ts (100%) rename storage/framework/core/commerce/src/{ => products}/unit/destroy.ts (100%) rename storage/framework/core/commerce/src/{ => products}/unit/index.ts (100%) rename storage/framework/core/commerce/src/{ => products}/unit/store.ts (100%) rename storage/framework/core/commerce/src/{ => products}/unit/update.ts (100%) rename storage/framework/core/commerce/src/{ => products}/variants/destroy.ts (100%) rename storage/framework/core/commerce/src/{ => products}/variants/index.ts (100%) rename storage/framework/core/commerce/src/{ => products}/variants/store.ts (100%) rename storage/framework/core/commerce/src/{ => products}/variants/update.ts (100%) diff --git a/app/Actions/Commerce/DriverIndexAction.ts b/app/Actions/Commerce/DriverIndexAction.ts index 12d8843808..eb9b12ad96 100644 --- a/app/Actions/Commerce/DriverIndexAction.ts +++ b/app/Actions/Commerce/DriverIndexAction.ts @@ -1,4 +1,3 @@ -import type { DriverRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' import { drivers } from '@stacksjs/commerce' @@ -9,7 +8,7 @@ export default new Action({ name: 'Driver Index', description: 'Driver Index ORM Action', method: 'GET', - async handle(request: DriverRequestType) { + async handle() { const results = await drivers.fetchAll() return response.json(results) diff --git a/app/Actions/Commerce/GiftCardIndexAction.ts b/app/Actions/Commerce/GiftCardIndexAction.ts index 803294c990..f8e73e59cb 100644 --- a/app/Actions/Commerce/GiftCardIndexAction.ts +++ b/app/Actions/Commerce/GiftCardIndexAction.ts @@ -1,4 +1,3 @@ -import type { GiftCardRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' import { giftCards } from '@stacksjs/commerce' @@ -9,7 +8,7 @@ export default new Action({ name: 'GiftCard Index', description: 'GiftCard Index ORM Action', method: 'GET', - async handle(request: GiftCardRequestType) { + async handle() { const results = await giftCards.fetchAll() return response.json(results) diff --git a/app/Actions/Commerce/LicenseKeyIndexAction.ts b/app/Actions/Commerce/LicenseKeyIndexAction.ts index 43688244e6..4d7cf75930 100644 --- a/app/Actions/Commerce/LicenseKeyIndexAction.ts +++ b/app/Actions/Commerce/LicenseKeyIndexAction.ts @@ -1,4 +1,3 @@ -import type { LicenseKeyRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' import { licenses } from '@stacksjs/commerce' @@ -9,7 +8,7 @@ export default new Action({ name: 'LicenseKey Index', description: 'LicenseKey Index ORM Action', method: 'GET', - async handle(request: LicenseKeyRequestType) { + async handle() { const results = await licenses.fetchAll() return response.json(results) diff --git a/app/Actions/Commerce/PaymentIndexAction.ts b/app/Actions/Commerce/PaymentIndexAction.ts index 868ce5ab41..b9498278f1 100644 --- a/app/Actions/Commerce/PaymentIndexAction.ts +++ b/app/Actions/Commerce/PaymentIndexAction.ts @@ -1,4 +1,3 @@ -import type { PaymentRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' import { payments } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -8,7 +7,7 @@ export default new Action({ description: 'Payment Index ORM Action', method: 'GET', - async handle(request: PaymentRequestType) { + async handle() { const results = await payments.fetchAll() return response.json(results) diff --git a/storage/framework/core/commerce/src/index.ts b/storage/framework/core/commerce/src/index.ts index 273eb5e0a3..5e22eef444 100644 --- a/storage/framework/core/commerce/src/index.ts +++ b/storage/framework/core/commerce/src/index.ts @@ -6,33 +6,27 @@ import * as digital from './digital' import * as drivers from './drivers' import * as giftCards from './gift-cards' import * as licenses from './licenses' -import * as manufacturer from './manufacturer' import * as orders from './orders' import * as payments from './payments' +import * as products from './products' import * as rates from './rates' import * as restaurant from './restaurant' -import * as reviews from './reviews' import * as deliveryRoutes from './routes' import * as shipping from './shipping' import * as tax from './tax' -import * as unit from './unit' -import * as variants from './variants' import * as waitlist from './waitlist' import * as zones from './zones' type CouponsModule = typeof coupons type CustomersModule = typeof customers type GiftCardsModule = typeof giftCards -type ManufacturerModule = typeof manufacturer type OrdersModule = typeof orders type PaymentsModule = typeof payments -type ReviewsModule = typeof reviews +type ProductsModule = typeof products type RestaurantModule = typeof restaurant -type UnitModule = typeof unit type ShippingModule = typeof shipping type RatesModule = typeof rates type ZonesModule = typeof zones -type VariantsModule = typeof variants type DriversModule = typeof drivers type LicensesModule = typeof licenses type DigitalModule = typeof digital @@ -40,21 +34,19 @@ type TaxModule = typeof tax type DeliveryRoutesModule = typeof deliveryRoutes type WaitlistModule = typeof waitlist type DevicesModule = typeof devices + export interface EcommerceNamespace { coupons: CouponsModule customers: CustomersModule giftCards: GiftCardsModule - manufacturer: ManufacturerModule orders: OrdersModule drivers: DriversModule payments: PaymentsModule - reviews: ReviewsModule + products: ProductsModule restaurant: RestaurantModule shipping: ShippingModule rates: RatesModule zones: ZonesModule - variants: VariantsModule - unit: UnitModule deliveryRoutes: DeliveryRoutesModule licenses: LicensesModule digital: DigitalModule @@ -67,19 +59,16 @@ export const ecommerce: EcommerceNamespace = { coupons, customers, giftCards, - manufacturer, drivers, orders, payments, - reviews, + products, restaurant, shipping, deliveryRoutes, rates, zones, - variants, licenses, - unit, digital, devices, tax, @@ -97,16 +86,13 @@ export { drivers, giftCards, licenses, - manufacturer, orders, payments, + products, rates, restaurant, - reviews, shipping, tax, - unit, - variants, waitlist, zones, } diff --git a/storage/framework/core/commerce/src/categories/destroy.ts b/storage/framework/core/commerce/src/products/categories/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/categories/destroy.ts rename to storage/framework/core/commerce/src/products/categories/destroy.ts diff --git a/storage/framework/core/commerce/src/categories/fetch.ts b/storage/framework/core/commerce/src/products/categories/fetch.ts similarity index 99% rename from storage/framework/core/commerce/src/categories/fetch.ts rename to storage/framework/core/commerce/src/products/categories/fetch.ts index d828bde9d6..7d1d80524f 100644 --- a/storage/framework/core/commerce/src/categories/fetch.ts +++ b/storage/framework/core/commerce/src/products/categories/fetch.ts @@ -1,5 +1,5 @@ import type { CategoryJsonResponse } from '@stacksjs/orm' -import type { CategoryStats } from '../types' +import type { CategoryStats } from '../../types' import { db } from '@stacksjs/database' import { formatDate } from '@stacksjs/orm' diff --git a/storage/framework/core/commerce/src/categories/index.ts b/storage/framework/core/commerce/src/products/categories/index.ts similarity index 100% rename from storage/framework/core/commerce/src/categories/index.ts rename to storage/framework/core/commerce/src/products/categories/index.ts diff --git a/storage/framework/core/commerce/src/categories/store.ts b/storage/framework/core/commerce/src/products/categories/store.ts similarity index 98% rename from storage/framework/core/commerce/src/categories/store.ts rename to storage/framework/core/commerce/src/products/categories/store.ts index c94df1f7c0..66b8f7d1cf 100644 --- a/storage/framework/core/commerce/src/categories/store.ts +++ b/storage/framework/core/commerce/src/products/categories/store.ts @@ -1,5 +1,5 @@ import type { CategoryRequestType } from '@stacksjs/orm' -import type { CategoryJsonResponse, NewCategory } from '../../../../orm/src/models/Category' +import type { CategoryJsonResponse, NewCategory } from '../../../../../orm/src/models/Category' import { randomUUIDv7 } from 'bun' import { db } from '@stacksjs/database' diff --git a/storage/framework/core/commerce/src/categories/update.ts b/storage/framework/core/commerce/src/products/categories/update.ts similarity index 100% rename from storage/framework/core/commerce/src/categories/update.ts rename to storage/framework/core/commerce/src/products/categories/update.ts diff --git a/storage/framework/core/commerce/src/products/index.ts b/storage/framework/core/commerce/src/products/index.ts new file mode 100644 index 0000000000..5156484b49 --- /dev/null +++ b/storage/framework/core/commerce/src/products/index.ts @@ -0,0 +1,35 @@ +import * as categories from './categories' +import * as items from './items' +import * as manufacturer from './manufacturer' +import * as reviews from './reviews' +import * as unit from './unit' +import * as variants from './variants' + +export { + categories, + items, + manufacturer, + reviews, + unit, + variants, +} + +interface ProductsNamespace { + categories: typeof categories + items: typeof items + manufacturer: typeof manufacturer + reviews: typeof reviews + unit: typeof unit + variants: typeof variants +} + +const products: ProductsNamespace = { + categories, + items, + manufacturer, + reviews, + unit, + variants, +} + +export default products diff --git a/storage/framework/core/commerce/src/products/items/destroy.ts b/storage/framework/core/commerce/src/products/items/destroy.ts new file mode 100644 index 0000000000..ac5b3069f4 --- /dev/null +++ b/storage/framework/core/commerce/src/products/items/destroy.ts @@ -0,0 +1,54 @@ +import { db } from '@stacksjs/database' + +/** + * Delete a product item by ID + * + * @param id The ID of the product item to delete + * @returns True if the product item was deleted, false otherwise + */ +export async function destroy(id: number): Promise { + try { + const result = await db + .deleteFrom('product_items') + .where('id', '=', id) + .executeTakeFirst() + + return Number(result.numDeletedRows) > 0 + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to delete product item: ${error.message}`) + } + + throw error + } +} + +/** + * Delete multiple product items by ID + * + * @param ids Array of product item IDs to delete + * @returns Number of product items deleted + */ +export async function bulkDestroy(ids: number[]): Promise { + if (!ids.length) + return 0 + + try { + // Perform the delete operation + const result = await db + .deleteFrom('product_items') + .where('id', 'in', ids) + .executeTakeFirst() + + // Return the number of deleted rows + return Number(result.numDeletedRows) + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to delete product items: ${error.message}`) + } + + throw error + } +} diff --git a/storage/framework/core/commerce/src/products/items/fetch.ts b/storage/framework/core/commerce/src/products/items/fetch.ts new file mode 100644 index 0000000000..c4a6a206b2 --- /dev/null +++ b/storage/framework/core/commerce/src/products/items/fetch.ts @@ -0,0 +1,20 @@ +import type { ProductItemJsonResponse } from '@stacksjs/orm' +import { db } from '@stacksjs/database' + +/** + * Fetch a product item by ID + */ +export async function fetchById(id: number): Promise { + return await db + .selectFrom('product_items') + .where('id', '=', id) + .selectAll() + .executeTakeFirst() +} + +/** + * Fetch all product items + */ +export async function fetchAll(): Promise { + return await db.selectFrom('product_items').selectAll().execute() +} diff --git a/storage/framework/core/commerce/src/products/items/index.ts b/storage/framework/core/commerce/src/products/items/index.ts new file mode 100644 index 0000000000..3336f4e646 --- /dev/null +++ b/storage/framework/core/commerce/src/products/items/index.ts @@ -0,0 +1,24 @@ +// Functions from destroy.ts +export { + bulkDestroy, + destroy, +} from './destroy' + +// Functions from fetch.ts +export { + fetchAll, + fetchById, +} from './fetch' + +// Functions from store.ts +export { + bulkStore, + store, +} from './store' + +// Functions from update.ts +export { + update, + updateAvailability, + updateInventory, +} from './update' diff --git a/storage/framework/core/commerce/src/products/items/store.ts b/storage/framework/core/commerce/src/products/items/store.ts new file mode 100644 index 0000000000..c1ca1fb78e --- /dev/null +++ b/storage/framework/core/commerce/src/products/items/store.ts @@ -0,0 +1,116 @@ +import type { NewProductItem, ProductItemJsonResponse, ProductItemRequestType } from '@stacksjs/orm' +import { randomUUIDv7 } from 'bun' +import { db } from '@stacksjs/database' + +/** + * Create a new product item + * + * @param request Product item data to store + * @returns The newly created product item record + */ +export async function store(request: ProductItemRequestType): Promise { + // Validate the request data + await request.validate() + + try { + // Prepare product item data + const itemData: NewProductItem = { + name: request.get('name'), + size: request.get('size'), + color: request.get('color'), + price: request.get('price'), + image_url: request.get('image_url'), + is_available: request.get('is_available'), + inventory_count: request.get('inventory_count'), + sku: request.get('sku'), + custom_options: request.get('custom_options'), + product_id: request.get('product_id'), + manufacturer_id: request.get('manufacturer_id'), + category_id: request.get('category_id'), + } + + itemData.uuid = randomUUIDv7() + + // Insert the product item + const result = await db + .insertInto('product_items') + .values(itemData) + .executeTakeFirst() + + const itemId = Number(result.insertId) || Number(result.numInsertedOrUpdatedRows) + + // Retrieve the newly created product item + const productItem = await db + .selectFrom('product_items') + .where('id', '=', itemId) + .selectAll() + .executeTakeFirst() + + return productItem + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to create product item: ${error.message}`) + } + + throw error + } +} + +/** + * Create multiple product items at once + * + * @param requests Array of product item data to store + * @returns Number of product items created + */ +export async function bulkStore(requests: ProductItemRequestType[]): Promise { + if (!requests.length) + return 0 + + let createdCount = 0 + + try { + // Process each product item + await db.transaction().execute(async (trx) => { + for (const request of requests) { + // Validate request data + request.validate() + + // Prepare product item data + const itemData: NewProductItem = { + name: request.get('name'), + size: request.get('size'), + color: request.get('color'), + price: request.get('price'), + image_url: request.get('image_url'), + is_available: request.get('is_available'), + inventory_count: request.get('inventory_count'), + sku: request.get('sku'), + custom_options: request.get('custom_options'), + product_id: request.get('product_id'), + manufacturer_id: request.get('manufacturer_id'), + category_id: request.get('category_id'), + } + + itemData.uuid = randomUUIDv7() + + // Insert the product item + await trx + .insertInto('product_items') + .values(itemData) + .execute() + + createdCount++ + } + }) + + return createdCount + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to create product items in bulk: ${error.message}`) + } + + throw error + } +} diff --git a/storage/framework/core/commerce/src/products/items/update.ts b/storage/framework/core/commerce/src/products/items/update.ts new file mode 100644 index 0000000000..c421e29fc7 --- /dev/null +++ b/storage/framework/core/commerce/src/products/items/update.ts @@ -0,0 +1,157 @@ +import type { ProductItemJsonResponse, ProductItemRequestType } from '@stacksjs/orm' +import { db } from '@stacksjs/database' +import { formatDate } from '@stacksjs/orm' +import { fetchById } from './fetch' + +/** + * Update a product item by ID + * + * @param id The ID of the product item to update + * @param request The updated product item data + * @returns The updated product item record + */ +export async function update(id: number, request: ProductItemRequestType): Promise { + // Validate the request data + await request.validate() + + // Check if product item exists + const existingItem = await fetchById(id) + + if (!existingItem) { + throw new Error(`Product item with ID ${id} not found`) + } + + // Create update data object using request fields + const updateData = { + name: request.get('name'), + size: request.get('size'), + color: request.get('color'), + price: request.get('price'), + image_url: request.get('image_url'), + is_available: request.get('is_available'), + inventory_count: request.get('inventory_count'), + sku: request.get('sku'), + custom_options: request.get('custom_options'), + product_id: request.get('product_id'), + manufacturer_id: request.get('manufacturer_id'), + category_id: request.get('category_id'), + updated_at: formatDate(new Date()), + } + + // If no fields to update, just return the existing product item + if (Object.keys(updateData).length === 0) { + return existingItem + } + + try { + // Update the product item + await db + .updateTable('product_items') + .set(updateData) + .where('id', '=', id) + .execute() + + // Fetch and return the updated product item + return await fetchById(id) + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to update product item: ${error.message}`) + } + + throw error + } +} + +/** + * Update a product item's availability status + * + * @param id The ID of the product item + * @param isAvailable The new availability status + * @returns The updated product item with the new availability status + */ +export async function updateAvailability( + id: number, + isAvailable: boolean, +): Promise { + // Check if product item exists + const productItem = await fetchById(id) + + if (!productItem) { + throw new Error(`Product item with ID ${id} not found`) + } + + try { + // Update the product item availability + await db + .updateTable('product_items') + .set({ + is_available: isAvailable, + updated_at: formatDate(new Date()), + }) + .where('id', '=', id) + .execute() + + // Fetch the updated product item + return await fetchById(id) + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to update product item availability: ${error.message}`) + } + + throw error + } +} + +/** + * Update inventory information for a product item + * + * @param id The ID of the product item + * @param inventoryCount The updated inventory count + * @returns The updated product item + */ +export async function updateInventory( + id: number, + inventoryCount?: number, +): Promise { + // Check if product item exists + const productItem = await fetchById(id) + + if (!productItem) { + throw new Error(`Product item with ID ${id} not found`) + } + + // Create update data with only provided fields + const updateData: Record = { + updated_at: formatDate(new Date()), + } + + if (inventoryCount !== undefined) { + updateData.inventory_count = inventoryCount + } + + // If no inventory fields to update, just return the existing product item + if (Object.keys(updateData).length === 1) { // Only updated_at was set + return productItem + } + + try { + // Update the product item + await db + .updateTable('product_items') + .set(updateData) + .where('id', '=', id) + .execute() + + // Fetch the updated product item + return await fetchById(id) + } + catch (error) { + if (error instanceof Error) { + throw new TypeError(`Failed to update inventory information: ${error.message}`) + } + + throw error + } +} diff --git a/storage/framework/core/commerce/src/manufacturer/destroy.ts b/storage/framework/core/commerce/src/products/manufacturer/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/manufacturer/destroy.ts rename to storage/framework/core/commerce/src/products/manufacturer/destroy.ts diff --git a/storage/framework/core/commerce/src/manufacturer/fetch.ts b/storage/framework/core/commerce/src/products/manufacturer/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/manufacturer/fetch.ts rename to storage/framework/core/commerce/src/products/manufacturer/fetch.ts diff --git a/storage/framework/core/commerce/src/manufacturer/index.ts b/storage/framework/core/commerce/src/products/manufacturer/index.ts similarity index 100% rename from storage/framework/core/commerce/src/manufacturer/index.ts rename to storage/framework/core/commerce/src/products/manufacturer/index.ts diff --git a/storage/framework/core/commerce/src/manufacturer/store.ts b/storage/framework/core/commerce/src/products/manufacturer/store.ts similarity index 100% rename from storage/framework/core/commerce/src/manufacturer/store.ts rename to storage/framework/core/commerce/src/products/manufacturer/store.ts diff --git a/storage/framework/core/commerce/src/manufacturer/update.ts b/storage/framework/core/commerce/src/products/manufacturer/update.ts similarity index 100% rename from storage/framework/core/commerce/src/manufacturer/update.ts rename to storage/framework/core/commerce/src/products/manufacturer/update.ts diff --git a/storage/framework/core/commerce/src/reviews/destroy.ts b/storage/framework/core/commerce/src/products/reviews/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/reviews/destroy.ts rename to storage/framework/core/commerce/src/products/reviews/destroy.ts diff --git a/storage/framework/core/commerce/src/reviews/fetch.ts b/storage/framework/core/commerce/src/products/reviews/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/reviews/fetch.ts rename to storage/framework/core/commerce/src/products/reviews/fetch.ts diff --git a/storage/framework/core/commerce/src/reviews/index.ts b/storage/framework/core/commerce/src/products/reviews/index.ts similarity index 100% rename from storage/framework/core/commerce/src/reviews/index.ts rename to storage/framework/core/commerce/src/products/reviews/index.ts diff --git a/storage/framework/core/commerce/src/reviews/store.ts b/storage/framework/core/commerce/src/products/reviews/store.ts similarity index 100% rename from storage/framework/core/commerce/src/reviews/store.ts rename to storage/framework/core/commerce/src/products/reviews/store.ts diff --git a/storage/framework/core/commerce/src/reviews/update.ts b/storage/framework/core/commerce/src/products/reviews/update.ts similarity index 100% rename from storage/framework/core/commerce/src/reviews/update.ts rename to storage/framework/core/commerce/src/products/reviews/update.ts diff --git a/storage/framework/core/commerce/src/unit/destroy.ts b/storage/framework/core/commerce/src/products/unit/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/unit/destroy.ts rename to storage/framework/core/commerce/src/products/unit/destroy.ts diff --git a/storage/framework/core/commerce/src/unit/index.ts b/storage/framework/core/commerce/src/products/unit/index.ts similarity index 100% rename from storage/framework/core/commerce/src/unit/index.ts rename to storage/framework/core/commerce/src/products/unit/index.ts diff --git a/storage/framework/core/commerce/src/unit/store.ts b/storage/framework/core/commerce/src/products/unit/store.ts similarity index 100% rename from storage/framework/core/commerce/src/unit/store.ts rename to storage/framework/core/commerce/src/products/unit/store.ts diff --git a/storage/framework/core/commerce/src/unit/update.ts b/storage/framework/core/commerce/src/products/unit/update.ts similarity index 100% rename from storage/framework/core/commerce/src/unit/update.ts rename to storage/framework/core/commerce/src/products/unit/update.ts diff --git a/storage/framework/core/commerce/src/variants/destroy.ts b/storage/framework/core/commerce/src/products/variants/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/variants/destroy.ts rename to storage/framework/core/commerce/src/products/variants/destroy.ts diff --git a/storage/framework/core/commerce/src/variants/index.ts b/storage/framework/core/commerce/src/products/variants/index.ts similarity index 100% rename from storage/framework/core/commerce/src/variants/index.ts rename to storage/framework/core/commerce/src/products/variants/index.ts diff --git a/storage/framework/core/commerce/src/variants/store.ts b/storage/framework/core/commerce/src/products/variants/store.ts similarity index 100% rename from storage/framework/core/commerce/src/variants/store.ts rename to storage/framework/core/commerce/src/products/variants/store.ts diff --git a/storage/framework/core/commerce/src/variants/update.ts b/storage/framework/core/commerce/src/products/variants/update.ts similarity index 100% rename from storage/framework/core/commerce/src/variants/update.ts rename to storage/framework/core/commerce/src/products/variants/update.ts From 70de826e06021108f1ba15d749bab4feb957f9bb Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Wed, 2 Apr 2025 00:37:32 +0800 Subject: [PATCH 50/78] chore: wip --- .../Commerce/LoyaltyRewardIndexAction.ts | 13 ------------- app/Actions/Commerce/LoyaltyRewardShowAction.ts | 17 ----------------- .../Commerce/LoyaltyRewardStoreAction.ts | 16 ---------------- app/Actions/Commerce/ManufacturerIndexAction.ts | 4 ++-- app/Actions/Commerce/ManufacturerShowAction.ts | 9 +++++---- .../core/commerce/src/gift-cards/index.ts | 6 ++---- 6 files changed, 9 insertions(+), 56 deletions(-) delete mode 100644 app/Actions/Commerce/LoyaltyRewardIndexAction.ts delete mode 100644 app/Actions/Commerce/LoyaltyRewardShowAction.ts delete mode 100644 app/Actions/Commerce/LoyaltyRewardStoreAction.ts diff --git a/app/Actions/Commerce/LoyaltyRewardIndexAction.ts b/app/Actions/Commerce/LoyaltyRewardIndexAction.ts deleted file mode 100644 index f325047f22..0000000000 --- a/app/Actions/Commerce/LoyaltyRewardIndexAction.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Action } from '@stacksjs/actions' -import { response } from '@stacksjs/router' - -export default new Action({ - name: 'LoyaltyReward Index', - description: 'LoyaltyReward Index ORM Action', - method: 'GET', - async handle() { - const results = LoyaltyReward.all() - - return response.json(results) - }, -}) diff --git a/app/Actions/Commerce/LoyaltyRewardShowAction.ts b/app/Actions/Commerce/LoyaltyRewardShowAction.ts deleted file mode 100644 index 0216c67414..0000000000 --- a/app/Actions/Commerce/LoyaltyRewardShowAction.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { LoyaltyRewardRequestType } from '@stacksjs/orm' -import { Action } from '@stacksjs/actions' - -import { response } from '@stacksjs/router' - -export default new Action({ - name: 'LoyaltyReward Show', - description: 'LoyaltyReward Show ORM Action', - method: 'GET', - async handle(request: LoyaltyRewardRequestType) { - const id = request.getParam('id') - - const model = await LoyaltyReward.findOrFail(Number(id)) - - return response.json(model) - }, -}) diff --git a/app/Actions/Commerce/LoyaltyRewardStoreAction.ts b/app/Actions/Commerce/LoyaltyRewardStoreAction.ts deleted file mode 100644 index af1d0d46b2..0000000000 --- a/app/Actions/Commerce/LoyaltyRewardStoreAction.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { LoyaltyRewardRequestType } from '@stacksjs/orm' -import { Action } from '@stacksjs/actions' - -import { response } from '@stacksjs/router' - -export default new Action({ - name: 'LoyaltyReward Store', - description: 'LoyaltyReward Store ORM Action', - method: 'POST', - async handle(request: LoyaltyRewardRequestType) { - await request.validate() - const model = await LoyaltyReward.create(request.all()) - - return response.json(model) - }, -}) diff --git a/app/Actions/Commerce/ManufacturerIndexAction.ts b/app/Actions/Commerce/ManufacturerIndexAction.ts index 9702b9ac74..c9d411baf9 100644 --- a/app/Actions/Commerce/ManufacturerIndexAction.ts +++ b/app/Actions/Commerce/ManufacturerIndexAction.ts @@ -1,6 +1,6 @@ import { Action } from '@stacksjs/actions' -import { manufacturer } from '@stacksjs/commerce' +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -9,7 +9,7 @@ export default new Action({ description: 'Manufacturer Index ORM Action', method: 'GET', async handle() { - const results = await manufacturer.fetchWithProductCount() + const results = await products.manufacturer.fetchWithProductCount() return response.json(results) }, diff --git a/app/Actions/Commerce/ManufacturerShowAction.ts b/app/Actions/Commerce/ManufacturerShowAction.ts index 7012f612af..7f7abed815 100644 --- a/app/Actions/Commerce/ManufacturerShowAction.ts +++ b/app/Actions/Commerce/ManufacturerShowAction.ts @@ -1,16 +1,17 @@ -import type { ManufacturerRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { response } from '@stacksjs/router' +import { products } from '@stacksjs/commerce' + +import { request, response } from '@stacksjs/router' export default new Action({ name: 'Manufacturer Show', description: 'Manufacturer Show ORM Action', method: 'GET', - async handle(request: ManufacturerRequestType) { + async handle() { const id = request.getParam('id') - const model = await Manufacturer.findOrFail(Number(id)) + const model = await products.manufacturer.fetchById(Number(id)) return response.json(model) }, diff --git a/storage/framework/core/commerce/src/gift-cards/index.ts b/storage/framework/core/commerce/src/gift-cards/index.ts index 92b679226e..38aa298ed6 100644 --- a/storage/framework/core/commerce/src/gift-cards/index.ts +++ b/storage/framework/core/commerce/src/gift-cards/index.ts @@ -1,8 +1,6 @@ export { - bulkRemove, - deactivate, - remove, - removeExpired, + bulkDestroy, + destroy, } from './destroy' export { From 62450c5d9d0901307e80d25246e34b5a2184fe90 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Wed, 2 Apr 2025 20:47:14 +0800 Subject: [PATCH 51/78] chore: wip --- .../Commerce/ManufacturerDestroyAction.ts | 21 +++++++++++++++++++ .../Commerce/ManufacturerIndexAction.ts | 2 +- .../Commerce/ManufacturerShowAction.ts | 2 +- .../Commerce/ManufacturerStoreAction.ts | 5 ++--- .../Commerce/PrintDeviceStoreAction.ts | 1 + .../Commerce/ProductItemIndexAction.ts | 3 ++- app/Actions/Commerce/ProductItemShowAction.ts | 4 +++- .../Commerce/ProductItemStoreAction.ts | 4 ++-- .../ProductManufacturerDestroyAction.ts | 19 +++++++++++++++++ .../ProductManufacturerIndexAction.ts | 3 ++- .../Commerce/ProductManufacturerShowAction.ts | 8 +++---- .../ProductManufacturerStoreAction.ts | 9 ++++---- .../ProductManufacturerUpdateAction.ts | 0 app/Actions/Commerce/ProductShowAction.ts | 17 --------------- app/Actions/Commerce/ProductStoreAction.ts | 16 -------------- bun.lock | 4 ++-- .../core/commerce/src/products/index.ts | 8 +++---- .../destroy.ts | 0 .../{manufacturer => manufacturers}/fetch.ts | 4 ++++ .../{manufacturer => manufacturers}/index.ts | 1 + .../{manufacturer => manufacturers}/store.ts | 0 .../{manufacturer => manufacturers}/update.ts | 0 .../framework/types/browser-auto-imports.d.ts | 1 - 23 files changed, 73 insertions(+), 59 deletions(-) create mode 100644 app/Actions/Commerce/ProductManufacturerDestroyAction.ts create mode 100644 app/Actions/Commerce/ProductManufacturerUpdateAction.ts delete mode 100644 app/Actions/Commerce/ProductShowAction.ts delete mode 100644 app/Actions/Commerce/ProductStoreAction.ts rename storage/framework/core/commerce/src/products/{manufacturer => manufacturers}/destroy.ts (100%) rename storage/framework/core/commerce/src/products/{manufacturer => manufacturers}/fetch.ts (95%) rename storage/framework/core/commerce/src/products/{manufacturer => manufacturers}/index.ts (96%) rename storage/framework/core/commerce/src/products/{manufacturer => manufacturers}/store.ts (100%) rename storage/framework/core/commerce/src/products/{manufacturer => manufacturers}/update.ts (100%) diff --git a/app/Actions/Commerce/ManufacturerDestroyAction.ts b/app/Actions/Commerce/ManufacturerDestroyAction.ts index e69de29bb2..89eed6387f 100644 --- a/app/Actions/Commerce/ManufacturerDestroyAction.ts +++ b/app/Actions/Commerce/ManufacturerDestroyAction.ts @@ -0,0 +1,21 @@ +import type { ManufacturerRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { products } from '@stacksjs/commerce' + +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'Manufacturer Destroy', + description: 'Manufacturer Destroy ORM Action', + method: 'DELETE', + async handle(request: ManufacturerRequestType) { + const id = request.getParam('id') + + await products.manufacturers.destroy(Number(id)) + + return response.json({ + message: 'Manufacturer deleted successfully', + }) + }, +}) diff --git a/app/Actions/Commerce/ManufacturerIndexAction.ts b/app/Actions/Commerce/ManufacturerIndexAction.ts index c9d411baf9..8a80868dfc 100644 --- a/app/Actions/Commerce/ManufacturerIndexAction.ts +++ b/app/Actions/Commerce/ManufacturerIndexAction.ts @@ -9,7 +9,7 @@ export default new Action({ description: 'Manufacturer Index ORM Action', method: 'GET', async handle() { - const results = await products.manufacturer.fetchWithProductCount() + const results = await products.manufacturers.fetchWithProductCount() return response.json(results) }, diff --git a/app/Actions/Commerce/ManufacturerShowAction.ts b/app/Actions/Commerce/ManufacturerShowAction.ts index 7f7abed815..3d95c0af5f 100644 --- a/app/Actions/Commerce/ManufacturerShowAction.ts +++ b/app/Actions/Commerce/ManufacturerShowAction.ts @@ -11,7 +11,7 @@ export default new Action({ async handle() { const id = request.getParam('id') - const model = await products.manufacturer.fetchById(Number(id)) + const model = await products.manufacturers.fetchById(Number(id)) return response.json(model) }, diff --git a/app/Actions/Commerce/ManufacturerStoreAction.ts b/app/Actions/Commerce/ManufacturerStoreAction.ts index a82f238d6e..245b634b6b 100644 --- a/app/Actions/Commerce/ManufacturerStoreAction.ts +++ b/app/Actions/Commerce/ManufacturerStoreAction.ts @@ -1,6 +1,6 @@ import type { ManufacturerRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -8,8 +8,7 @@ export default new Action({ description: 'Manufacturer Store ORM Action', method: 'POST', async handle(request: ManufacturerRequestType) { - await request.validate() - const model = await Manufacturer.create(request.all()) + const model = await products.manufacturers.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/PrintDeviceStoreAction.ts b/app/Actions/Commerce/PrintDeviceStoreAction.ts index 2dcc91cb7c..a156fc972e 100644 --- a/app/Actions/Commerce/PrintDeviceStoreAction.ts +++ b/app/Actions/Commerce/PrintDeviceStoreAction.ts @@ -10,6 +10,7 @@ export default new Action({ method: 'POST', async handle(request: PrintDeviceRequestType) { await request.validate() + const model = await devices.store(request) return response.json(model) diff --git a/app/Actions/Commerce/ProductItemIndexAction.ts b/app/Actions/Commerce/ProductItemIndexAction.ts index 1f548646df..ebc37155e7 100644 --- a/app/Actions/Commerce/ProductItemIndexAction.ts +++ b/app/Actions/Commerce/ProductItemIndexAction.ts @@ -1,4 +1,5 @@ import { Action } from '@stacksjs/actions' +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -6,7 +7,7 @@ export default new Action({ description: 'ProductItem Index ORM Action', method: 'GET', async handle() { - const results = ProductItem.all() + const results = await products.items.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/ProductItemShowAction.ts b/app/Actions/Commerce/ProductItemShowAction.ts index 4d2164a65e..aafe65c988 100644 --- a/app/Actions/Commerce/ProductItemShowAction.ts +++ b/app/Actions/Commerce/ProductItemShowAction.ts @@ -1,16 +1,18 @@ import type { ProductItemRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ name: 'ProductItem Show', description: 'ProductItem Show ORM Action', method: 'GET', + async handle(request: ProductItemRequestType) { const id = request.getParam('id') - const model = await ProductItem.findOrFail(Number(id)) + const model = await products.items.fetchById(Number(id)) return response.json(model) }, diff --git a/app/Actions/Commerce/ProductItemStoreAction.ts b/app/Actions/Commerce/ProductItemStoreAction.ts index ce04859fcf..3799975964 100644 --- a/app/Actions/Commerce/ProductItemStoreAction.ts +++ b/app/Actions/Commerce/ProductItemStoreAction.ts @@ -1,6 +1,7 @@ import type { ProductItemRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -8,8 +9,7 @@ export default new Action({ description: 'ProductItem Store ORM Action', method: 'POST', async handle(request: ProductItemRequestType) { - await request.validate() - const model = await ProductItem.create(request.all()) + const model = await products.items.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/ProductManufacturerDestroyAction.ts b/app/Actions/Commerce/ProductManufacturerDestroyAction.ts new file mode 100644 index 0000000000..1101d12045 --- /dev/null +++ b/app/Actions/Commerce/ProductManufacturerDestroyAction.ts @@ -0,0 +1,19 @@ +import type { ManufacturerRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { products } from '@stacksjs/commerce' + +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'ProductManufacturer Destroy', + description: 'ProductManufacturer Destroy ORM Action', + method: 'DELETE', + async handle(request: ManufacturerRequestType) { + const id = request.getParam('id') + + await products.manufacturerss.destroy(Number(id)) + + return response.json({ message: 'Manufacturer deleted successfully' }) + }, +}) diff --git a/app/Actions/Commerce/ProductManufacturerIndexAction.ts b/app/Actions/Commerce/ProductManufacturerIndexAction.ts index 6f27fc9b36..0201fc01be 100644 --- a/app/Actions/Commerce/ProductManufacturerIndexAction.ts +++ b/app/Actions/Commerce/ProductManufacturerIndexAction.ts @@ -1,4 +1,5 @@ import { Action } from '@stacksjs/actions' +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -6,7 +7,7 @@ export default new Action({ description: 'ProductManufacturer Index ORM Action', method: 'GET', async handle() { - const results = ProductManufacturer.all() + const results = await products.manufacturerss.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/ProductManufacturerShowAction.ts b/app/Actions/Commerce/ProductManufacturerShowAction.ts index d9872591c3..6cc3b8168b 100644 --- a/app/Actions/Commerce/ProductManufacturerShowAction.ts +++ b/app/Actions/Commerce/ProductManufacturerShowAction.ts @@ -1,16 +1,16 @@ -import type { ProductManufacturerRequestType } from '@stacksjs/orm' +import type { ManufacturerRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ name: 'ProductManufacturer Show', description: 'ProductManufacturer Show ORM Action', method: 'GET', - async handle(request: ProductManufacturerRequestType) { + async handle(request: ManufacturerRequestType) { const id = request.getParam('id') - const model = await ProductManufacturer.findOrFail(Number(id)) + const model = await products.manufacturerss.fetchById(Number(id)) return response.json(model) }, diff --git a/app/Actions/Commerce/ProductManufacturerStoreAction.ts b/app/Actions/Commerce/ProductManufacturerStoreAction.ts index 9743e39673..edf9c55202 100644 --- a/app/Actions/Commerce/ProductManufacturerStoreAction.ts +++ b/app/Actions/Commerce/ProductManufacturerStoreAction.ts @@ -1,15 +1,14 @@ -import type { ProductManufacturerRequestType } from '@stacksjs/orm' +import type { ManufacturerRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ name: 'ProductManufacturer Store', description: 'ProductManufacturer Store ORM Action', method: 'POST', - async handle(request: ProductManufacturerRequestType) { - await request.validate() - const model = await ProductManufacturer.create(request.all()) + async handle(request: ManufacturerRequestType) { + const model = await products.manufacturerss.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/ProductManufacturerUpdateAction.ts b/app/Actions/Commerce/ProductManufacturerUpdateAction.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/Actions/Commerce/ProductShowAction.ts b/app/Actions/Commerce/ProductShowAction.ts deleted file mode 100644 index 0187fc1625..0000000000 --- a/app/Actions/Commerce/ProductShowAction.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { ProductRequestType } from '@stacksjs/orm' -import { Action } from '@stacksjs/actions' - -import { response } from '@stacksjs/router' - -export default new Action({ - name: 'Product Show', - description: 'Product Show ORM Action', - method: 'GET', - async handle(request: ProductRequestType) { - const id = request.getParam('id') - - const model = await Product.findOrFail(Number(id)) - - return response.json(model) - }, -}) diff --git a/app/Actions/Commerce/ProductStoreAction.ts b/app/Actions/Commerce/ProductStoreAction.ts deleted file mode 100644 index 647cbfe4d7..0000000000 --- a/app/Actions/Commerce/ProductStoreAction.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { ProductRequestType } from '@stacksjs/orm' -import { Action } from '@stacksjs/actions' - -import { response } from '@stacksjs/router' - -export default new Action({ - name: 'Product Store', - description: 'Product Store ORM Action', - method: 'POST', - async handle(request: ProductRequestType) { - await request.validate() - const model = await Product.create(request.all()) - - return response.json(model) - }, -}) diff --git a/bun.lock b/bun.lock index 719277cffd..57b6bb8689 100644 --- a/bun.lock +++ b/bun.lock @@ -664,14 +664,14 @@ }, "storage/framework/core/components/stepper": { "name": "@stacksjs/stepper", - "version": "0.70.22", + "version": "0.69.5", "dependencies": { "@stacksjs/ui": "workspace:*", "highlight.js": "^11.11.1", }, "devDependencies": { "@iconify-json/hugeicons": "^1.2.4", - "@microsoft/api-extractor": "^7.52.2", + "@microsoft/api-extractor": "^7.52.1", "@stacksjs/alias": "workspace:*", "@stacksjs/development": "workspace:*", "@stacksjs/dialog": "workspace:*", diff --git a/storage/framework/core/commerce/src/products/index.ts b/storage/framework/core/commerce/src/products/index.ts index 5156484b49..697e978599 100644 --- a/storage/framework/core/commerce/src/products/index.ts +++ b/storage/framework/core/commerce/src/products/index.ts @@ -1,6 +1,6 @@ import * as categories from './categories' import * as items from './items' -import * as manufacturer from './manufacturer' +import * as manufacturers from './manufacturers' import * as reviews from './reviews' import * as unit from './unit' import * as variants from './variants' @@ -8,7 +8,7 @@ import * as variants from './variants' export { categories, items, - manufacturer, + manufacturers, reviews, unit, variants, @@ -17,7 +17,7 @@ export { interface ProductsNamespace { categories: typeof categories items: typeof items - manufacturer: typeof manufacturer + manufacturers: typeof manufacturers reviews: typeof reviews unit: typeof unit variants: typeof variants @@ -26,7 +26,7 @@ interface ProductsNamespace { const products: ProductsNamespace = { categories, items, - manufacturer, + manufacturers, reviews, unit, variants, diff --git a/storage/framework/core/commerce/src/products/manufacturer/destroy.ts b/storage/framework/core/commerce/src/products/manufacturers/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/products/manufacturer/destroy.ts rename to storage/framework/core/commerce/src/products/manufacturers/destroy.ts diff --git a/storage/framework/core/commerce/src/products/manufacturer/fetch.ts b/storage/framework/core/commerce/src/products/manufacturers/fetch.ts similarity index 95% rename from storage/framework/core/commerce/src/products/manufacturer/fetch.ts rename to storage/framework/core/commerce/src/products/manufacturers/fetch.ts index 936ac67bf8..2637e1d3a3 100644 --- a/storage/framework/core/commerce/src/products/manufacturer/fetch.ts +++ b/storage/framework/core/commerce/src/products/manufacturers/fetch.ts @@ -2,6 +2,10 @@ import type { ManufacturerJsonResponse } from '@stacksjs/orm' import type { FetchManufacturersOptions, ManufacturerResponse } from '../types' import { db } from '@stacksjs/database' +export function fetchAll(): Promise { + return db.selectFrom('manufacturers').selectAll().execute() +} + /** * Fetch a product manufacturer by ID */ diff --git a/storage/framework/core/commerce/src/products/manufacturer/index.ts b/storage/framework/core/commerce/src/products/manufacturers/index.ts similarity index 96% rename from storage/framework/core/commerce/src/products/manufacturer/index.ts rename to storage/framework/core/commerce/src/products/manufacturers/index.ts index 377d3602bb..760968cfc6 100644 --- a/storage/framework/core/commerce/src/products/manufacturer/index.ts +++ b/storage/framework/core/commerce/src/products/manufacturers/index.ts @@ -4,6 +4,7 @@ export { } from './destroy' export { + fetchAll, fetchByCountry, fetchById, fetchByUuid, diff --git a/storage/framework/core/commerce/src/products/manufacturer/store.ts b/storage/framework/core/commerce/src/products/manufacturers/store.ts similarity index 100% rename from storage/framework/core/commerce/src/products/manufacturer/store.ts rename to storage/framework/core/commerce/src/products/manufacturers/store.ts diff --git a/storage/framework/core/commerce/src/products/manufacturer/update.ts b/storage/framework/core/commerce/src/products/manufacturers/update.ts similarity index 100% rename from storage/framework/core/commerce/src/products/manufacturer/update.ts rename to storage/framework/core/commerce/src/products/manufacturers/update.ts diff --git a/storage/framework/types/browser-auto-imports.d.ts b/storage/framework/types/browser-auto-imports.d.ts index 043b3a8d66..5d3f6d0a2e 100644 --- a/storage/framework/types/browser-auto-imports.d.ts +++ b/storage/framework/types/browser-auto-imports.d.ts @@ -536,7 +536,6 @@ declare module 'vue' { readonly extendRef: UnwrapRef readonly format: UnwrapRef readonly formatTimeAgo: UnwrapRef - readonly getActiveHead: UnwrapRef readonly getActivePinia: UnwrapRef readonly getCurrentInstance: UnwrapRef readonly getCurrentScope: UnwrapRef From 3ee5961a523c4e35041d5d05b5cf4b5c412c59d5 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Wed, 2 Apr 2025 21:14:11 +0800 Subject: [PATCH 52/78] chore: wip --- app/Actions/Commerce/CustomerUpdateAction.ts | 2 -- .../ProductManufacturerDestroyAction.ts | 2 +- .../ProductManufacturerIndexAction.ts | 2 +- .../Commerce/ProductManufacturerShowAction.ts | 2 +- .../ProductManufacturerStoreAction.ts | 2 +- .../ProductManufacturerUpdateAction.ts | 19 ++++++++++++++++++ .../Commerce/ProductUnitDestroyAction.ts | 19 ++++++++++++++++++ .../Commerce/ProductUnitIndexAction.ts | 3 ++- app/Actions/Commerce/ProductUnitShowAction.ts | 4 +++- .../Commerce/ProductUnitStoreAction.ts | 3 ++- .../Commerce/ProductVariantDestroyAction.ts | 10 ++++++---- .../Commerce/ProductVariantIndexAction.ts | 3 ++- .../Commerce/ProductVariantShowAction.ts | 3 ++- .../Commerce/ProductVariantStoreAction.ts | 4 ++-- .../Commerce/ProductVariantUpdateAction.ts | 5 ++--- app/Actions/Commerce/ReceiptDestroyAction.ts | 9 ++++----- app/Actions/Commerce/ReceiptIndexAction.ts | 3 ++- app/Actions/Commerce/ReceiptShowAction.ts | 5 +++-- app/Actions/Commerce/ReceiptStoreAction.ts | 5 ++--- app/Actions/Commerce/ReceiptUpdateAction.ts | 5 ++--- storage/framework/core/commerce/src/index.ts | 5 +++++ .../core/commerce/src/products/index.ts | 8 ++++---- .../src/products/{unit => units}/destroy.ts | 0 .../core/commerce/src/products/units/fetch.ts | 20 +++++++++++++++++++ .../src/products/{unit => units}/index.ts | 3 +++ .../src/products/{unit => units}/store.ts | 2 +- .../src/products/{unit => units}/update.ts | 0 .../commerce/src/products/variants/fetch.ts | 20 +++++++++++++++++++ .../commerce/src/products/variants/index.ts | 5 +++++ 29 files changed, 134 insertions(+), 39 deletions(-) create mode 100644 app/Actions/Commerce/ProductUnitDestroyAction.ts rename storage/framework/core/commerce/src/products/{unit => units}/destroy.ts (100%) create mode 100644 storage/framework/core/commerce/src/products/units/fetch.ts rename storage/framework/core/commerce/src/products/{unit => units}/index.ts (82%) rename storage/framework/core/commerce/src/products/{unit => units}/store.ts (98%) rename storage/framework/core/commerce/src/products/{unit => units}/update.ts (100%) create mode 100644 storage/framework/core/commerce/src/products/variants/fetch.ts diff --git a/app/Actions/Commerce/CustomerUpdateAction.ts b/app/Actions/Commerce/CustomerUpdateAction.ts index 10e9734a6f..4564cde950 100644 --- a/app/Actions/Commerce/CustomerUpdateAction.ts +++ b/app/Actions/Commerce/CustomerUpdateAction.ts @@ -10,8 +10,6 @@ export default new Action({ description: 'Customer Update ORM Action', method: 'PATCH', async handle(request: CustomerRequestType) { - await request.validate() - const id = request.getParam('id') const result = await customers.update(Number(id), request) diff --git a/app/Actions/Commerce/ProductManufacturerDestroyAction.ts b/app/Actions/Commerce/ProductManufacturerDestroyAction.ts index 1101d12045..9bd222bee4 100644 --- a/app/Actions/Commerce/ProductManufacturerDestroyAction.ts +++ b/app/Actions/Commerce/ProductManufacturerDestroyAction.ts @@ -12,7 +12,7 @@ export default new Action({ async handle(request: ManufacturerRequestType) { const id = request.getParam('id') - await products.manufacturerss.destroy(Number(id)) + await products.manufacturers.destroy(Number(id)) return response.json({ message: 'Manufacturer deleted successfully' }) }, diff --git a/app/Actions/Commerce/ProductManufacturerIndexAction.ts b/app/Actions/Commerce/ProductManufacturerIndexAction.ts index 0201fc01be..4bccba16e8 100644 --- a/app/Actions/Commerce/ProductManufacturerIndexAction.ts +++ b/app/Actions/Commerce/ProductManufacturerIndexAction.ts @@ -7,7 +7,7 @@ export default new Action({ description: 'ProductManufacturer Index ORM Action', method: 'GET', async handle() { - const results = await products.manufacturerss.fetchAll() + const results = await products.manufacturers.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/ProductManufacturerShowAction.ts b/app/Actions/Commerce/ProductManufacturerShowAction.ts index 6cc3b8168b..61d3c51b34 100644 --- a/app/Actions/Commerce/ProductManufacturerShowAction.ts +++ b/app/Actions/Commerce/ProductManufacturerShowAction.ts @@ -10,7 +10,7 @@ export default new Action({ async handle(request: ManufacturerRequestType) { const id = request.getParam('id') - const model = await products.manufacturerss.fetchById(Number(id)) + const model = await products.manufacturers.fetchById(Number(id)) return response.json(model) }, diff --git a/app/Actions/Commerce/ProductManufacturerStoreAction.ts b/app/Actions/Commerce/ProductManufacturerStoreAction.ts index edf9c55202..83bc713540 100644 --- a/app/Actions/Commerce/ProductManufacturerStoreAction.ts +++ b/app/Actions/Commerce/ProductManufacturerStoreAction.ts @@ -8,7 +8,7 @@ export default new Action({ description: 'ProductManufacturer Store ORM Action', method: 'POST', async handle(request: ManufacturerRequestType) { - const model = await products.manufacturerss.store(request) + const model = await products.manufacturers.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/ProductManufacturerUpdateAction.ts b/app/Actions/Commerce/ProductManufacturerUpdateAction.ts index e69de29bb2..197c72bc8b 100644 --- a/app/Actions/Commerce/ProductManufacturerUpdateAction.ts +++ b/app/Actions/Commerce/ProductManufacturerUpdateAction.ts @@ -0,0 +1,19 @@ +import type { ManufacturerRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { products } from '@stacksjs/commerce' + +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'ProductManufacturer Update', + description: 'ProductManufacturer Update ORM Action', + method: 'PATCH', + async handle(request: ManufacturerRequestType) { + const id = request.getParam('id') + + const result = await products.manufacturers.update(Number(id), request) + + return response.json(result) + }, +}) diff --git a/app/Actions/Commerce/ProductUnitDestroyAction.ts b/app/Actions/Commerce/ProductUnitDestroyAction.ts new file mode 100644 index 0000000000..56a4b84daf --- /dev/null +++ b/app/Actions/Commerce/ProductUnitDestroyAction.ts @@ -0,0 +1,19 @@ +import type { ProductUnitRequestType } from '@stacksjs/orm' +import { Action } from '@stacksjs/actions' + +import { products } from '@stacksjs/commerce' + +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'ProductUnit Destroy', + description: 'ProductUnit Destroy ORM Action', + method: 'DELETE', + async handle(request: ProductUnitRequestType) { + const id = request.getParam('id') + + await products.units.destroy(Number(id)) + + return response.json({ message: 'Unit deleted successfully' }) + }, +}) diff --git a/app/Actions/Commerce/ProductUnitIndexAction.ts b/app/Actions/Commerce/ProductUnitIndexAction.ts index 34581ac9ef..fbe35041f8 100644 --- a/app/Actions/Commerce/ProductUnitIndexAction.ts +++ b/app/Actions/Commerce/ProductUnitIndexAction.ts @@ -1,4 +1,5 @@ import { Action } from '@stacksjs/actions' +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -6,7 +7,7 @@ export default new Action({ description: 'ProductUnit Index ORM Action', method: 'GET', async handle() { - const results = ProductUnit.all() + const results = await products.units.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/ProductUnitShowAction.ts b/app/Actions/Commerce/ProductUnitShowAction.ts index 8a0381b070..95a93d9422 100644 --- a/app/Actions/Commerce/ProductUnitShowAction.ts +++ b/app/Actions/Commerce/ProductUnitShowAction.ts @@ -1,6 +1,8 @@ import type { ProductUnitRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { products } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -10,7 +12,7 @@ export default new Action({ async handle(request: ProductUnitRequestType) { const id = request.getParam('id') - const model = await ProductUnit.findOrFail(Number(id)) + const model = await products.units.fetchById(Number(id)) return response.json(model) }, diff --git a/app/Actions/Commerce/ProductUnitStoreAction.ts b/app/Actions/Commerce/ProductUnitStoreAction.ts index 6d980f6c75..56cde9cb8f 100644 --- a/app/Actions/Commerce/ProductUnitStoreAction.ts +++ b/app/Actions/Commerce/ProductUnitStoreAction.ts @@ -1,6 +1,7 @@ import type { ProductUnitRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -9,7 +10,7 @@ export default new Action({ method: 'POST', async handle(request: ProductUnitRequestType) { await request.validate() - const model = await ProductUnit.create(request.all()) + const model = await products.units.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/ProductVariantDestroyAction.ts b/app/Actions/Commerce/ProductVariantDestroyAction.ts index 956d3ccdf7..8d671114f8 100644 --- a/app/Actions/Commerce/ProductVariantDestroyAction.ts +++ b/app/Actions/Commerce/ProductVariantDestroyAction.ts @@ -1,6 +1,10 @@ import type { ProductVariantRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { products } from '@stacksjs/commerce' + +import { response } from '@stacksjs/router' + export default new Action({ name: 'ProductVariant Destroy', description: 'ProductVariant Destroy ORM Action', @@ -8,10 +12,8 @@ export default new Action({ async handle(request: ProductVariantRequestType) { const id = request.getParam('id') - const model = await ProductVariant.findOrFail(Number(id)) - - model.delete() + await products.variants.destroy(Number(id)) - return 'Model deleted!' + return response.json({ message: 'Variant deleted successfully' }) }, }) diff --git a/app/Actions/Commerce/ProductVariantIndexAction.ts b/app/Actions/Commerce/ProductVariantIndexAction.ts index a86a9357ad..05c6e6bd4c 100644 --- a/app/Actions/Commerce/ProductVariantIndexAction.ts +++ b/app/Actions/Commerce/ProductVariantIndexAction.ts @@ -1,4 +1,5 @@ import { Action } from '@stacksjs/actions' +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -6,7 +7,7 @@ export default new Action({ description: 'ProductVariant Index ORM Action', method: 'GET', async handle() { - const results = ProductVariant.all() + const results = await products.variants.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/ProductVariantShowAction.ts b/app/Actions/Commerce/ProductVariantShowAction.ts index 5c93fc446e..fb1d51ff16 100644 --- a/app/Actions/Commerce/ProductVariantShowAction.ts +++ b/app/Actions/Commerce/ProductVariantShowAction.ts @@ -1,6 +1,7 @@ import type { ProductVariantRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -10,7 +11,7 @@ export default new Action({ async handle(request: ProductVariantRequestType) { const id = request.getParam('id') - const model = await ProductVariant.findOrFail(Number(id)) + const model = await products.variants.fetchById(Number(id)) return response.json(model) }, diff --git a/app/Actions/Commerce/ProductVariantStoreAction.ts b/app/Actions/Commerce/ProductVariantStoreAction.ts index 132f632c29..feb3e76ca0 100644 --- a/app/Actions/Commerce/ProductVariantStoreAction.ts +++ b/app/Actions/Commerce/ProductVariantStoreAction.ts @@ -1,6 +1,6 @@ import type { ProductVariantRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -9,7 +9,7 @@ export default new Action({ method: 'POST', async handle(request: ProductVariantRequestType) { await request.validate() - const model = await ProductVariant.create(request.all()) + const model = await products.variants.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/ProductVariantUpdateAction.ts b/app/Actions/Commerce/ProductVariantUpdateAction.ts index 872847efe0..7b86e95c2c 100644 --- a/app/Actions/Commerce/ProductVariantUpdateAction.ts +++ b/app/Actions/Commerce/ProductVariantUpdateAction.ts @@ -1,6 +1,6 @@ import type { ProductVariantRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -11,9 +11,8 @@ export default new Action({ await request.validate() const id = request.getParam('id') - const model = await ProductVariant.findOrFail(Number(id)) - const result = model.update(request.all()) + const result = await products.variants.update(Number(id), request) return response.json(result) }, diff --git a/app/Actions/Commerce/ReceiptDestroyAction.ts b/app/Actions/Commerce/ReceiptDestroyAction.ts index 0fe0ef08b2..53f9ede9fc 100644 --- a/app/Actions/Commerce/ReceiptDestroyAction.ts +++ b/app/Actions/Commerce/ReceiptDestroyAction.ts @@ -1,7 +1,8 @@ import type { ReceiptRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { Receipt } from '@stacksjs/orm' +import { receipts } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -11,10 +12,8 @@ export default new Action({ async handle(request: ReceiptRequestType) { const id = request.getParam('id') - const model = await Receipt.findOrFail(Number(id)) - - model.delete() + await receipts.destroy(Number(id)) - return response.json({ message: 'Model deleted!' }) + return response.json({ message: 'Receipt deleted successfully' }) }, }) diff --git a/app/Actions/Commerce/ReceiptIndexAction.ts b/app/Actions/Commerce/ReceiptIndexAction.ts index 5c642c0d47..fccdfe263f 100644 --- a/app/Actions/Commerce/ReceiptIndexAction.ts +++ b/app/Actions/Commerce/ReceiptIndexAction.ts @@ -1,4 +1,5 @@ import { Action } from '@stacksjs/actions' +import { receipts } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -6,7 +7,7 @@ export default new Action({ description: 'Receipt Index ORM Action', method: 'GET', async handle() { - const results = Receipt.all() + const results = await receipts.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/ReceiptShowAction.ts b/app/Actions/Commerce/ReceiptShowAction.ts index 0d31f8a10c..c87c444818 100644 --- a/app/Actions/Commerce/ReceiptShowAction.ts +++ b/app/Actions/Commerce/ReceiptShowAction.ts @@ -1,7 +1,8 @@ import type { ReceiptRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { Receipt } from '@stacksjs/orm' +import { receipts } from '@stacksjs/commerce' + import { response } from '@stacksjs/router' export default new Action({ @@ -11,7 +12,7 @@ export default new Action({ async handle(request: ReceiptRequestType) { const id = request.getParam('id') - const model = await Receipt.findOrFail(Number(id)) + const model = await receipts.fetchById(Number(id)) return response.json(model) }, diff --git a/app/Actions/Commerce/ReceiptStoreAction.ts b/app/Actions/Commerce/ReceiptStoreAction.ts index 6b183051e4..6546c51308 100644 --- a/app/Actions/Commerce/ReceiptStoreAction.ts +++ b/app/Actions/Commerce/ReceiptStoreAction.ts @@ -1,7 +1,7 @@ import type { ReceiptRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { Receipt } from '@stacksjs/orm' +import { receipts } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -9,8 +9,7 @@ export default new Action({ description: 'Receipt Store ORM Action', method: 'POST', async handle(request: ReceiptRequestType) { - await request.validate() - const model = await Receipt.create(request.all()) + const model = await receipts.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/ReceiptUpdateAction.ts b/app/Actions/Commerce/ReceiptUpdateAction.ts index 7e15edfa1f..5adf5a3cbc 100644 --- a/app/Actions/Commerce/ReceiptUpdateAction.ts +++ b/app/Actions/Commerce/ReceiptUpdateAction.ts @@ -1,7 +1,7 @@ import type { ReceiptRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { Receipt } from '@stacksjs/orm' +import { receipts } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -12,9 +12,8 @@ export default new Action({ await request.validate() const id = request.getParam('id') - const model = await Receipt.findOrFail(Number(id)) - const result = model.update(request.all()) + const result = await receipts.update(Number(id), request) return response.json(result) }, diff --git a/storage/framework/core/commerce/src/index.ts b/storage/framework/core/commerce/src/index.ts index 5e22eef444..ea975508aa 100644 --- a/storage/framework/core/commerce/src/index.ts +++ b/storage/framework/core/commerce/src/index.ts @@ -10,6 +10,7 @@ import * as orders from './orders' import * as payments from './payments' import * as products from './products' import * as rates from './rates' +import * as receipts from './receipts' import * as restaurant from './restaurant' import * as deliveryRoutes from './routes' import * as shipping from './shipping' @@ -34,6 +35,7 @@ type TaxModule = typeof tax type DeliveryRoutesModule = typeof deliveryRoutes type WaitlistModule = typeof waitlist type DevicesModule = typeof devices +type ReceiptsModule = typeof receipts export interface EcommerceNamespace { coupons: CouponsModule @@ -53,6 +55,7 @@ export interface EcommerceNamespace { tax: TaxModule waitlist: WaitlistModule devices: DevicesModule + receipts: ReceiptsModule } export const ecommerce: EcommerceNamespace = { @@ -73,6 +76,7 @@ export const ecommerce: EcommerceNamespace = { devices, tax, waitlist, + receipts, } export default ecommerce @@ -90,6 +94,7 @@ export { payments, products, rates, + receipts, restaurant, shipping, tax, diff --git a/storage/framework/core/commerce/src/products/index.ts b/storage/framework/core/commerce/src/products/index.ts index 697e978599..0df9215ecb 100644 --- a/storage/framework/core/commerce/src/products/index.ts +++ b/storage/framework/core/commerce/src/products/index.ts @@ -2,7 +2,7 @@ import * as categories from './categories' import * as items from './items' import * as manufacturers from './manufacturers' import * as reviews from './reviews' -import * as unit from './unit' +import * as units from './units' import * as variants from './variants' export { @@ -10,7 +10,7 @@ export { items, manufacturers, reviews, - unit, + units, variants, } @@ -19,7 +19,7 @@ interface ProductsNamespace { items: typeof items manufacturers: typeof manufacturers reviews: typeof reviews - unit: typeof unit + units: typeof units variants: typeof variants } @@ -28,7 +28,7 @@ const products: ProductsNamespace = { items, manufacturers, reviews, - unit, + units, variants, } diff --git a/storage/framework/core/commerce/src/products/unit/destroy.ts b/storage/framework/core/commerce/src/products/units/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/products/unit/destroy.ts rename to storage/framework/core/commerce/src/products/units/destroy.ts diff --git a/storage/framework/core/commerce/src/products/units/fetch.ts b/storage/framework/core/commerce/src/products/units/fetch.ts new file mode 100644 index 0000000000..d4d3f50017 --- /dev/null +++ b/storage/framework/core/commerce/src/products/units/fetch.ts @@ -0,0 +1,20 @@ +import type { ProductUnitJsonResponse } from '@stacksjs/orm' +import { db } from '@stacksjs/database' + +/** + * Fetch a product unit by ID + */ +export async function fetchById(id: number): Promise { + return await db + .selectFrom('product_units') + .where('id', '=', id) + .selectAll() + .executeTakeFirst() +} + +/** + * Fetch all product units + */ +export async function fetchAll(): Promise { + return await db.selectFrom('product_units').selectAll().execute() +} diff --git a/storage/framework/core/commerce/src/products/unit/index.ts b/storage/framework/core/commerce/src/products/units/index.ts similarity index 82% rename from storage/framework/core/commerce/src/products/unit/index.ts rename to storage/framework/core/commerce/src/products/units/index.ts index 8473ad406d..7bbeee9639 100644 --- a/storage/framework/core/commerce/src/products/unit/index.ts +++ b/storage/framework/core/commerce/src/products/units/index.ts @@ -3,6 +3,9 @@ // Destroy functions export { bulkDestroy, destroy } from './destroy' +// Fetch functions +export { fetchAll, fetchById } from './fetch' + // Store functions export { bulkStore, formatUnitOptions, getDefaultUnit, store } from './store' diff --git a/storage/framework/core/commerce/src/products/unit/store.ts b/storage/framework/core/commerce/src/products/units/store.ts similarity index 98% rename from storage/framework/core/commerce/src/products/unit/store.ts rename to storage/framework/core/commerce/src/products/units/store.ts index 59ecb21f09..0d319c2029 100644 --- a/storage/framework/core/commerce/src/products/unit/store.ts +++ b/storage/framework/core/commerce/src/products/units/store.ts @@ -1,6 +1,6 @@ // Import dependencies import type { ProductUnitRequestType } from '@stacksjs/orm' -import type { NewProductUnit, ProductUnitJsonResponse } from '../../../../orm/src/models/ProductUnit' +import type { NewProductUnit, ProductUnitJsonResponse } from '@stacksjs/orm' import { randomUUIDv7 } from 'bun' import { db } from '@stacksjs/database' diff --git a/storage/framework/core/commerce/src/products/unit/update.ts b/storage/framework/core/commerce/src/products/units/update.ts similarity index 100% rename from storage/framework/core/commerce/src/products/unit/update.ts rename to storage/framework/core/commerce/src/products/units/update.ts diff --git a/storage/framework/core/commerce/src/products/variants/fetch.ts b/storage/framework/core/commerce/src/products/variants/fetch.ts new file mode 100644 index 0000000000..08db540aaa --- /dev/null +++ b/storage/framework/core/commerce/src/products/variants/fetch.ts @@ -0,0 +1,20 @@ +import type { ProductVariantJsonResponse } from '@stacksjs/orm' +import { db } from '@stacksjs/database' + +/** + * Fetch a product variant by ID + */ +export async function fetchById(id: number): Promise { + return await db + .selectFrom('product_variants') + .where('id', '=', id) + .selectAll() + .executeTakeFirst() +} + +/** + * Fetch all product variants + */ +export async function fetchAll(): Promise { + return await db.selectFrom('product_variants').selectAll().execute() +} diff --git a/storage/framework/core/commerce/src/products/variants/index.ts b/storage/framework/core/commerce/src/products/variants/index.ts index a36cd0ee44..b1a7e66448 100644 --- a/storage/framework/core/commerce/src/products/variants/index.ts +++ b/storage/framework/core/commerce/src/products/variants/index.ts @@ -3,6 +3,11 @@ export { destroy, } from './destroy' +export { + fetchAll, + fetchById, +} from './fetch' + export { bulkStore, formatVariantOptions, From 280d101f3267a2067869a017239f5925733e6810 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Wed, 2 Apr 2025 21:34:17 +0800 Subject: [PATCH 53/78] chore: wip --- app/Actions/Commerce/CouponDestroyAction.ts | 4 +- app/Actions/Commerce/CouponShowAction.ts | 4 +- app/Actions/Commerce/CouponStoreAction.ts | 2 - app/Actions/Commerce/CouponUpdateAction.ts | 5 +- app/Actions/Commerce/CustomerDestroyAction.ts | 4 +- app/Actions/Commerce/CustomerShowAction.ts | 4 +- app/Actions/Commerce/CustomerStoreAction.ts | 2 - app/Actions/Commerce/CustomerUpdateAction.ts | 4 +- .../Commerce/DeliveryRouteDestroyAction.ts | 4 +- .../Commerce/DeliveryRouteShowAction.ts | 4 +- .../Commerce/DeliveryRouteStoreAction.ts | 2 - .../Commerce/DeliveryRouteUpdateAction.ts | 5 +- .../Commerce/DigitalDeliveryDestroyAction.ts | 4 +- .../Commerce/DigitalDeliveryShowAction.ts | 4 +- .../Commerce/DigitalDeliveryUpdateAction.ts | 4 +- app/Actions/Commerce/DriverDestroyAction.ts | 4 +- app/Actions/Commerce/DriverShowAction.ts | 4 +- app/Actions/Commerce/DriverUpdateAction.ts | 4 +- app/Actions/Commerce/GiftCardDestroyAction.ts | 4 +- app/Actions/Commerce/GiftCardShowAction.ts | 4 +- app/Actions/Commerce/GiftCardUpdateAction.ts | 4 +- .../Commerce/LicenseKeyDestroyAction.ts | 4 +- app/Actions/Commerce/LicenseKeyShowAction.ts | 4 +- .../Commerce/LicenseKeyUpdateAction.ts | 4 +- .../Commerce/ManufacturerDestroyAction.ts | 4 +- .../Commerce/ManufacturerShowAction.ts | 4 +- app/Actions/Commerce/OrderDestroyAction.ts | 4 +- app/Actions/Commerce/OrderShowAction.ts | 4 +- app/Actions/Commerce/OrderUpdateAction.ts | 4 +- app/Actions/Commerce/PaymentShowAction.ts | 2 +- .../Commerce/PrintDeviceDestroyAction.ts | 4 +- app/Actions/Commerce/PrintDeviceShowAction.ts | 4 +- .../Commerce/PrintDeviceUpdateAction.ts | 4 +- app/Actions/Commerce/ProductItemShowAction.ts | 4 +- .../ProductManufacturerDestroyAction.ts | 4 +- .../Commerce/ProductManufacturerShowAction.ts | 4 +- .../ProductManufacturerUpdateAction.ts | 4 +- .../Commerce/ProductUnitDestroyAction.ts | 4 +- app/Actions/Commerce/ProductUnitShowAction.ts | 4 +- .../Commerce/ProductVariantDestroyAction.ts | 4 +- .../Commerce/ProductVariantShowAction.ts | 4 +- .../Commerce/ProductVariantUpdateAction.ts | 4 +- app/Actions/Commerce/ReceiptDestroyAction.ts | 4 +- app/Actions/Commerce/ReceiptShowAction.ts | 4 +- app/Actions/Commerce/ReceiptUpdateAction.ts | 4 +- app/Actions/Commerce/ReviewIndexAction.ts | 3 +- app/Actions/Commerce/ReviewShowAction.ts | 6 +- app/Actions/Commerce/ReviewStoreAction.ts | 5 +- .../Commerce/ShippingMethodDestroyAction.ts | 4 +- .../Commerce/ShippingMethodShowAction.ts | 4 +- .../Commerce/ShippingMethodUpdateAction.ts | 4 +- .../Commerce/ShippingRateDestroyAction.ts | 4 +- .../Commerce/ShippingRateShowAction.ts | 4 +- .../Commerce/ShippingRateUpdateAction.ts | 4 +- .../Commerce/ShippingZoneDestroyAction.ts | 4 +- .../Commerce/ShippingZoneShowAction.ts | 4 +- .../Commerce/ShippingZoneUpdateAction.ts | 4 +- app/Actions/Commerce/TaxRateDestroyAction.ts | 4 +- app/Actions/Commerce/TaxRateShowAction.ts | 4 +- app/Actions/Commerce/TaxRateUpdateAction.ts | 4 +- app/Actions/Commerce/TransactionShowAction.ts | 4 +- .../Commerce/WaitlistProductDestroyAction.ts | 4 +- .../Commerce/WaitlistProductShowAction.ts | 4 +- .../Commerce/WaitlistProductUpdateAction.ts | 4 +- .../WaitlistRestaurantDestroyAction.ts | 4 +- .../Commerce/WaitlistRestaurantShowAction.ts | 4 +- .../WaitlistRestaurantUpdateAction.ts | 4 +- .../commerce/src/products/reviews/fetch.ts | 216 ++---------------- .../commerce/src/products/reviews/index.ts | 3 +- storage/framework/core/router/src/request.ts | 8 +- storage/framework/core/types/src/request.ts | 6 +- storage/framework/core/types/src/router.ts | 2 +- 72 files changed, 150 insertions(+), 349 deletions(-) diff --git a/app/Actions/Commerce/CouponDestroyAction.ts b/app/Actions/Commerce/CouponDestroyAction.ts index 87d4456310..e9a45c0760 100644 --- a/app/Actions/Commerce/CouponDestroyAction.ts +++ b/app/Actions/Commerce/CouponDestroyAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'Coupon Destroy ORM Action', method: 'DELETE', async handle(request: CouponRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - await coupons.deleteCoupon(Number(id)) + await coupons.deleteCoupon(id) return response.json({ message: 'Coupon deleted successfully' }) }, diff --git a/app/Actions/Commerce/CouponShowAction.ts b/app/Actions/Commerce/CouponShowAction.ts index efdcab1f7d..84bbd2c773 100644 --- a/app/Actions/Commerce/CouponShowAction.ts +++ b/app/Actions/Commerce/CouponShowAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'Coupon Show ORM Action', method: 'GET', async handle(request: CouponRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await coupons.fetchById(Number(id)) + const model = await coupons.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/CouponStoreAction.ts b/app/Actions/Commerce/CouponStoreAction.ts index bd980d8866..130fe603b4 100644 --- a/app/Actions/Commerce/CouponStoreAction.ts +++ b/app/Actions/Commerce/CouponStoreAction.ts @@ -10,8 +10,6 @@ export default new Action({ description: 'Coupon Store ORM Action', method: 'POST', async handle(request: CouponRequestType) { - await request.validate() - const model = await coupons.store(request) return response.json(model) diff --git a/app/Actions/Commerce/CouponUpdateAction.ts b/app/Actions/Commerce/CouponUpdateAction.ts index 1e81719aee..444d7d6fc9 100644 --- a/app/Actions/Commerce/CouponUpdateAction.ts +++ b/app/Actions/Commerce/CouponUpdateAction.ts @@ -10,10 +10,9 @@ export default new Action({ description: 'Coupon Update ORM Action', method: 'PUT', async handle(request: CouponRequestType) { - await request.validate() - const id = request.getParam('id') + const id = request.getParam('id') - const model = await coupons.update(Number(id), request) + const model = await coupons.update(id, request) return response.json(model) }, diff --git a/app/Actions/Commerce/CustomerDestroyAction.ts b/app/Actions/Commerce/CustomerDestroyAction.ts index 72e15de7fe..223e4c7bcb 100644 --- a/app/Actions/Commerce/CustomerDestroyAction.ts +++ b/app/Actions/Commerce/CustomerDestroyAction.ts @@ -8,9 +8,9 @@ export default new Action({ description: 'Customer Destroy ORM Action', method: 'DELETE', async handle(request: CustomerRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - await customers.destroy(Number(id)) + await customers.destroy(id) return response.json({ message: 'Customer deleted successfully' }) }, diff --git a/app/Actions/Commerce/CustomerShowAction.ts b/app/Actions/Commerce/CustomerShowAction.ts index d5216f4630..9bd4377e0c 100644 --- a/app/Actions/Commerce/CustomerShowAction.ts +++ b/app/Actions/Commerce/CustomerShowAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'Customer Show ORM Action', method: 'GET', async handle(request: CustomerRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await customers.fetchById(Number(id)) + const model = await customers.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/CustomerStoreAction.ts b/app/Actions/Commerce/CustomerStoreAction.ts index eaedbfbc4d..180be6c5d6 100644 --- a/app/Actions/Commerce/CustomerStoreAction.ts +++ b/app/Actions/Commerce/CustomerStoreAction.ts @@ -10,8 +10,6 @@ export default new Action({ description: 'Customer Store ORM Action', method: 'POST', async handle(request: CustomerRequestType) { - await request.validate() - const model = await customers.store(request) return response.json(model) diff --git a/app/Actions/Commerce/CustomerUpdateAction.ts b/app/Actions/Commerce/CustomerUpdateAction.ts index 4564cde950..e7a4ea2061 100644 --- a/app/Actions/Commerce/CustomerUpdateAction.ts +++ b/app/Actions/Commerce/CustomerUpdateAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'Customer Update ORM Action', method: 'PATCH', async handle(request: CustomerRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const result = await customers.update(Number(id), request) + const result = await customers.update(id, request) return response.json(result) }, diff --git a/app/Actions/Commerce/DeliveryRouteDestroyAction.ts b/app/Actions/Commerce/DeliveryRouteDestroyAction.ts index 02a59ae684..59fda7e6d1 100644 --- a/app/Actions/Commerce/DeliveryRouteDestroyAction.ts +++ b/app/Actions/Commerce/DeliveryRouteDestroyAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'DeliveryRoute Destroy ORM Action', method: 'DELETE', async handle(request: DeliveryRouteRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - await deliveryRoutes.destroy(Number(id)) + await deliveryRoutes.destroy(id) return response.json({ message: 'DeliveryRoute deleted successfully' }) }, diff --git a/app/Actions/Commerce/DeliveryRouteShowAction.ts b/app/Actions/Commerce/DeliveryRouteShowAction.ts index ec1884c29e..ef0f9ea99f 100644 --- a/app/Actions/Commerce/DeliveryRouteShowAction.ts +++ b/app/Actions/Commerce/DeliveryRouteShowAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'DeliveryRoute Show ORM Action', method: 'GET', async handle(request: DeliveryRouteRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await deliveryRoutes.fetchById(Number(id)) + const model = await deliveryRoutes.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/DeliveryRouteStoreAction.ts b/app/Actions/Commerce/DeliveryRouteStoreAction.ts index 2e0c924c1c..fc07613d1b 100644 --- a/app/Actions/Commerce/DeliveryRouteStoreAction.ts +++ b/app/Actions/Commerce/DeliveryRouteStoreAction.ts @@ -10,8 +10,6 @@ export default new Action({ description: 'DeliveryRoute Store ORM Action', method: 'POST', async handle(request: DeliveryRouteRequestType) { - await request.validate() - const model = await deliveryRoutes.store(request) return response.json(model) diff --git a/app/Actions/Commerce/DeliveryRouteUpdateAction.ts b/app/Actions/Commerce/DeliveryRouteUpdateAction.ts index f94d4da004..7a1a596c41 100644 --- a/app/Actions/Commerce/DeliveryRouteUpdateAction.ts +++ b/app/Actions/Commerce/DeliveryRouteUpdateAction.ts @@ -10,10 +10,9 @@ export default new Action({ description: 'DeliveryRoute Update ORM Action', method: 'PUT', async handle(request: DeliveryRouteRequestType) { - await request.validate() - const id = request.getParam('id') + const id = request.getParam('id') - const model = await deliveryRoutes.update(Number(id), request) + const model = await deliveryRoutes.update(id, request) return response.json(model) }, diff --git a/app/Actions/Commerce/DigitalDeliveryDestroyAction.ts b/app/Actions/Commerce/DigitalDeliveryDestroyAction.ts index a2fd88f729..4434a0650f 100644 --- a/app/Actions/Commerce/DigitalDeliveryDestroyAction.ts +++ b/app/Actions/Commerce/DigitalDeliveryDestroyAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'DigitalDelivery Destroy ORM Action', method: 'DELETE', async handle(request: DigitalDeliveryRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - await digital.destroy(Number(id)) + await digital.destroy(id) return response.json({ message: 'DigitalDelivery deleted successfully' }) }, diff --git a/app/Actions/Commerce/DigitalDeliveryShowAction.ts b/app/Actions/Commerce/DigitalDeliveryShowAction.ts index db17d7fcf6..f462cc2f17 100644 --- a/app/Actions/Commerce/DigitalDeliveryShowAction.ts +++ b/app/Actions/Commerce/DigitalDeliveryShowAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'DigitalDelivery Show ORM Action', method: 'GET', async handle(request: DigitalDeliveryRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await digital.fetchById(Number(id)) + const model = await digital.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/DigitalDeliveryUpdateAction.ts b/app/Actions/Commerce/DigitalDeliveryUpdateAction.ts index 4a24d48f0f..1b4bab8f16 100644 --- a/app/Actions/Commerce/DigitalDeliveryUpdateAction.ts +++ b/app/Actions/Commerce/DigitalDeliveryUpdateAction.ts @@ -11,9 +11,9 @@ export default new Action({ method: 'PUT', async handle(request: DigitalDeliveryRequestType) { await request.validate() - const id = request.getParam('id') + const id = request.getParam('id') - const model = await digital.update(Number(id), request) + const model = await digital.update(id, request) return response.json(model) }, diff --git a/app/Actions/Commerce/DriverDestroyAction.ts b/app/Actions/Commerce/DriverDestroyAction.ts index 6f81722fb5..1692419956 100644 --- a/app/Actions/Commerce/DriverDestroyAction.ts +++ b/app/Actions/Commerce/DriverDestroyAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'Driver Destroy ORM Action', method: 'DELETE', async handle(request: DriverRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - await drivers.destroy(Number(id)) + await drivers.destroy(id) return response.json({ message: 'Driver deleted successfully' }) }, diff --git a/app/Actions/Commerce/DriverShowAction.ts b/app/Actions/Commerce/DriverShowAction.ts index 98fbf4115d..e647b175e0 100644 --- a/app/Actions/Commerce/DriverShowAction.ts +++ b/app/Actions/Commerce/DriverShowAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'Driver Show ORM Action', method: 'GET', async handle(request: DriverRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await drivers.fetchById(Number(id)) + const model = await drivers.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/DriverUpdateAction.ts b/app/Actions/Commerce/DriverUpdateAction.ts index 5bef0d43e3..c8ba235d4a 100644 --- a/app/Actions/Commerce/DriverUpdateAction.ts +++ b/app/Actions/Commerce/DriverUpdateAction.ts @@ -11,9 +11,9 @@ export default new Action({ method: 'PUT', async handle(request: DriverRequestType) { await request.validate() - const id = request.getParam('id') + const id = request.getParam('id') - const model = await drivers.update(Number(id), request) + const model = await drivers.update(id, request) return response.json(model) }, diff --git a/app/Actions/Commerce/GiftCardDestroyAction.ts b/app/Actions/Commerce/GiftCardDestroyAction.ts index 44daa3833a..9e92abbd39 100644 --- a/app/Actions/Commerce/GiftCardDestroyAction.ts +++ b/app/Actions/Commerce/GiftCardDestroyAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'GiftCard Destroy ORM Action', method: 'DELETE', async handle(request: GiftCardRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - await giftCards.destroy(Number(id)) + await giftCards.destroy(id) return response.json({ message: 'GiftCard deleted successfully' }) }, diff --git a/app/Actions/Commerce/GiftCardShowAction.ts b/app/Actions/Commerce/GiftCardShowAction.ts index 0ad50598b3..ebec018ae9 100644 --- a/app/Actions/Commerce/GiftCardShowAction.ts +++ b/app/Actions/Commerce/GiftCardShowAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'GiftCard Show ORM Action', method: 'GET', async handle(request: GiftCardRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await giftCards.fetchById(Number(id)) + const model = await giftCards.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/GiftCardUpdateAction.ts b/app/Actions/Commerce/GiftCardUpdateAction.ts index 64380e4cb9..b1f844d2d3 100644 --- a/app/Actions/Commerce/GiftCardUpdateAction.ts +++ b/app/Actions/Commerce/GiftCardUpdateAction.ts @@ -11,9 +11,9 @@ export default new Action({ method: 'PUT', async handle(request: GiftCardRequestType) { await request.validate() - const id = request.getParam('id') + const id = request.getParam('id') - const model = await giftCards.update(Number(id), request) + const model = await giftCards.update(id, request) return response.json(model) }, diff --git a/app/Actions/Commerce/LicenseKeyDestroyAction.ts b/app/Actions/Commerce/LicenseKeyDestroyAction.ts index e45ec9bba2..899cbf2f80 100644 --- a/app/Actions/Commerce/LicenseKeyDestroyAction.ts +++ b/app/Actions/Commerce/LicenseKeyDestroyAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'LicenseKey Destroy ORM Action', method: 'DELETE', async handle(request: LicenseKeyRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - await licenses.destroy(Number(id)) + await licenses.destroy(id) return response.json({ message: 'License key deleted successfully', diff --git a/app/Actions/Commerce/LicenseKeyShowAction.ts b/app/Actions/Commerce/LicenseKeyShowAction.ts index 205e9f7cf1..290bf42a42 100644 --- a/app/Actions/Commerce/LicenseKeyShowAction.ts +++ b/app/Actions/Commerce/LicenseKeyShowAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'LicenseKey Show ORM Action', method: 'GET', async handle(request: LicenseKeyRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await licenses.fetchById(Number(id)) + const model = await licenses.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/LicenseKeyUpdateAction.ts b/app/Actions/Commerce/LicenseKeyUpdateAction.ts index a8b536560a..8d9b43302d 100644 --- a/app/Actions/Commerce/LicenseKeyUpdateAction.ts +++ b/app/Actions/Commerce/LicenseKeyUpdateAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'LicenseKey Update ORM Action', method: 'PUT', async handle(request: LicenseKeyRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const results = await licenses.update(Number(id), request) + const results = await licenses.update(id, request) return response.json(results) }, diff --git a/app/Actions/Commerce/ManufacturerDestroyAction.ts b/app/Actions/Commerce/ManufacturerDestroyAction.ts index 89eed6387f..0af716daad 100644 --- a/app/Actions/Commerce/ManufacturerDestroyAction.ts +++ b/app/Actions/Commerce/ManufacturerDestroyAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'Manufacturer Destroy ORM Action', method: 'DELETE', async handle(request: ManufacturerRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - await products.manufacturers.destroy(Number(id)) + await products.manufacturers.destroy(id) return response.json({ message: 'Manufacturer deleted successfully', diff --git a/app/Actions/Commerce/ManufacturerShowAction.ts b/app/Actions/Commerce/ManufacturerShowAction.ts index 3d95c0af5f..acd37e6eaa 100644 --- a/app/Actions/Commerce/ManufacturerShowAction.ts +++ b/app/Actions/Commerce/ManufacturerShowAction.ts @@ -9,9 +9,9 @@ export default new Action({ description: 'Manufacturer Show ORM Action', method: 'GET', async handle() { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await products.manufacturers.fetchById(Number(id)) + const model = await products.manufacturers.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/OrderDestroyAction.ts b/app/Actions/Commerce/OrderDestroyAction.ts index ee9c1a7b77..0960b11aaa 100644 --- a/app/Actions/Commerce/OrderDestroyAction.ts +++ b/app/Actions/Commerce/OrderDestroyAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'Order Destroy ORM Action', method: 'DELETE', async handle(request: OrderRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - await orders.destroy(Number(id)) + await orders.destroy(id) return response.json({ success: true, diff --git a/app/Actions/Commerce/OrderShowAction.ts b/app/Actions/Commerce/OrderShowAction.ts index cf61f0af20..a8873241b6 100644 --- a/app/Actions/Commerce/OrderShowAction.ts +++ b/app/Actions/Commerce/OrderShowAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'Order Show ORM Action', method: 'GET', async handle(request: OrderRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await orders.fetchById(Number(id)) + const model = await orders.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/OrderUpdateAction.ts b/app/Actions/Commerce/OrderUpdateAction.ts index 8e381448d3..2f49c58faf 100644 --- a/app/Actions/Commerce/OrderUpdateAction.ts +++ b/app/Actions/Commerce/OrderUpdateAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'Order Update ORM Action', method: 'PUT', async handle(request: OrderRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await orders.update(Number(id), request) + const model = await orders.update(id, request) return response.json(model) }, diff --git a/app/Actions/Commerce/PaymentShowAction.ts b/app/Actions/Commerce/PaymentShowAction.ts index 7683254416..a2a677fd84 100644 --- a/app/Actions/Commerce/PaymentShowAction.ts +++ b/app/Actions/Commerce/PaymentShowAction.ts @@ -10,7 +10,7 @@ export default new Action({ async handle(request: PaymentRequestType) { const id = request.get('id') - const payment = await payments.fetchById(Number(id)) + const payment = await payments.fetchById(id) return response.json(payment) }, diff --git a/app/Actions/Commerce/PrintDeviceDestroyAction.ts b/app/Actions/Commerce/PrintDeviceDestroyAction.ts index 504cf36f27..a0c2a99c71 100644 --- a/app/Actions/Commerce/PrintDeviceDestroyAction.ts +++ b/app/Actions/Commerce/PrintDeviceDestroyAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'PrintDevice Destroy ORM Action', method: 'DELETE', async handle(request: PrintDeviceRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - await devices.destroy(Number(id)) + await devices.destroy(id) return response.json({ message: 'PrintDevice deleted successfully' }) }, diff --git a/app/Actions/Commerce/PrintDeviceShowAction.ts b/app/Actions/Commerce/PrintDeviceShowAction.ts index b7ab63edf1..b72096a09e 100644 --- a/app/Actions/Commerce/PrintDeviceShowAction.ts +++ b/app/Actions/Commerce/PrintDeviceShowAction.ts @@ -9,9 +9,9 @@ export default new Action({ description: 'PrintDevice Show ORM Action', method: 'GET', async handle(request: PrintDeviceRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await devices.fetchById(Number(id)) + const model = await devices.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/PrintDeviceUpdateAction.ts b/app/Actions/Commerce/PrintDeviceUpdateAction.ts index 4dc24cf55b..4d80e0e45a 100644 --- a/app/Actions/Commerce/PrintDeviceUpdateAction.ts +++ b/app/Actions/Commerce/PrintDeviceUpdateAction.ts @@ -11,9 +11,9 @@ export default new Action({ async handle(request: PrintDeviceRequestType) { await request.validate() - const id = request.getParam('id') + const id = request.getParam('id') - const model = await devices.update(Number(id), request) + const model = await devices.update(id, request) return response.json(model) }, diff --git a/app/Actions/Commerce/ProductItemShowAction.ts b/app/Actions/Commerce/ProductItemShowAction.ts index aafe65c988..bbf0dab744 100644 --- a/app/Actions/Commerce/ProductItemShowAction.ts +++ b/app/Actions/Commerce/ProductItemShowAction.ts @@ -10,9 +10,9 @@ export default new Action({ method: 'GET', async handle(request: ProductItemRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await products.items.fetchById(Number(id)) + const model = await products.items.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/ProductManufacturerDestroyAction.ts b/app/Actions/Commerce/ProductManufacturerDestroyAction.ts index 9bd222bee4..9e18a134e2 100644 --- a/app/Actions/Commerce/ProductManufacturerDestroyAction.ts +++ b/app/Actions/Commerce/ProductManufacturerDestroyAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'ProductManufacturer Destroy ORM Action', method: 'DELETE', async handle(request: ManufacturerRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - await products.manufacturers.destroy(Number(id)) + await products.manufacturers.destroy(id) return response.json({ message: 'Manufacturer deleted successfully' }) }, diff --git a/app/Actions/Commerce/ProductManufacturerShowAction.ts b/app/Actions/Commerce/ProductManufacturerShowAction.ts index 61d3c51b34..78578402f2 100644 --- a/app/Actions/Commerce/ProductManufacturerShowAction.ts +++ b/app/Actions/Commerce/ProductManufacturerShowAction.ts @@ -8,9 +8,9 @@ export default new Action({ description: 'ProductManufacturer Show ORM Action', method: 'GET', async handle(request: ManufacturerRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await products.manufacturers.fetchById(Number(id)) + const model = await products.manufacturers.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/ProductManufacturerUpdateAction.ts b/app/Actions/Commerce/ProductManufacturerUpdateAction.ts index 197c72bc8b..8053cc4781 100644 --- a/app/Actions/Commerce/ProductManufacturerUpdateAction.ts +++ b/app/Actions/Commerce/ProductManufacturerUpdateAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'ProductManufacturer Update ORM Action', method: 'PATCH', async handle(request: ManufacturerRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const result = await products.manufacturers.update(Number(id), request) + const result = await products.manufacturers.update(id, request) return response.json(result) }, diff --git a/app/Actions/Commerce/ProductUnitDestroyAction.ts b/app/Actions/Commerce/ProductUnitDestroyAction.ts index 56a4b84daf..5451e9fc3f 100644 --- a/app/Actions/Commerce/ProductUnitDestroyAction.ts +++ b/app/Actions/Commerce/ProductUnitDestroyAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'ProductUnit Destroy ORM Action', method: 'DELETE', async handle(request: ProductUnitRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - await products.units.destroy(Number(id)) + await products.units.destroy(id) return response.json({ message: 'Unit deleted successfully' }) }, diff --git a/app/Actions/Commerce/ProductUnitShowAction.ts b/app/Actions/Commerce/ProductUnitShowAction.ts index 95a93d9422..55b0d5f84d 100644 --- a/app/Actions/Commerce/ProductUnitShowAction.ts +++ b/app/Actions/Commerce/ProductUnitShowAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'ProductUnit Show ORM Action', method: 'GET', async handle(request: ProductUnitRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await products.units.fetchById(Number(id)) + const model = await products.units.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/ProductVariantDestroyAction.ts b/app/Actions/Commerce/ProductVariantDestroyAction.ts index 8d671114f8..e76d099b4f 100644 --- a/app/Actions/Commerce/ProductVariantDestroyAction.ts +++ b/app/Actions/Commerce/ProductVariantDestroyAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'ProductVariant Destroy ORM Action', method: 'DELETE', async handle(request: ProductVariantRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - await products.variants.destroy(Number(id)) + await products.variants.destroy(id) return response.json({ message: 'Variant deleted successfully' }) }, diff --git a/app/Actions/Commerce/ProductVariantShowAction.ts b/app/Actions/Commerce/ProductVariantShowAction.ts index fb1d51ff16..472517f32e 100644 --- a/app/Actions/Commerce/ProductVariantShowAction.ts +++ b/app/Actions/Commerce/ProductVariantShowAction.ts @@ -9,9 +9,9 @@ export default new Action({ description: 'ProductVariant Show ORM Action', method: 'GET', async handle(request: ProductVariantRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await products.variants.fetchById(Number(id)) + const model = await products.variants.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/ProductVariantUpdateAction.ts b/app/Actions/Commerce/ProductVariantUpdateAction.ts index 7b86e95c2c..20a219059e 100644 --- a/app/Actions/Commerce/ProductVariantUpdateAction.ts +++ b/app/Actions/Commerce/ProductVariantUpdateAction.ts @@ -10,9 +10,9 @@ export default new Action({ async handle(request: ProductVariantRequestType) { await request.validate() - const id = request.getParam('id') + const id = request.getParam('id') - const result = await products.variants.update(Number(id), request) + const result = await products.variants.update(id, request) return response.json(result) }, diff --git a/app/Actions/Commerce/ReceiptDestroyAction.ts b/app/Actions/Commerce/ReceiptDestroyAction.ts index 53f9ede9fc..d167838088 100644 --- a/app/Actions/Commerce/ReceiptDestroyAction.ts +++ b/app/Actions/Commerce/ReceiptDestroyAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'Receipt Destroy ORM Action', method: 'DELETE', async handle(request: ReceiptRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - await receipts.destroy(Number(id)) + await receipts.destroy(id) return response.json({ message: 'Receipt deleted successfully' }) }, diff --git a/app/Actions/Commerce/ReceiptShowAction.ts b/app/Actions/Commerce/ReceiptShowAction.ts index c87c444818..774c1c2bbd 100644 --- a/app/Actions/Commerce/ReceiptShowAction.ts +++ b/app/Actions/Commerce/ReceiptShowAction.ts @@ -10,9 +10,9 @@ export default new Action({ description: 'Receipt Show ORM Action', method: 'GET', async handle(request: ReceiptRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await receipts.fetchById(Number(id)) + const model = await receipts.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/ReceiptUpdateAction.ts b/app/Actions/Commerce/ReceiptUpdateAction.ts index 5adf5a3cbc..5c2ffd35f6 100644 --- a/app/Actions/Commerce/ReceiptUpdateAction.ts +++ b/app/Actions/Commerce/ReceiptUpdateAction.ts @@ -11,9 +11,9 @@ export default new Action({ async handle(request: ReceiptRequestType) { await request.validate() - const id = request.getParam('id') + const id = request.getParam('id') - const result = await receipts.update(Number(id), request) + const result = await receipts.update(id, request) return response.json(result) }, diff --git a/app/Actions/Commerce/ReviewIndexAction.ts b/app/Actions/Commerce/ReviewIndexAction.ts index eaba08f52c..4dae9bed8c 100644 --- a/app/Actions/Commerce/ReviewIndexAction.ts +++ b/app/Actions/Commerce/ReviewIndexAction.ts @@ -1,4 +1,5 @@ import { Action } from '@stacksjs/actions' +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -6,7 +7,7 @@ export default new Action({ description: 'Review Index ORM Action', method: 'GET', async handle() { - const results = Review.all() + const results = await products.reviews.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/ReviewShowAction.ts b/app/Actions/Commerce/ReviewShowAction.ts index 2da6a90b32..a9a07ee577 100644 --- a/app/Actions/Commerce/ReviewShowAction.ts +++ b/app/Actions/Commerce/ReviewShowAction.ts @@ -1,6 +1,6 @@ import type { ReviewRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -8,9 +8,9 @@ export default new Action({ description: 'Review Show ORM Action', method: 'GET', async handle(request: ReviewRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await Review.findOrFail(Number(id)) + const model = await products.reviews.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/ReviewStoreAction.ts b/app/Actions/Commerce/ReviewStoreAction.ts index 4845dff2f5..f65d721e7f 100644 --- a/app/Actions/Commerce/ReviewStoreAction.ts +++ b/app/Actions/Commerce/ReviewStoreAction.ts @@ -1,6 +1,6 @@ import type { ReviewRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { products } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -8,8 +8,7 @@ export default new Action({ description: 'Review Store ORM Action', method: 'POST', async handle(request: ReviewRequestType) { - await request.validate() - const model = await Review.create(request.all()) + const model = await products.reviews.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/ShippingMethodDestroyAction.ts b/app/Actions/Commerce/ShippingMethodDestroyAction.ts index 1beaa084fb..da134ee470 100644 --- a/app/Actions/Commerce/ShippingMethodDestroyAction.ts +++ b/app/Actions/Commerce/ShippingMethodDestroyAction.ts @@ -6,9 +6,9 @@ export default new Action({ description: 'ShippingMethod Destroy ORM Action', method: 'DELETE', async handle(request: ShippingMethodRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await ShippingMethod.findOrFail(Number(id)) + const model = await ShippingMethod.findOrFail(id) model.delete() diff --git a/app/Actions/Commerce/ShippingMethodShowAction.ts b/app/Actions/Commerce/ShippingMethodShowAction.ts index 2f552f351b..885c25b733 100644 --- a/app/Actions/Commerce/ShippingMethodShowAction.ts +++ b/app/Actions/Commerce/ShippingMethodShowAction.ts @@ -8,9 +8,9 @@ export default new Action({ description: 'ShippingMethod Show ORM Action', method: 'GET', async handle(request: ShippingMethodRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await ShippingMethod.findOrFail(Number(id)) + const model = await ShippingMethod.findOrFail(id) return response.json(model) }, diff --git a/app/Actions/Commerce/ShippingMethodUpdateAction.ts b/app/Actions/Commerce/ShippingMethodUpdateAction.ts index 16f482be97..1d491afb45 100644 --- a/app/Actions/Commerce/ShippingMethodUpdateAction.ts +++ b/app/Actions/Commerce/ShippingMethodUpdateAction.ts @@ -10,8 +10,8 @@ export default new Action({ async handle(request: ShippingMethodRequestType) { await request.validate() - const id = request.getParam('id') - const model = await ShippingMethod.findOrFail(Number(id)) + const id = request.getParam('id') + const model = await ShippingMethod.findOrFail(id) const result = model.update(request.all()) diff --git a/app/Actions/Commerce/ShippingRateDestroyAction.ts b/app/Actions/Commerce/ShippingRateDestroyAction.ts index 5768cf0bce..f9d54ed232 100644 --- a/app/Actions/Commerce/ShippingRateDestroyAction.ts +++ b/app/Actions/Commerce/ShippingRateDestroyAction.ts @@ -6,9 +6,9 @@ export default new Action({ description: 'ShippingRate Destroy ORM Action', method: 'DELETE', async handle(request: ShippingRateRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await ShippingRate.findOrFail(Number(id)) + const model = await ShippingRate.findOrFail(id) model.delete() diff --git a/app/Actions/Commerce/ShippingRateShowAction.ts b/app/Actions/Commerce/ShippingRateShowAction.ts index 7f4d274744..6252308fa0 100644 --- a/app/Actions/Commerce/ShippingRateShowAction.ts +++ b/app/Actions/Commerce/ShippingRateShowAction.ts @@ -8,9 +8,9 @@ export default new Action({ description: 'ShippingRate Show ORM Action', method: 'GET', async handle(request: ShippingRateRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await ShippingRate.findOrFail(Number(id)) + const model = await ShippingRate.findOrFail(id) return response.json(model) }, diff --git a/app/Actions/Commerce/ShippingRateUpdateAction.ts b/app/Actions/Commerce/ShippingRateUpdateAction.ts index e630e55f1b..b6049a4587 100644 --- a/app/Actions/Commerce/ShippingRateUpdateAction.ts +++ b/app/Actions/Commerce/ShippingRateUpdateAction.ts @@ -10,8 +10,8 @@ export default new Action({ async handle(request: ShippingRateRequestType) { await request.validate() - const id = request.getParam('id') - const model = await ShippingRate.findOrFail(Number(id)) + const id = request.getParam('id') + const model = await ShippingRate.findOrFail(id) const result = model.update(request.all()) diff --git a/app/Actions/Commerce/ShippingZoneDestroyAction.ts b/app/Actions/Commerce/ShippingZoneDestroyAction.ts index fde2d6e71f..a809529465 100644 --- a/app/Actions/Commerce/ShippingZoneDestroyAction.ts +++ b/app/Actions/Commerce/ShippingZoneDestroyAction.ts @@ -6,9 +6,9 @@ export default new Action({ description: 'ShippingZone Destroy ORM Action', method: 'DELETE', async handle(request: ShippingZoneRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await ShippingZone.findOrFail(Number(id)) + const model = await ShippingZone.findOrFail(id) model.delete() diff --git a/app/Actions/Commerce/ShippingZoneShowAction.ts b/app/Actions/Commerce/ShippingZoneShowAction.ts index 43ba68c7b6..bcb0df3cc2 100644 --- a/app/Actions/Commerce/ShippingZoneShowAction.ts +++ b/app/Actions/Commerce/ShippingZoneShowAction.ts @@ -8,9 +8,9 @@ export default new Action({ description: 'ShippingZone Show ORM Action', method: 'GET', async handle(request: ShippingZoneRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await ShippingZone.findOrFail(Number(id)) + const model = await ShippingZone.findOrFail(id) return response.json(model) }, diff --git a/app/Actions/Commerce/ShippingZoneUpdateAction.ts b/app/Actions/Commerce/ShippingZoneUpdateAction.ts index daa669003c..0c3f1c70ca 100644 --- a/app/Actions/Commerce/ShippingZoneUpdateAction.ts +++ b/app/Actions/Commerce/ShippingZoneUpdateAction.ts @@ -10,8 +10,8 @@ export default new Action({ async handle(request: ShippingZoneRequestType) { await request.validate() - const id = request.getParam('id') - const model = await ShippingZone.findOrFail(Number(id)) + const id = request.getParam('id') + const model = await ShippingZone.findOrFail(id) const result = model.update(request.all()) diff --git a/app/Actions/Commerce/TaxRateDestroyAction.ts b/app/Actions/Commerce/TaxRateDestroyAction.ts index 10a2008d0b..d13a0322d8 100644 --- a/app/Actions/Commerce/TaxRateDestroyAction.ts +++ b/app/Actions/Commerce/TaxRateDestroyAction.ts @@ -6,9 +6,9 @@ export default new Action({ description: 'TaxRate Destroy ORM Action', method: 'DELETE', async handle(request: TaxRateRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await TaxRate.findOrFail(Number(id)) + const model = await TaxRate.findOrFail(id) model.delete() diff --git a/app/Actions/Commerce/TaxRateShowAction.ts b/app/Actions/Commerce/TaxRateShowAction.ts index c44b8f3551..1ca4409346 100644 --- a/app/Actions/Commerce/TaxRateShowAction.ts +++ b/app/Actions/Commerce/TaxRateShowAction.ts @@ -9,9 +9,9 @@ export default new Action({ description: 'TaxRate Show ORM Action', method: 'GET', async handle(request: TaxRateRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await TaxRate.findOrFail(Number(id)) + const model = await TaxRate.findOrFail(id) return response.json(model) }, diff --git a/app/Actions/Commerce/TaxRateUpdateAction.ts b/app/Actions/Commerce/TaxRateUpdateAction.ts index 5c46388910..738efe7719 100644 --- a/app/Actions/Commerce/TaxRateUpdateAction.ts +++ b/app/Actions/Commerce/TaxRateUpdateAction.ts @@ -10,8 +10,8 @@ export default new Action({ async handle(request: TaxRateRequestType) { await request.validate() - const id = request.getParam('id') - const model = await TaxRate.findOrFail(Number(id)) + const id = request.getParam('id') + const model = await TaxRate.findOrFail(id) const result = model.update(request.all()) diff --git a/app/Actions/Commerce/TransactionShowAction.ts b/app/Actions/Commerce/TransactionShowAction.ts index d411e6e6f9..e1525a8783 100644 --- a/app/Actions/Commerce/TransactionShowAction.ts +++ b/app/Actions/Commerce/TransactionShowAction.ts @@ -8,9 +8,9 @@ export default new Action({ description: 'Transaction Show ORM Action', method: 'GET', async handle(request: TransactionRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await Transaction.findOrFail(Number(id)) + const model = await Transaction.findOrFail(id) return response.json(model) }, diff --git a/app/Actions/Commerce/WaitlistProductDestroyAction.ts b/app/Actions/Commerce/WaitlistProductDestroyAction.ts index fb941cf29f..94f5b152a2 100644 --- a/app/Actions/Commerce/WaitlistProductDestroyAction.ts +++ b/app/Actions/Commerce/WaitlistProductDestroyAction.ts @@ -9,9 +9,9 @@ export default new Action({ description: 'WaitlistProduct Destroy ORM Action', method: 'DELETE', async handle(request: WaitlistProductRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await WaitlistProduct.findOrFail(Number(id)) + const model = await WaitlistProduct.findOrFail(id) model.delete() diff --git a/app/Actions/Commerce/WaitlistProductShowAction.ts b/app/Actions/Commerce/WaitlistProductShowAction.ts index d48b66b77e..e889ea0b14 100644 --- a/app/Actions/Commerce/WaitlistProductShowAction.ts +++ b/app/Actions/Commerce/WaitlistProductShowAction.ts @@ -9,9 +9,9 @@ export default new Action({ description: 'WaitlistProduct Show ORM Action', method: 'GET', async handle(request: WaitlistProductRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await WaitlistProduct.findOrFail(Number(id)) + const model = await WaitlistProduct.findOrFail(id) return response.json(model) }, diff --git a/app/Actions/Commerce/WaitlistProductUpdateAction.ts b/app/Actions/Commerce/WaitlistProductUpdateAction.ts index fd40599b9c..004c96b5fc 100644 --- a/app/Actions/Commerce/WaitlistProductUpdateAction.ts +++ b/app/Actions/Commerce/WaitlistProductUpdateAction.ts @@ -11,8 +11,8 @@ export default new Action({ async handle(request: WaitlistProductRequestType) { await request.validate() - const id = request.getParam('id') - const model = await WaitlistProduct.findOrFail(Number(id)) + const id = request.getParam('id') + const model = await WaitlistProduct.findOrFail(id) const result = model.update(request.all()) diff --git a/app/Actions/Commerce/WaitlistRestaurantDestroyAction.ts b/app/Actions/Commerce/WaitlistRestaurantDestroyAction.ts index 1c6b95119b..f994322e1e 100644 --- a/app/Actions/Commerce/WaitlistRestaurantDestroyAction.ts +++ b/app/Actions/Commerce/WaitlistRestaurantDestroyAction.ts @@ -9,9 +9,9 @@ export default new Action({ description: 'WaitlistRestaurant Destroy ORM Action', method: 'DELETE', async handle(request: WaitlistRestaurantRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await WaitlistRestaurant.findOrFail(Number(id)) + const model = await WaitlistRestaurant.findOrFail(id) model.delete() diff --git a/app/Actions/Commerce/WaitlistRestaurantShowAction.ts b/app/Actions/Commerce/WaitlistRestaurantShowAction.ts index f32d1cbaeb..03c817fd80 100644 --- a/app/Actions/Commerce/WaitlistRestaurantShowAction.ts +++ b/app/Actions/Commerce/WaitlistRestaurantShowAction.ts @@ -9,9 +9,9 @@ export default new Action({ description: 'WaitlistRestaurant Show ORM Action', method: 'GET', async handle(request: WaitlistRestaurantRequestType) { - const id = request.getParam('id') + const id = request.getParam('id') - const model = await WaitlistRestaurant.findOrFail(Number(id)) + const model = await WaitlistRestaurant.findOrFail(id) return response.json(model) }, diff --git a/app/Actions/Commerce/WaitlistRestaurantUpdateAction.ts b/app/Actions/Commerce/WaitlistRestaurantUpdateAction.ts index 2460d5ad9a..22616409cc 100644 --- a/app/Actions/Commerce/WaitlistRestaurantUpdateAction.ts +++ b/app/Actions/Commerce/WaitlistRestaurantUpdateAction.ts @@ -11,8 +11,8 @@ export default new Action({ async handle(request: WaitlistRestaurantRequestType) { await request.validate() - const id = request.getParam('id') - const model = await WaitlistRestaurant.findOrFail(Number(id)) + const id = request.getParam('id') + const model = await WaitlistRestaurant.findOrFail(id) const result = model.update(request.all()) diff --git a/storage/framework/core/commerce/src/products/reviews/fetch.ts b/storage/framework/core/commerce/src/products/reviews/fetch.ts index 6bfeeca73c..0e7303bb37 100644 --- a/storage/framework/core/commerce/src/products/reviews/fetch.ts +++ b/storage/framework/core/commerce/src/products/reviews/fetch.ts @@ -1,5 +1,4 @@ import type { ReviewJsonResponse } from '@stacksjs/orm' -import type { FetchReviewsOptions, ReviewResponse, ReviewStats } from '../types' import { db } from '@stacksjs/database' /** @@ -14,231 +13,42 @@ export async function fetchById(id: number): Promise { - // Set default values - const page = options.page || 1 - const limit = options.limit || 10 - - // Start building the query - const query = db.selectFrom('reviews') - .where('product_id', '=', productId) - - const countQuery = db.selectFrom('reviews') - .where('product_id', '=', productId) - - // Get total count for pagination - const countResult = await countQuery - .select(eb => eb.fn.count('id').as('total')) - .executeTakeFirst() - - const total = Number(countResult?.total || 0) - - // Apply pagination - const reviews = await query - .selectAll() - .limit(limit) - .offset((page - 1) * limit) - .execute() - - // Calculate pagination info - const totalPages = Math.ceil(total / limit) - - return { - data: reviews, - paging: { - total_records: total, - page, - total_pages: totalPages, - }, - next_cursor: page < totalPages ? page + 1 : null, - } -} - -/** - * Fetch reviews by user ID + * Fetch all product reviews */ -export async function fetchByUserId(userId: number, options: FetchReviewsOptions = {}): Promise { - // Set default values - const page = options.page || 1 - const limit = options.limit || 10 - - // Start building the query - const query = db.selectFrom('reviews') - .where('customer_id', '=', userId) - - const countQuery = db.selectFrom('reviews') - .where('customer_id', '=', userId) - - // Get total count for pagination - const countResult = await countQuery - .select(eb => eb.fn.count('id').as('total')) - .executeTakeFirst() - - const total = Number(countResult?.total || 0) - - // Apply pagination - const reviews = await query - .selectAll() - .limit(limit) - .offset((page - 1) * limit) - .execute() - - // Calculate pagination info - const totalPages = Math.ceil(total / limit) - - return { - data: reviews, - paging: { - total_records: total, - page, - total_pages: totalPages, - }, - next_cursor: page < totalPages ? page + 1 : null, - } +export async function fetchAll(): Promise { + return await db.selectFrom('reviews').selectAll().execute() } /** - * Fetch approved reviews for a product + * Fetch reviews for a specific product */ -export async function fetchApprovedByProductId(productId: number, options: FetchReviewsOptions = {}): Promise { - // Set default values - const page = options.page || 1 - const limit = options.limit || 10 - - // Start building the query - const query = db.selectFrom('reviews') - .where('product_id', '=', productId) - .where('is_approved', '=', true) - - const countQuery = db.selectFrom('reviews') +export async function fetchByProductId(productId: number): Promise { + return await db + .selectFrom('reviews') .where('product_id', '=', productId) - .where('is_approved', '=', true) - - // Get total count for pagination - const countResult = await countQuery - .select(eb => eb.fn.count('id').as('total')) - .executeTakeFirst() - - const total = Number(countResult?.total || 0) - - // Apply pagination - const reviews = await query .selectAll() - .limit(limit) - .offset((page - 1) * limit) .execute() - - // Calculate pagination info - const totalPages = Math.ceil(total / limit) - - return { - data: reviews, - paging: { - total_records: total, - page, - total_pages: totalPages, - }, - next_cursor: page < totalPages ? page + 1 : null, - } } /** - * Get review statistics for a product + * Fetch reviews by user ID */ -export async function fetchReviewStats(productId: number): Promise { - // Total reviews for the product - const totalReviews = await db - .selectFrom('reviews') - .where('product_id', '=', productId) - .where('is_approved', '=', true) - .select(eb => eb.fn.count('id').as('count')) - .executeTakeFirst() - - // Average rating - const avgRating = await db - .selectFrom('reviews') - .where('product_id', '=', productId) - .where('is_approved', '=', true) - .select(eb => eb.fn.avg('rating').as('avg_rating')) - .executeTakeFirst() - - // Rating distribution - const oneStarCount = await db - .selectFrom('reviews') - .where('product_id', '=', productId) - .where('is_approved', '=', true) - .where('rating', '=', 1) - .select(eb => eb.fn.count('id').as('count')) - .executeTakeFirst() - - const twoStarCount = await db - .selectFrom('reviews') - .where('product_id', '=', productId) - .where('is_approved', '=', true) - .where('rating', '=', 2) - .select(eb => eb.fn.count('id').as('count')) - .executeTakeFirst() - - const threeStarCount = await db - .selectFrom('reviews') - .where('product_id', '=', productId) - .where('is_approved', '=', true) - .where('rating', '=', 3) - .select(eb => eb.fn.count('id').as('count')) - .executeTakeFirst() - - const fourStarCount = await db - .selectFrom('reviews') - .where('product_id', '=', productId) - .where('is_approved', '=', true) - .where('rating', '=', 4) - .select(eb => eb.fn.count('id').as('count')) - .executeTakeFirst() - - const fiveStarCount = await db - .selectFrom('reviews') - .where('product_id', '=', productId) - .where('is_approved', '=', true) - .where('rating', '=', 5) - .select(eb => eb.fn.count('id').as('count')) - .executeTakeFirst() - - // Recent reviews - const recentReviews = await db +export async function fetchByUserId(userId: number): Promise { + return await db .selectFrom('reviews') - .where('product_id', '=', productId) - .where('is_approved', '=', true) + .where('customer_id', '=', userId) .selectAll() - .orderBy('created_at', 'desc') - .limit(5) .execute() - - return { - total: Number(totalReviews?.count || 0), - average_rating: Number(avgRating?.avg_rating || 0), - rating_distribution: { - one_star: Number(oneStarCount?.count || 0), - two_star: Number(twoStarCount?.count || 0), - three_star: Number(threeStarCount?.count || 0), - four_star: Number(fourStarCount?.count || 0), - five_star: Number(fiveStarCount?.count || 0), - }, - recent_reviews: recentReviews, - } } /** - * Fetch most helpful reviews for a product + * Fetch approved reviews for a product */ -export async function fetchMostHelpfulByProductId(productId: number, limit: number = 5): Promise { +export async function fetchApprovedByProductId(productId: number): Promise { return await db .selectFrom('reviews') .where('product_id', '=', productId) .where('is_approved', '=', true) .selectAll() - .orderBy('helpful_votes', 'desc') - .limit(limit) .execute() } diff --git a/storage/framework/core/commerce/src/products/reviews/index.ts b/storage/framework/core/commerce/src/products/reviews/index.ts index 6c11214f7e..0ec16d90b0 100644 --- a/storage/framework/core/commerce/src/products/reviews/index.ts +++ b/storage/framework/core/commerce/src/products/reviews/index.ts @@ -5,12 +5,11 @@ export { // Functions from fetch.ts export { + fetchAll, fetchApprovedByProductId, fetchById, fetchByProductId, fetchByUserId, - fetchMostHelpfulByProductId, - fetchReviewStats, } from './fetch' // Functions from store.ts diff --git a/storage/framework/core/router/src/request.ts b/storage/framework/core/router/src/request.ts index 7eafc9161c..91d65e7df8 100644 --- a/storage/framework/core/router/src/request.ts +++ b/storage/framework/core/router/src/request.ts @@ -17,11 +17,11 @@ interface CustomAttributes { [key: string]: ValidationField } -type RouteParams = { [key: string]: string | number } | null +interface RouteParams { [key: string]: string | number } export class Request implements RequestInstance { public query: T = {} as T - public params: RouteParams = null + public params: RouteParams = {} as RouteParams public headers: any = {} public addQuery(url: URL): void { @@ -85,8 +85,8 @@ export class Request implements RequestInst return this.headers.get(headerParam) } - public getParam(key: string): number | string | null { - return this.params ? this.params[key] || null : null + public getParam(key: string): T { + return this.params[key] as T } public route(key: string): number | string | null { diff --git a/storage/framework/core/types/src/request.ts b/storage/framework/core/types/src/request.ts index 1aa63403d2..e35b57c251 100644 --- a/storage/framework/core/types/src/request.ts +++ b/storage/framework/core/types/src/request.ts @@ -1,4 +1,4 @@ -import type { VineType } from '@stacksjs/types' +import type { RouteParam, VineType } from '@stacksjs/types' export type * from '../../../types/requests' interface RequestData { @@ -21,7 +21,7 @@ export interface RequestInstance { addBodies: (params: any) => void - addParam: (param: RouteParams) => void + addParam: (param: RouteParam) => void get: (element: string, defaultValue?: T) => T @@ -39,7 +39,7 @@ export interface RequestInstance { extractParamsFromRoute: (routePattern: string, pathname: string) => void - getParam: (key: string) => number | string | null + getParam: (key: string) => T route: (key: string) => number | string | null diff --git a/storage/framework/core/types/src/router.ts b/storage/framework/core/types/src/router.ts index 1f55d089c9..6f6f8957b8 100644 --- a/storage/framework/core/types/src/router.ts +++ b/storage/framework/core/types/src/router.ts @@ -30,7 +30,7 @@ export interface MiddlewareOptions { export type StatusCode = 200 | 201 | 202 | 204 | 301 | 302 | 304 | 400 | 401 | 403 | 404 | 500 export type RedirectCode = Extract -export type RouteParam = { [key: string]: string | number } | null +export interface RouteParam { [key: string]: string | number } export type MiddlewareFn = () => void From d9553d2fa824163e791102b0ff7b8cf5bf07d7a1 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Wed, 2 Apr 2025 21:40:28 +0800 Subject: [PATCH 54/78] chore: wip --- app/Actions/Commerce/ShippingMethodDestroyAction.ts | 8 ++++---- app/Actions/Commerce/ShippingMethodIndexAction.ts | 4 ++-- app/Actions/Commerce/ShippingMethodShowAction.ts | 4 ++-- app/Actions/Commerce/ShippingMethodStoreAction.ts | 5 ++--- app/Actions/Commerce/ShippingMethodUpdateAction.ts | 8 +++----- app/Actions/Commerce/ShippingRateDestroyAction.ts | 8 ++++---- app/Actions/Commerce/ShippingRateIndexAction.ts | 1 + storage/framework/core/commerce/src/index.ts | 10 +++++----- .../commerce/src/{ => shippings}/digital/destroy.ts | 0 .../core/commerce/src/{ => shippings}/digital/fetch.ts | 0 .../core/commerce/src/{ => shippings}/digital/index.ts | 0 .../core/commerce/src/{ => shippings}/digital/store.ts | 0 .../commerce/src/{ => shippings}/digital/update.ts | 0 .../commerce/src/{ => shippings}/drivers/destroy.ts | 0 .../core/commerce/src/{ => shippings}/drivers/fetch.ts | 0 .../core/commerce/src/{ => shippings}/drivers/index.ts | 0 .../core/commerce/src/{ => shippings}/drivers/store.ts | 0 .../commerce/src/{ => shippings}/drivers/update.ts | 0 .../commerce/src/{ => shippings}/licenses/destroy.ts | 0 .../commerce/src/{ => shippings}/licenses/fetch.ts | 0 .../commerce/src/{ => shippings}/licenses/index.ts | 0 .../commerce/src/{ => shippings}/licenses/store.ts | 0 .../commerce/src/{ => shippings}/licenses/update.ts | 0 .../commerce/src/{ => shippings}/routes/destroy.ts | 0 .../core/commerce/src/{ => shippings}/routes/fetch.ts | 0 .../core/commerce/src/{ => shippings}/routes/index.ts | 0 .../core/commerce/src/{ => shippings}/routes/store.ts | 0 .../core/commerce/src/{ => shippings}/routes/update.ts | 0 .../commerce/src/{ => shippings}/shipping/destroy.ts | 0 .../commerce/src/{ => shippings}/shipping/fetch.ts | 8 ++++++++ .../commerce/src/{ => shippings}/shipping/index.ts | 1 + .../commerce/src/{ => shippings}/shipping/store.ts | 0 .../commerce/src/{ => shippings}/shipping/update.ts | 0 .../core/commerce/src/{ => shippings}/zones/destroy.ts | 0 .../core/commerce/src/{ => shippings}/zones/fetch.ts | 0 .../core/commerce/src/{ => shippings}/zones/index.ts | 0 .../core/commerce/src/{ => shippings}/zones/store.ts | 0 .../core/commerce/src/{ => shippings}/zones/update.ts | 0 .../framework/core/commerce/src/tests/digitals.test.ts | 8 ++++---- .../framework/core/commerce/src/tests/drivers.test.ts | 8 ++++---- .../framework/core/commerce/src/tests/license.test.ts | 8 ++++---- .../framework/core/commerce/src/tests/routes.test.ts | 8 ++++---- .../framework/core/commerce/src/tests/shipping.test.ts | 8 ++++---- 43 files changed, 52 insertions(+), 45 deletions(-) rename storage/framework/core/commerce/src/{ => shippings}/digital/destroy.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/digital/fetch.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/digital/index.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/digital/store.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/digital/update.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/drivers/destroy.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/drivers/fetch.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/drivers/index.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/drivers/store.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/drivers/update.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/licenses/destroy.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/licenses/fetch.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/licenses/index.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/licenses/store.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/licenses/update.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/routes/destroy.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/routes/fetch.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/routes/index.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/routes/store.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/routes/update.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/shipping/destroy.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/shipping/fetch.ts (65%) rename storage/framework/core/commerce/src/{ => shippings}/shipping/index.ts (97%) rename storage/framework/core/commerce/src/{ => shippings}/shipping/store.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/shipping/update.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/zones/destroy.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/zones/fetch.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/zones/index.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/zones/store.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/zones/update.ts (100%) diff --git a/app/Actions/Commerce/ShippingMethodDestroyAction.ts b/app/Actions/Commerce/ShippingMethodDestroyAction.ts index da134ee470..92ceedb0eb 100644 --- a/app/Actions/Commerce/ShippingMethodDestroyAction.ts +++ b/app/Actions/Commerce/ShippingMethodDestroyAction.ts @@ -1,5 +1,7 @@ import type { ShippingMethodRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { shipping } from '@stacksjs/commerce' +import { response } from '@stacksjs/router' export default new Action({ name: 'ShippingMethod Destroy', @@ -8,10 +10,8 @@ export default new Action({ async handle(request: ShippingMethodRequestType) { const id = request.getParam('id') - const model = await ShippingMethod.findOrFail(id) + await shipping.destroy(id) - model.delete() - - return 'Model deleted!' + return response.json({ message: 'ShippingMethod deleted successfully' }) }, }) diff --git a/app/Actions/Commerce/ShippingMethodIndexAction.ts b/app/Actions/Commerce/ShippingMethodIndexAction.ts index f5586a311f..f1c8b11dd2 100644 --- a/app/Actions/Commerce/ShippingMethodIndexAction.ts +++ b/app/Actions/Commerce/ShippingMethodIndexAction.ts @@ -1,12 +1,12 @@ import { Action } from '@stacksjs/actions' import { response } from '@stacksjs/router' - +import { shipping } from '@stacksjs/commerce' export default new Action({ name: 'ShippingMethod Index', description: 'ShippingMethod Index ORM Action', method: 'GET', async handle() { - const results = ShippingMethod.all() + const results = await shipping.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/ShippingMethodShowAction.ts b/app/Actions/Commerce/ShippingMethodShowAction.ts index 885c25b733..3c4d67fbe5 100644 --- a/app/Actions/Commerce/ShippingMethodShowAction.ts +++ b/app/Actions/Commerce/ShippingMethodShowAction.ts @@ -1,6 +1,6 @@ import type { ShippingMethodRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { shipping } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -10,7 +10,7 @@ export default new Action({ async handle(request: ShippingMethodRequestType) { const id = request.getParam('id') - const model = await ShippingMethod.findOrFail(id) + const model = await shipping.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/ShippingMethodStoreAction.ts b/app/Actions/Commerce/ShippingMethodStoreAction.ts index 2cd9669ca6..8c9eda859f 100644 --- a/app/Actions/Commerce/ShippingMethodStoreAction.ts +++ b/app/Actions/Commerce/ShippingMethodStoreAction.ts @@ -1,6 +1,6 @@ import type { ShippingMethodRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { shipping } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -8,8 +8,7 @@ export default new Action({ description: 'ShippingMethod Store ORM Action', method: 'POST', async handle(request: ShippingMethodRequestType) { - await request.validate() - const model = await ShippingMethod.create(request.all()) + const model = await shipping.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/ShippingMethodUpdateAction.ts b/app/Actions/Commerce/ShippingMethodUpdateAction.ts index 1d491afb45..35f52e1910 100644 --- a/app/Actions/Commerce/ShippingMethodUpdateAction.ts +++ b/app/Actions/Commerce/ShippingMethodUpdateAction.ts @@ -1,6 +1,6 @@ import type { ShippingMethodRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { shipping } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -11,10 +11,8 @@ export default new Action({ await request.validate() const id = request.getParam('id') - const model = await ShippingMethod.findOrFail(id) - - const result = model.update(request.all()) + const model = await shipping.update(id, request) - return response.json(result) + return response.json(model) }, }) diff --git a/app/Actions/Commerce/ShippingRateDestroyAction.ts b/app/Actions/Commerce/ShippingRateDestroyAction.ts index f9d54ed232..074926456f 100644 --- a/app/Actions/Commerce/ShippingRateDestroyAction.ts +++ b/app/Actions/Commerce/ShippingRateDestroyAction.ts @@ -1,5 +1,7 @@ import type { ShippingRateRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { shipping } from '@stacksjs/commerce' +import { response } from '@stacksjs/router' export default new Action({ name: 'ShippingRate Destroy', @@ -8,10 +10,8 @@ export default new Action({ async handle(request: ShippingRateRequestType) { const id = request.getParam('id') - const model = await ShippingRate.findOrFail(id) + await shipping.destroy(id) - model.delete() - - return 'Model deleted!' + return response.json({ message: 'ShippingRate deleted successfully' }) }, }) diff --git a/app/Actions/Commerce/ShippingRateIndexAction.ts b/app/Actions/Commerce/ShippingRateIndexAction.ts index 1d41016545..b83ac44643 100644 --- a/app/Actions/Commerce/ShippingRateIndexAction.ts +++ b/app/Actions/Commerce/ShippingRateIndexAction.ts @@ -1,5 +1,6 @@ import { Action } from '@stacksjs/actions' import { response } from '@stacksjs/router' +import { shipping } from '@stacksjs/commerce' export default new Action({ name: 'ShippingRate Index', diff --git a/storage/framework/core/commerce/src/index.ts b/storage/framework/core/commerce/src/index.ts index ea975508aa..52258669ce 100644 --- a/storage/framework/core/commerce/src/index.ts +++ b/storage/framework/core/commerce/src/index.ts @@ -2,18 +2,18 @@ import * as coupons from './coupons' import * as customers from './customers' import * as devices from './devices' -import * as digital from './digital' -import * as drivers from './drivers' +import * as digital from './shippings/digital' +import * as drivers from './shippings/drivers' import * as giftCards from './gift-cards' -import * as licenses from './licenses' +import * as licenses from './shippings/licenses' import * as orders from './orders' import * as payments from './payments' import * as products from './products' import * as rates from './rates' import * as receipts from './receipts' import * as restaurant from './restaurant' -import * as deliveryRoutes from './routes' -import * as shipping from './shipping' +import * as deliveryRoutes from './shippings/routes' +import * as shipping from './shippings/shipping' import * as tax from './tax' import * as waitlist from './waitlist' import * as zones from './zones' diff --git a/storage/framework/core/commerce/src/digital/destroy.ts b/storage/framework/core/commerce/src/shippings/digital/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/digital/destroy.ts rename to storage/framework/core/commerce/src/shippings/digital/destroy.ts diff --git a/storage/framework/core/commerce/src/digital/fetch.ts b/storage/framework/core/commerce/src/shippings/digital/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/digital/fetch.ts rename to storage/framework/core/commerce/src/shippings/digital/fetch.ts diff --git a/storage/framework/core/commerce/src/digital/index.ts b/storage/framework/core/commerce/src/shippings/digital/index.ts similarity index 100% rename from storage/framework/core/commerce/src/digital/index.ts rename to storage/framework/core/commerce/src/shippings/digital/index.ts diff --git a/storage/framework/core/commerce/src/digital/store.ts b/storage/framework/core/commerce/src/shippings/digital/store.ts similarity index 100% rename from storage/framework/core/commerce/src/digital/store.ts rename to storage/framework/core/commerce/src/shippings/digital/store.ts diff --git a/storage/framework/core/commerce/src/digital/update.ts b/storage/framework/core/commerce/src/shippings/digital/update.ts similarity index 100% rename from storage/framework/core/commerce/src/digital/update.ts rename to storage/framework/core/commerce/src/shippings/digital/update.ts diff --git a/storage/framework/core/commerce/src/drivers/destroy.ts b/storage/framework/core/commerce/src/shippings/drivers/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/drivers/destroy.ts rename to storage/framework/core/commerce/src/shippings/drivers/destroy.ts diff --git a/storage/framework/core/commerce/src/drivers/fetch.ts b/storage/framework/core/commerce/src/shippings/drivers/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/drivers/fetch.ts rename to storage/framework/core/commerce/src/shippings/drivers/fetch.ts diff --git a/storage/framework/core/commerce/src/drivers/index.ts b/storage/framework/core/commerce/src/shippings/drivers/index.ts similarity index 100% rename from storage/framework/core/commerce/src/drivers/index.ts rename to storage/framework/core/commerce/src/shippings/drivers/index.ts diff --git a/storage/framework/core/commerce/src/drivers/store.ts b/storage/framework/core/commerce/src/shippings/drivers/store.ts similarity index 100% rename from storage/framework/core/commerce/src/drivers/store.ts rename to storage/framework/core/commerce/src/shippings/drivers/store.ts diff --git a/storage/framework/core/commerce/src/drivers/update.ts b/storage/framework/core/commerce/src/shippings/drivers/update.ts similarity index 100% rename from storage/framework/core/commerce/src/drivers/update.ts rename to storage/framework/core/commerce/src/shippings/drivers/update.ts diff --git a/storage/framework/core/commerce/src/licenses/destroy.ts b/storage/framework/core/commerce/src/shippings/licenses/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/licenses/destroy.ts rename to storage/framework/core/commerce/src/shippings/licenses/destroy.ts diff --git a/storage/framework/core/commerce/src/licenses/fetch.ts b/storage/framework/core/commerce/src/shippings/licenses/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/licenses/fetch.ts rename to storage/framework/core/commerce/src/shippings/licenses/fetch.ts diff --git a/storage/framework/core/commerce/src/licenses/index.ts b/storage/framework/core/commerce/src/shippings/licenses/index.ts similarity index 100% rename from storage/framework/core/commerce/src/licenses/index.ts rename to storage/framework/core/commerce/src/shippings/licenses/index.ts diff --git a/storage/framework/core/commerce/src/licenses/store.ts b/storage/framework/core/commerce/src/shippings/licenses/store.ts similarity index 100% rename from storage/framework/core/commerce/src/licenses/store.ts rename to storage/framework/core/commerce/src/shippings/licenses/store.ts diff --git a/storage/framework/core/commerce/src/licenses/update.ts b/storage/framework/core/commerce/src/shippings/licenses/update.ts similarity index 100% rename from storage/framework/core/commerce/src/licenses/update.ts rename to storage/framework/core/commerce/src/shippings/licenses/update.ts diff --git a/storage/framework/core/commerce/src/routes/destroy.ts b/storage/framework/core/commerce/src/shippings/routes/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/routes/destroy.ts rename to storage/framework/core/commerce/src/shippings/routes/destroy.ts diff --git a/storage/framework/core/commerce/src/routes/fetch.ts b/storage/framework/core/commerce/src/shippings/routes/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/routes/fetch.ts rename to storage/framework/core/commerce/src/shippings/routes/fetch.ts diff --git a/storage/framework/core/commerce/src/routes/index.ts b/storage/framework/core/commerce/src/shippings/routes/index.ts similarity index 100% rename from storage/framework/core/commerce/src/routes/index.ts rename to storage/framework/core/commerce/src/shippings/routes/index.ts diff --git a/storage/framework/core/commerce/src/routes/store.ts b/storage/framework/core/commerce/src/shippings/routes/store.ts similarity index 100% rename from storage/framework/core/commerce/src/routes/store.ts rename to storage/framework/core/commerce/src/shippings/routes/store.ts diff --git a/storage/framework/core/commerce/src/routes/update.ts b/storage/framework/core/commerce/src/shippings/routes/update.ts similarity index 100% rename from storage/framework/core/commerce/src/routes/update.ts rename to storage/framework/core/commerce/src/shippings/routes/update.ts diff --git a/storage/framework/core/commerce/src/shipping/destroy.ts b/storage/framework/core/commerce/src/shippings/shipping/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/shipping/destroy.ts rename to storage/framework/core/commerce/src/shippings/shipping/destroy.ts diff --git a/storage/framework/core/commerce/src/shipping/fetch.ts b/storage/framework/core/commerce/src/shippings/shipping/fetch.ts similarity index 65% rename from storage/framework/core/commerce/src/shipping/fetch.ts rename to storage/framework/core/commerce/src/shippings/shipping/fetch.ts index 0550813768..c263ec1cdd 100644 --- a/storage/framework/core/commerce/src/shipping/fetch.ts +++ b/storage/framework/core/commerce/src/shippings/shipping/fetch.ts @@ -11,3 +11,11 @@ export async function fetchById(id: number): Promise { + return await db.selectFrom('shipping_methods').selectAll().execute() +} + \ No newline at end of file diff --git a/storage/framework/core/commerce/src/shipping/index.ts b/storage/framework/core/commerce/src/shippings/shipping/index.ts similarity index 97% rename from storage/framework/core/commerce/src/shipping/index.ts rename to storage/framework/core/commerce/src/shippings/shipping/index.ts index 8ecf896d87..b211c472e7 100644 --- a/storage/framework/core/commerce/src/shipping/index.ts +++ b/storage/framework/core/commerce/src/shippings/shipping/index.ts @@ -9,6 +9,7 @@ export { // Functions from fetch.ts export { fetchById, + fetchAll, } from './fetch' // Functions from store.ts diff --git a/storage/framework/core/commerce/src/shipping/store.ts b/storage/framework/core/commerce/src/shippings/shipping/store.ts similarity index 100% rename from storage/framework/core/commerce/src/shipping/store.ts rename to storage/framework/core/commerce/src/shippings/shipping/store.ts diff --git a/storage/framework/core/commerce/src/shipping/update.ts b/storage/framework/core/commerce/src/shippings/shipping/update.ts similarity index 100% rename from storage/framework/core/commerce/src/shipping/update.ts rename to storage/framework/core/commerce/src/shippings/shipping/update.ts diff --git a/storage/framework/core/commerce/src/zones/destroy.ts b/storage/framework/core/commerce/src/shippings/zones/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/zones/destroy.ts rename to storage/framework/core/commerce/src/shippings/zones/destroy.ts diff --git a/storage/framework/core/commerce/src/zones/fetch.ts b/storage/framework/core/commerce/src/shippings/zones/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/zones/fetch.ts rename to storage/framework/core/commerce/src/shippings/zones/fetch.ts diff --git a/storage/framework/core/commerce/src/zones/index.ts b/storage/framework/core/commerce/src/shippings/zones/index.ts similarity index 100% rename from storage/framework/core/commerce/src/zones/index.ts rename to storage/framework/core/commerce/src/shippings/zones/index.ts diff --git a/storage/framework/core/commerce/src/zones/store.ts b/storage/framework/core/commerce/src/shippings/zones/store.ts similarity index 100% rename from storage/framework/core/commerce/src/zones/store.ts rename to storage/framework/core/commerce/src/shippings/zones/store.ts diff --git a/storage/framework/core/commerce/src/zones/update.ts b/storage/framework/core/commerce/src/shippings/zones/update.ts similarity index 100% rename from storage/framework/core/commerce/src/zones/update.ts rename to storage/framework/core/commerce/src/shippings/zones/update.ts diff --git a/storage/framework/core/commerce/src/tests/digitals.test.ts b/storage/framework/core/commerce/src/tests/digitals.test.ts index 9d4f1c20c0..4fc06344c7 100644 --- a/storage/framework/core/commerce/src/tests/digitals.test.ts +++ b/storage/framework/core/commerce/src/tests/digitals.test.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, bulkSoftDelete, destroy, softDelete } from '../digital/destroy' -import { fetchAll, fetchById } from '../digital/fetch' -import { bulkStore, store } from '../digital/store' -import { update, updateDeliverySettings, updateStatus } from '../digital/update' +import { bulkDestroy, bulkSoftDelete, destroy, softDelete } from '../shippings/digital/destroy' +import { fetchAll, fetchById } from '../shippings/digital/fetch' +import { bulkStore, store } from '../shippings/digital/store' +import { update, updateDeliverySettings, updateStatus } from '../shippings/digital/update' // Create a request-like object for testing class TestRequest { diff --git a/storage/framework/core/commerce/src/tests/drivers.test.ts b/storage/framework/core/commerce/src/tests/drivers.test.ts index 8ddd43ea0a..d1fa340ff7 100644 --- a/storage/framework/core/commerce/src/tests/drivers.test.ts +++ b/storage/framework/core/commerce/src/tests/drivers.test.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, destroy } from '../drivers/destroy' -import { fetchAll, fetchById } from '../drivers/fetch' -import { bulkStore, store } from '../drivers/store' -import { update, updateContact, updateStatus } from '../drivers/update' +import { bulkDestroy, destroy } from '../shippings/drivers/destroy' +import { fetchAll, fetchById } from '../shippings/drivers/fetch' +import { bulkStore, store } from '../shippings/drivers/store' +import { update, updateContact, updateStatus } from '../shippings/drivers/update' // Create a request-like object for testing class TestRequest { diff --git a/storage/framework/core/commerce/src/tests/license.test.ts b/storage/framework/core/commerce/src/tests/license.test.ts index 8d2aa8d49f..425de8b9d2 100644 --- a/storage/framework/core/commerce/src/tests/license.test.ts +++ b/storage/framework/core/commerce/src/tests/license.test.ts @@ -1,10 +1,10 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { formatDate } from '@stacksjs/orm' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, bulkSoftDelete, destroy, softDelete } from '../licenses/destroy' -import { fetchAll, fetchById } from '../licenses/fetch' -import { bulkStore, store } from '../licenses/store' -import { update, updateExpiration, updateStatus } from '../licenses/update' +import { bulkDestroy, bulkSoftDelete, destroy, softDelete } from '../shippings/licenses/destroy' +import { fetchAll, fetchById } from '../shippings/licenses/fetch' +import { bulkStore, store } from '../shippings/licenses/store' +import { update, updateExpiration, updateStatus } from '../shippings/licenses/update' // Create a request-like object for testing class TestRequest { diff --git a/storage/framework/core/commerce/src/tests/routes.test.ts b/storage/framework/core/commerce/src/tests/routes.test.ts index 0b46b6340a..0ba8c25078 100644 --- a/storage/framework/core/commerce/src/tests/routes.test.ts +++ b/storage/framework/core/commerce/src/tests/routes.test.ts @@ -1,10 +1,10 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { formatDate } from '@stacksjs/orm' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, destroy } from '../routes/destroy' -import { fetchByDriver, fetchById } from '../routes/fetch' -import { store } from '../routes/store' -import { update, updateMetrics, updateStops } from '../routes/update' +import { bulkDestroy, destroy } from '../shippings/routes/destroy' +import { fetchByDriver, fetchById } from '../shippings/routes/fetch' +import { store } from '../shippings/routes/store' +import { update, updateMetrics, updateStops } from '../shippings/routes/update' // Create a request-like object for testing class TestRequest { diff --git a/storage/framework/core/commerce/src/tests/shipping.test.ts b/storage/framework/core/commerce/src/tests/shipping.test.ts index beb568dba3..728358963a 100644 --- a/storage/framework/core/commerce/src/tests/shipping.test.ts +++ b/storage/framework/core/commerce/src/tests/shipping.test.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, bulkSoftDelete, destroy, softDelete } from '../shipping/destroy' -import { fetchById } from '../shipping/fetch' -import { bulkStore, formatShippingOptions, getActiveShippingMethods, store } from '../shipping/store' -import { update, updatePricing, updateStatus } from '../shipping/update' +import { bulkDestroy, bulkSoftDelete, destroy, softDelete } from '../shippings/shipping/destroy' +import { fetchById } from '../shippings/shipping/fetch' +import { bulkStore, formatShippingOptions, getActiveShippingMethods, store } from '../shippings/shipping/store' +import { update, updatePricing, updateStatus } from '../shippings/shipping/update' // Create a request-like object for testing class TestRequest { From f378bf4dbfc0d290457bd80fe6f30a0a17cb0aaf Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Wed, 2 Apr 2025 21:58:19 +0800 Subject: [PATCH 55/78] chore: wip --- .../Commerce/ShippingMethodIndexAction.ts | 3 +- .../Commerce/ShippingRateIndexAction.ts | 1 - storage/framework/core/commerce/src/index.ts | 41 ++++--------------- .../core/commerce/src/shippings/index.ts | 35 ++++++++++++++++ .../{shipping => methods}/destroy.ts | 0 .../shippings/{shipping => methods}/fetch.ts | 1 - .../shippings/{shipping => methods}/index.ts | 2 +- .../shippings/{shipping => methods}/store.ts | 0 .../shippings/{shipping => methods}/update.ts | 0 .../core/commerce/src/tests/shipping.test.ts | 8 ++-- 10 files changed, 50 insertions(+), 41 deletions(-) create mode 100644 storage/framework/core/commerce/src/shippings/index.ts rename storage/framework/core/commerce/src/shippings/{shipping => methods}/destroy.ts (100%) rename storage/framework/core/commerce/src/shippings/{shipping => methods}/fetch.ts (99%) rename storage/framework/core/commerce/src/shippings/{shipping => methods}/index.ts (100%) rename storage/framework/core/commerce/src/shippings/{shipping => methods}/store.ts (100%) rename storage/framework/core/commerce/src/shippings/{shipping => methods}/update.ts (100%) diff --git a/app/Actions/Commerce/ShippingMethodIndexAction.ts b/app/Actions/Commerce/ShippingMethodIndexAction.ts index f1c8b11dd2..323e611617 100644 --- a/app/Actions/Commerce/ShippingMethodIndexAction.ts +++ b/app/Actions/Commerce/ShippingMethodIndexAction.ts @@ -1,6 +1,7 @@ import { Action } from '@stacksjs/actions' -import { response } from '@stacksjs/router' import { shipping } from '@stacksjs/commerce' +import { response } from '@stacksjs/router' + export default new Action({ name: 'ShippingMethod Index', description: 'ShippingMethod Index ORM Action', diff --git a/app/Actions/Commerce/ShippingRateIndexAction.ts b/app/Actions/Commerce/ShippingRateIndexAction.ts index b83ac44643..1d41016545 100644 --- a/app/Actions/Commerce/ShippingRateIndexAction.ts +++ b/app/Actions/Commerce/ShippingRateIndexAction.ts @@ -1,6 +1,5 @@ import { Action } from '@stacksjs/actions' import { response } from '@stacksjs/router' -import { shipping } from '@stacksjs/commerce' export default new Action({ name: 'ShippingRate Index', diff --git a/storage/framework/core/commerce/src/index.ts b/storage/framework/core/commerce/src/index.ts index 52258669ce..539be6cc30 100644 --- a/storage/framework/core/commerce/src/index.ts +++ b/storage/framework/core/commerce/src/index.ts @@ -2,37 +2,27 @@ import * as coupons from './coupons' import * as customers from './customers' import * as devices from './devices' -import * as digital from './shippings/digital' -import * as drivers from './shippings/drivers' import * as giftCards from './gift-cards' -import * as licenses from './shippings/licenses' import * as orders from './orders' import * as payments from './payments' import * as products from './products' import * as rates from './rates' import * as receipts from './receipts' import * as restaurant from './restaurant' -import * as deliveryRoutes from './shippings/routes' -import * as shipping from './shippings/shipping' +import * as shippings from './shippings' import * as tax from './tax' import * as waitlist from './waitlist' -import * as zones from './zones' type CouponsModule = typeof coupons type CustomersModule = typeof customers +type ShippingsModule = typeof shippings type GiftCardsModule = typeof giftCards type OrdersModule = typeof orders type PaymentsModule = typeof payments type ProductsModule = typeof products type RestaurantModule = typeof restaurant -type ShippingModule = typeof shipping type RatesModule = typeof rates -type ZonesModule = typeof zones -type DriversModule = typeof drivers -type LicensesModule = typeof licenses -type DigitalModule = typeof digital type TaxModule = typeof tax -type DeliveryRoutesModule = typeof deliveryRoutes type WaitlistModule = typeof waitlist type DevicesModule = typeof devices type ReceiptsModule = typeof receipts @@ -42,16 +32,11 @@ export interface EcommerceNamespace { customers: CustomersModule giftCards: GiftCardsModule orders: OrdersModule - drivers: DriversModule payments: PaymentsModule products: ProductsModule restaurant: RestaurantModule - shipping: ShippingModule rates: RatesModule - zones: ZonesModule - deliveryRoutes: DeliveryRoutesModule - licenses: LicensesModule - digital: DigitalModule + shippings: ShippingsModule tax: TaxModule waitlist: WaitlistModule devices: DevicesModule @@ -61,22 +46,17 @@ export interface EcommerceNamespace { export const ecommerce: EcommerceNamespace = { coupons, customers, + devices, giftCards, - drivers, orders, payments, products, - restaurant, - shipping, - deliveryRoutes, rates, - zones, - licenses, - digital, - devices, + receipts, + restaurant, + shippings, tax, waitlist, - receipts, } export default ecommerce @@ -84,20 +64,15 @@ export default ecommerce export { coupons, customers, - deliveryRoutes, devices, - digital, - drivers, giftCards, - licenses, orders, payments, products, rates, receipts, restaurant, - shipping, + shippings, tax, waitlist, - zones, } diff --git a/storage/framework/core/commerce/src/shippings/index.ts b/storage/framework/core/commerce/src/shippings/index.ts new file mode 100644 index 0000000000..0953f6cf0a --- /dev/null +++ b/storage/framework/core/commerce/src/shippings/index.ts @@ -0,0 +1,35 @@ +import * as digital from './digital' +import * as drivers from './drivers' +import * as licenses from './licenses' +import * as methods from './methods' +import * as routes from './routes' +import * as zones from './zones' + +export { + digital, + drivers, + licenses, + methods, + routes, + zones, +} + +interface ShippingsNamespace { + digital: typeof digital + drivers: typeof drivers + licenses: typeof licenses + methods: typeof methods + routes: typeof routes + zones: typeof zones +} + +const shippings: ShippingsNamespace = { + digital, + drivers, + licenses, + methods, + routes, + zones, +} + +export default shippings diff --git a/storage/framework/core/commerce/src/shippings/shipping/destroy.ts b/storage/framework/core/commerce/src/shippings/methods/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/shipping/destroy.ts rename to storage/framework/core/commerce/src/shippings/methods/destroy.ts diff --git a/storage/framework/core/commerce/src/shippings/shipping/fetch.ts b/storage/framework/core/commerce/src/shippings/methods/fetch.ts similarity index 99% rename from storage/framework/core/commerce/src/shippings/shipping/fetch.ts rename to storage/framework/core/commerce/src/shippings/methods/fetch.ts index c263ec1cdd..a8926edc5c 100644 --- a/storage/framework/core/commerce/src/shippings/shipping/fetch.ts +++ b/storage/framework/core/commerce/src/shippings/methods/fetch.ts @@ -18,4 +18,3 @@ export async function fetchById(id: number): Promise { return await db.selectFrom('shipping_methods').selectAll().execute() } - \ No newline at end of file diff --git a/storage/framework/core/commerce/src/shippings/shipping/index.ts b/storage/framework/core/commerce/src/shippings/methods/index.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/shipping/index.ts rename to storage/framework/core/commerce/src/shippings/methods/index.ts index b211c472e7..65140f6ca1 100644 --- a/storage/framework/core/commerce/src/shippings/shipping/index.ts +++ b/storage/framework/core/commerce/src/shippings/methods/index.ts @@ -8,8 +8,8 @@ export { // Functions from fetch.ts export { - fetchById, fetchAll, + fetchById, } from './fetch' // Functions from store.ts diff --git a/storage/framework/core/commerce/src/shippings/shipping/store.ts b/storage/framework/core/commerce/src/shippings/methods/store.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/shipping/store.ts rename to storage/framework/core/commerce/src/shippings/methods/store.ts diff --git a/storage/framework/core/commerce/src/shippings/shipping/update.ts b/storage/framework/core/commerce/src/shippings/methods/update.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/shipping/update.ts rename to storage/framework/core/commerce/src/shippings/methods/update.ts diff --git a/storage/framework/core/commerce/src/tests/shipping.test.ts b/storage/framework/core/commerce/src/tests/shipping.test.ts index 728358963a..070e74a6df 100644 --- a/storage/framework/core/commerce/src/tests/shipping.test.ts +++ b/storage/framework/core/commerce/src/tests/shipping.test.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, bulkSoftDelete, destroy, softDelete } from '../shippings/shipping/destroy' -import { fetchById } from '../shippings/shipping/fetch' -import { bulkStore, formatShippingOptions, getActiveShippingMethods, store } from '../shippings/shipping/store' -import { update, updatePricing, updateStatus } from '../shippings/shipping/update' +import { bulkDestroy, bulkSoftDelete, destroy, softDelete } from '../shippings/methods/destroy' +import { fetchById } from '../shippings/methods/fetch' +import { bulkStore, formatShippingOptions, getActiveShippingMethods, store } from '../shippings/methods/store' +import { update, updatePricing, updateStatus } from '../shippings/methods/update' // Create a request-like object for testing class TestRequest { From c09fed38d40248866b78461cb9bf561789388314 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Wed, 2 Apr 2025 22:22:21 +0800 Subject: [PATCH 56/78] chore: wip --- app/Actions/Commerce/ShippingMethodDestroyAction.ts | 4 ++-- app/Actions/Commerce/ShippingMethodIndexAction.ts | 4 ++-- app/Actions/Commerce/ShippingMethodShowAction.ts | 4 ++-- app/Actions/Commerce/ShippingMethodStoreAction.ts | 4 ++-- app/Actions/Commerce/ShippingMethodUpdateAction.ts | 4 ++-- app/Actions/Commerce/ShippingRateDestroyAction.ts | 4 ++-- app/Actions/Commerce/ShippingRateShowAction.ts | 4 ++-- app/Actions/Commerce/ShippingRateStoreAction.ts | 5 ++--- app/Actions/Commerce/ShippingRateUpdateAction.ts | 8 +++----- app/Actions/Commerce/ShippingZoneDestroyAction.ts | 8 ++++---- app/Actions/Commerce/ShippingZoneIndexAction.ts | 3 ++- app/Actions/Commerce/ShippingZoneShowAction.ts | 4 ++-- app/Actions/Commerce/ShippingZoneStoreAction.ts | 5 ++--- app/Actions/Commerce/ShippingZoneUpdateAction.ts | 8 +++----- app/Actions/Commerce/TaxRateDestroyAction.ts | 8 ++++---- app/Actions/Commerce/TaxRateIndexAction.ts | 3 ++- app/Actions/Commerce/TaxRateShowAction.ts | 4 ++-- app/Actions/Commerce/TaxRateStoreAction.ts | 5 ++--- app/Actions/Commerce/TaxRateUpdateAction.ts | 10 +++------- storage/framework/core/commerce/src/index.ts | 5 ----- storage/framework/core/commerce/src/shippings/index.ts | 4 ++++ .../core/commerce/src/{ => shippings}/rates/destroy.ts | 0 .../core/commerce/src/{ => shippings}/rates/fetch.ts | 7 +++++++ .../core/commerce/src/{ => shippings}/rates/index.ts | 0 .../core/commerce/src/{ => shippings}/rates/store.ts | 0 .../core/commerce/src/{ => shippings}/rates/update.ts | 0 .../core/commerce/src/shippings/zones/fetch.ts | 9 ++++++++- .../core/commerce/src/shippings/zones/index.ts | 1 + .../framework/core/commerce/src/tests/rates.test.ts | 8 ++++---- 29 files changed, 69 insertions(+), 64 deletions(-) rename storage/framework/core/commerce/src/{ => shippings}/rates/destroy.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/rates/fetch.ts (94%) rename storage/framework/core/commerce/src/{ => shippings}/rates/index.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/rates/store.ts (100%) rename storage/framework/core/commerce/src/{ => shippings}/rates/update.ts (100%) diff --git a/app/Actions/Commerce/ShippingMethodDestroyAction.ts b/app/Actions/Commerce/ShippingMethodDestroyAction.ts index 92ceedb0eb..f6624c40a8 100644 --- a/app/Actions/Commerce/ShippingMethodDestroyAction.ts +++ b/app/Actions/Commerce/ShippingMethodDestroyAction.ts @@ -1,6 +1,6 @@ import type { ShippingMethodRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { shipping } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -10,7 +10,7 @@ export default new Action({ async handle(request: ShippingMethodRequestType) { const id = request.getParam('id') - await shipping.destroy(id) + await shippings.methods.destroy(id) return response.json({ message: 'ShippingMethod deleted successfully' }) }, diff --git a/app/Actions/Commerce/ShippingMethodIndexAction.ts b/app/Actions/Commerce/ShippingMethodIndexAction.ts index 323e611617..068e1bf42c 100644 --- a/app/Actions/Commerce/ShippingMethodIndexAction.ts +++ b/app/Actions/Commerce/ShippingMethodIndexAction.ts @@ -1,5 +1,5 @@ import { Action } from '@stacksjs/actions' -import { shipping } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -7,7 +7,7 @@ export default new Action({ description: 'ShippingMethod Index ORM Action', method: 'GET', async handle() { - const results = await shipping.fetchAll() + const results = await shippings.methods.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/ShippingMethodShowAction.ts b/app/Actions/Commerce/ShippingMethodShowAction.ts index 3c4d67fbe5..5086aa4a3e 100644 --- a/app/Actions/Commerce/ShippingMethodShowAction.ts +++ b/app/Actions/Commerce/ShippingMethodShowAction.ts @@ -1,6 +1,6 @@ import type { ShippingMethodRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { shipping } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -10,7 +10,7 @@ export default new Action({ async handle(request: ShippingMethodRequestType) { const id = request.getParam('id') - const model = await shipping.fetchById(id) + const model = await shippings.methods.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/ShippingMethodStoreAction.ts b/app/Actions/Commerce/ShippingMethodStoreAction.ts index 8c9eda859f..dea07d82e9 100644 --- a/app/Actions/Commerce/ShippingMethodStoreAction.ts +++ b/app/Actions/Commerce/ShippingMethodStoreAction.ts @@ -1,6 +1,6 @@ import type { ShippingMethodRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { shipping } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -8,7 +8,7 @@ export default new Action({ description: 'ShippingMethod Store ORM Action', method: 'POST', async handle(request: ShippingMethodRequestType) { - const model = await shipping.store(request) + const model = await shippings.methods.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/ShippingMethodUpdateAction.ts b/app/Actions/Commerce/ShippingMethodUpdateAction.ts index 35f52e1910..c36384c863 100644 --- a/app/Actions/Commerce/ShippingMethodUpdateAction.ts +++ b/app/Actions/Commerce/ShippingMethodUpdateAction.ts @@ -1,6 +1,6 @@ import type { ShippingMethodRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { shipping } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -11,7 +11,7 @@ export default new Action({ await request.validate() const id = request.getParam('id') - const model = await shipping.update(id, request) + const model = await shippings.methods.update(id, request) return response.json(model) }, diff --git a/app/Actions/Commerce/ShippingRateDestroyAction.ts b/app/Actions/Commerce/ShippingRateDestroyAction.ts index 074926456f..578f75faaf 100644 --- a/app/Actions/Commerce/ShippingRateDestroyAction.ts +++ b/app/Actions/Commerce/ShippingRateDestroyAction.ts @@ -1,6 +1,6 @@ import type { ShippingRateRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { shipping } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -10,7 +10,7 @@ export default new Action({ async handle(request: ShippingRateRequestType) { const id = request.getParam('id') - await shipping.destroy(id) + await shippings.rates.destroy(id) return response.json({ message: 'ShippingRate deleted successfully' }) }, diff --git a/app/Actions/Commerce/ShippingRateShowAction.ts b/app/Actions/Commerce/ShippingRateShowAction.ts index 6252308fa0..0cd86f4971 100644 --- a/app/Actions/Commerce/ShippingRateShowAction.ts +++ b/app/Actions/Commerce/ShippingRateShowAction.ts @@ -1,6 +1,6 @@ import type { ShippingRateRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -10,7 +10,7 @@ export default new Action({ async handle(request: ShippingRateRequestType) { const id = request.getParam('id') - const model = await ShippingRate.findOrFail(id) + const model = await shippings.rates.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/ShippingRateStoreAction.ts b/app/Actions/Commerce/ShippingRateStoreAction.ts index 7733f825b0..d8b6bb3f0e 100644 --- a/app/Actions/Commerce/ShippingRateStoreAction.ts +++ b/app/Actions/Commerce/ShippingRateStoreAction.ts @@ -1,6 +1,6 @@ import type { ShippingRateRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -8,8 +8,7 @@ export default new Action({ description: 'ShippingRate Store ORM Action', method: 'POST', async handle(request: ShippingRateRequestType) { - await request.validate() - const model = await ShippingRate.create(request.all()) + const model = await shippings.rates.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/ShippingRateUpdateAction.ts b/app/Actions/Commerce/ShippingRateUpdateAction.ts index b6049a4587..8512d7a815 100644 --- a/app/Actions/Commerce/ShippingRateUpdateAction.ts +++ b/app/Actions/Commerce/ShippingRateUpdateAction.ts @@ -1,6 +1,7 @@ import type { ShippingRateRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -8,13 +9,10 @@ export default new Action({ description: 'ShippingRate Update ORM Action', method: 'PATCH', async handle(request: ShippingRateRequestType) { - await request.validate() - const id = request.getParam('id') - const model = await ShippingRate.findOrFail(id) - const result = model.update(request.all()) + const model = await shippings.rates.update(id, request) - return response.json(result) + return response.json(model) }, }) diff --git a/app/Actions/Commerce/ShippingZoneDestroyAction.ts b/app/Actions/Commerce/ShippingZoneDestroyAction.ts index a809529465..c45a27b0ca 100644 --- a/app/Actions/Commerce/ShippingZoneDestroyAction.ts +++ b/app/Actions/Commerce/ShippingZoneDestroyAction.ts @@ -1,5 +1,7 @@ import type { ShippingZoneRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { shippings } from '@stacksjs/commerce' +import { response } from '@stacksjs/router' export default new Action({ name: 'ShippingZone Destroy', @@ -8,10 +10,8 @@ export default new Action({ async handle(request: ShippingZoneRequestType) { const id = request.getParam('id') - const model = await ShippingZone.findOrFail(id) + await shippings.zones.destroy(id) - model.delete() - - return 'Model deleted!' + return response.json({ message: 'ShippingZone deleted successfully' }) }, }) diff --git a/app/Actions/Commerce/ShippingZoneIndexAction.ts b/app/Actions/Commerce/ShippingZoneIndexAction.ts index 61b970897f..d0d62b551e 100644 --- a/app/Actions/Commerce/ShippingZoneIndexAction.ts +++ b/app/Actions/Commerce/ShippingZoneIndexAction.ts @@ -1,4 +1,5 @@ import { Action } from '@stacksjs/actions' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -6,7 +7,7 @@ export default new Action({ description: 'ShippingZone Index ORM Action', method: 'GET', async handle() { - const results = ShippingZone.all() + const results = shippings.zones.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/ShippingZoneShowAction.ts b/app/Actions/Commerce/ShippingZoneShowAction.ts index bcb0df3cc2..1b384e3213 100644 --- a/app/Actions/Commerce/ShippingZoneShowAction.ts +++ b/app/Actions/Commerce/ShippingZoneShowAction.ts @@ -1,6 +1,6 @@ import type { ShippingZoneRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -10,7 +10,7 @@ export default new Action({ async handle(request: ShippingZoneRequestType) { const id = request.getParam('id') - const model = await ShippingZone.findOrFail(id) + const model = await shippings.zones.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/ShippingZoneStoreAction.ts b/app/Actions/Commerce/ShippingZoneStoreAction.ts index 0877e785d5..e3327bab62 100644 --- a/app/Actions/Commerce/ShippingZoneStoreAction.ts +++ b/app/Actions/Commerce/ShippingZoneStoreAction.ts @@ -1,6 +1,6 @@ import type { ShippingZoneRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -8,8 +8,7 @@ export default new Action({ description: 'ShippingZone Store ORM Action', method: 'POST', async handle(request: ShippingZoneRequestType) { - await request.validate() - const model = await ShippingZone.create(request.all()) + const model = await shippings.zones.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/ShippingZoneUpdateAction.ts b/app/Actions/Commerce/ShippingZoneUpdateAction.ts index 0c3f1c70ca..7b144476d0 100644 --- a/app/Actions/Commerce/ShippingZoneUpdateAction.ts +++ b/app/Actions/Commerce/ShippingZoneUpdateAction.ts @@ -1,6 +1,6 @@ import type { ShippingZoneRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -11,10 +11,8 @@ export default new Action({ await request.validate() const id = request.getParam('id') - const model = await ShippingZone.findOrFail(id) - - const result = model.update(request.all()) + const model = await shippings.zones.update(id, request) - return response.json(result) + return response.json(model) }, }) diff --git a/app/Actions/Commerce/TaxRateDestroyAction.ts b/app/Actions/Commerce/TaxRateDestroyAction.ts index d13a0322d8..2bb826fd75 100644 --- a/app/Actions/Commerce/TaxRateDestroyAction.ts +++ b/app/Actions/Commerce/TaxRateDestroyAction.ts @@ -1,5 +1,7 @@ import type { TaxRateRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' +import { tax } from '@stacksjs/commerce' +import { response } from '@stacksjs/router' export default new Action({ name: 'TaxRate Destroy', @@ -8,10 +10,8 @@ export default new Action({ async handle(request: TaxRateRequestType) { const id = request.getParam('id') - const model = await TaxRate.findOrFail(id) + await tax.destroy(id) - model.delete() - - return 'Model deleted!' + return response.json({ message: 'TaxRate deleted successfully' }) }, }) diff --git a/app/Actions/Commerce/TaxRateIndexAction.ts b/app/Actions/Commerce/TaxRateIndexAction.ts index 031a9bcd84..e7747b99da 100644 --- a/app/Actions/Commerce/TaxRateIndexAction.ts +++ b/app/Actions/Commerce/TaxRateIndexAction.ts @@ -1,4 +1,5 @@ import { Action } from '@stacksjs/actions' +import { tax } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -6,7 +7,7 @@ export default new Action({ description: 'TaxRate Index ORM Action', method: 'GET', async handle() { - const results = TaxRate.all() + const results = tax.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/TaxRateShowAction.ts b/app/Actions/Commerce/TaxRateShowAction.ts index 1ca4409346..5a134f3e5b 100644 --- a/app/Actions/Commerce/TaxRateShowAction.ts +++ b/app/Actions/Commerce/TaxRateShowAction.ts @@ -1,6 +1,6 @@ import type { TaxRateRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { TaxRate } from '@stacksjs/orm' +import { tax } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -11,7 +11,7 @@ export default new Action({ async handle(request: TaxRateRequestType) { const id = request.getParam('id') - const model = await TaxRate.findOrFail(id) + const model = await tax.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/TaxRateStoreAction.ts b/app/Actions/Commerce/TaxRateStoreAction.ts index d86921be3b..b08a5199da 100644 --- a/app/Actions/Commerce/TaxRateStoreAction.ts +++ b/app/Actions/Commerce/TaxRateStoreAction.ts @@ -1,6 +1,6 @@ import type { TaxRateRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { tax } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -8,8 +8,7 @@ export default new Action({ description: 'TaxRate Store ORM Action', method: 'POST', async handle(request: TaxRateRequestType) { - await request.validate() - const model = await TaxRate.create(request.all()) + const model = await tax.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/TaxRateUpdateAction.ts b/app/Actions/Commerce/TaxRateUpdateAction.ts index 738efe7719..ccbabb48e3 100644 --- a/app/Actions/Commerce/TaxRateUpdateAction.ts +++ b/app/Actions/Commerce/TaxRateUpdateAction.ts @@ -1,6 +1,6 @@ import type { TaxRateRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - +import { tax } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -8,13 +8,9 @@ export default new Action({ description: 'TaxRate Update ORM Action', method: 'PATCH', async handle(request: TaxRateRequestType) { - await request.validate() - const id = request.getParam('id') - const model = await TaxRate.findOrFail(id) - - const result = model.update(request.all()) + const model = await tax.update(id, request) - return response.json(result) + return response.json(model) }, }) diff --git a/storage/framework/core/commerce/src/index.ts b/storage/framework/core/commerce/src/index.ts index 539be6cc30..4afc484ea2 100644 --- a/storage/framework/core/commerce/src/index.ts +++ b/storage/framework/core/commerce/src/index.ts @@ -6,7 +6,6 @@ import * as giftCards from './gift-cards' import * as orders from './orders' import * as payments from './payments' import * as products from './products' -import * as rates from './rates' import * as receipts from './receipts' import * as restaurant from './restaurant' import * as shippings from './shippings' @@ -21,7 +20,6 @@ type OrdersModule = typeof orders type PaymentsModule = typeof payments type ProductsModule = typeof products type RestaurantModule = typeof restaurant -type RatesModule = typeof rates type TaxModule = typeof tax type WaitlistModule = typeof waitlist type DevicesModule = typeof devices @@ -35,7 +33,6 @@ export interface EcommerceNamespace { payments: PaymentsModule products: ProductsModule restaurant: RestaurantModule - rates: RatesModule shippings: ShippingsModule tax: TaxModule waitlist: WaitlistModule @@ -51,7 +48,6 @@ export const ecommerce: EcommerceNamespace = { orders, payments, products, - rates, receipts, restaurant, shippings, @@ -69,7 +65,6 @@ export { orders, payments, products, - rates, receipts, restaurant, shippings, diff --git a/storage/framework/core/commerce/src/shippings/index.ts b/storage/framework/core/commerce/src/shippings/index.ts index 0953f6cf0a..ef7531c352 100644 --- a/storage/framework/core/commerce/src/shippings/index.ts +++ b/storage/framework/core/commerce/src/shippings/index.ts @@ -2,6 +2,7 @@ import * as digital from './digital' import * as drivers from './drivers' import * as licenses from './licenses' import * as methods from './methods' +import * as rates from './rates' import * as routes from './routes' import * as zones from './zones' @@ -10,6 +11,7 @@ export { drivers, licenses, methods, + rates, routes, zones, } @@ -19,6 +21,7 @@ interface ShippingsNamespace { drivers: typeof drivers licenses: typeof licenses methods: typeof methods + rates: typeof rates routes: typeof routes zones: typeof zones } @@ -28,6 +31,7 @@ const shippings: ShippingsNamespace = { drivers, licenses, methods, + rates, routes, zones, } diff --git a/storage/framework/core/commerce/src/rates/destroy.ts b/storage/framework/core/commerce/src/shippings/rates/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/rates/destroy.ts rename to storage/framework/core/commerce/src/shippings/rates/destroy.ts diff --git a/storage/framework/core/commerce/src/rates/fetch.ts b/storage/framework/core/commerce/src/shippings/rates/fetch.ts similarity index 94% rename from storage/framework/core/commerce/src/rates/fetch.ts rename to storage/framework/core/commerce/src/shippings/rates/fetch.ts index 694fc51dda..86a19e3ede 100644 --- a/storage/framework/core/commerce/src/rates/fetch.ts +++ b/storage/framework/core/commerce/src/shippings/rates/fetch.ts @@ -12,6 +12,13 @@ export async function fetchById(id: number): Promise { + return await db.selectFrom('shipping_rates').selectAll().execute() +} + /** * Get shipping rates by zone * diff --git a/storage/framework/core/commerce/src/rates/index.ts b/storage/framework/core/commerce/src/shippings/rates/index.ts similarity index 100% rename from storage/framework/core/commerce/src/rates/index.ts rename to storage/framework/core/commerce/src/shippings/rates/index.ts diff --git a/storage/framework/core/commerce/src/rates/store.ts b/storage/framework/core/commerce/src/shippings/rates/store.ts similarity index 100% rename from storage/framework/core/commerce/src/rates/store.ts rename to storage/framework/core/commerce/src/shippings/rates/store.ts diff --git a/storage/framework/core/commerce/src/rates/update.ts b/storage/framework/core/commerce/src/shippings/rates/update.ts similarity index 100% rename from storage/framework/core/commerce/src/rates/update.ts rename to storage/framework/core/commerce/src/shippings/rates/update.ts diff --git a/storage/framework/core/commerce/src/shippings/zones/fetch.ts b/storage/framework/core/commerce/src/shippings/zones/fetch.ts index 3d4e996850..009b254870 100644 --- a/storage/framework/core/commerce/src/shippings/zones/fetch.ts +++ b/storage/framework/core/commerce/src/shippings/zones/fetch.ts @@ -1,6 +1,13 @@ -import type { ShippingZoneJsonResponse } from '../../../../orm/src/models/ShippingZone' +import type { ShippingZoneJsonResponse } from '@stacksjs/orm' import { db } from '@stacksjs/database' +/** + * Fetch all shipping zones + */ +export async function fetchAll(): Promise { + return await db.selectFrom('shipping_zones').selectAll().execute() +} + /** * Fetch a shipping zone by ID */ diff --git a/storage/framework/core/commerce/src/shippings/zones/index.ts b/storage/framework/core/commerce/src/shippings/zones/index.ts index 91336373b1..a5dd4c30fd 100644 --- a/storage/framework/core/commerce/src/shippings/zones/index.ts +++ b/storage/framework/core/commerce/src/shippings/zones/index.ts @@ -6,6 +6,7 @@ export { } from './destroy' export { + fetchAll, fetchById, formatZoneOptions, getActiveShippingZones, diff --git a/storage/framework/core/commerce/src/tests/rates.test.ts b/storage/framework/core/commerce/src/tests/rates.test.ts index 940c4e8736..481c8a77fc 100644 --- a/storage/framework/core/commerce/src/tests/rates.test.ts +++ b/storage/framework/core/commerce/src/tests/rates.test.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, destroy, destroyByMethod, destroyByZone } from '../rates/destroy' -import { fetchById, formatShippingRateOptions, getRateByWeightAndZone, getRatesByZone, getShippingRatesByMethod } from '../rates/fetch' -import { bulkStore, store } from '../rates/store' -import { update, updateByMethod, updateByZone } from '../rates/update' +import { bulkDestroy, destroy, destroyByMethod, destroyByZone } from '../shippings/rates/destroy' +import { fetchById, formatShippingRateOptions, getRateByWeightAndZone, getRatesByZone, getShippingRatesByMethod } from '../shippings/rates/fetch' +import { bulkStore, store } from '../shippings/rates/store' +import { update, updateByMethod, updateByZone } from '../shippings/rates/update' // Create a request-like object for testing class TestRequest { From 70e0b71660dede302786737a1434eeefc582381d Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Wed, 2 Apr 2025 22:27:49 +0800 Subject: [PATCH 57/78] chore: wip --- app/Actions/Commerce/TransactionIndexAction.ts | 13 ------------- app/Actions/Commerce/TransactionShowAction.ts | 17 ----------------- app/Actions/Commerce/TransactionStoreAction.ts | 16 ---------------- storage/framework/core/commerce/src/index.ts | 4 ++-- .../core/commerce/src/shippings/rates/index.ts | 1 + .../core/commerce/src/tests/restaurant.test.ts | 8 ++++---- .../core/commerce/src/tests/waitlist.test.ts | 8 ++++---- .../core/commerce/src/waitlists/index.ts | 0 .../{waitlist => waitlists/products}/destroy.ts | 0 .../{waitlist => waitlists/products}/export.ts | 0 .../{waitlist => waitlists/products}/fetch.ts | 0 .../{waitlist => waitlists/products}/index.ts | 0 .../{waitlist => waitlists/products}/store.ts | 0 .../{waitlist => waitlists/products}/update.ts | 0 .../src/{ => waitlists}/restaurant/destroy.ts | 0 .../src/{ => waitlists}/restaurant/export.ts | 0 .../src/{ => waitlists}/restaurant/fetch.ts | 0 .../src/{ => waitlists}/restaurant/index.ts | 0 .../src/{ => waitlists}/restaurant/store.ts | 0 .../src/{ => waitlists}/restaurant/update.ts | 0 20 files changed, 11 insertions(+), 56 deletions(-) delete mode 100644 app/Actions/Commerce/TransactionIndexAction.ts delete mode 100644 app/Actions/Commerce/TransactionShowAction.ts delete mode 100644 app/Actions/Commerce/TransactionStoreAction.ts create mode 100644 storage/framework/core/commerce/src/waitlists/index.ts rename storage/framework/core/commerce/src/{waitlist => waitlists/products}/destroy.ts (100%) rename storage/framework/core/commerce/src/{waitlist => waitlists/products}/export.ts (100%) rename storage/framework/core/commerce/src/{waitlist => waitlists/products}/fetch.ts (100%) rename storage/framework/core/commerce/src/{waitlist => waitlists/products}/index.ts (100%) rename storage/framework/core/commerce/src/{waitlist => waitlists/products}/store.ts (100%) rename storage/framework/core/commerce/src/{waitlist => waitlists/products}/update.ts (100%) rename storage/framework/core/commerce/src/{ => waitlists}/restaurant/destroy.ts (100%) rename storage/framework/core/commerce/src/{ => waitlists}/restaurant/export.ts (100%) rename storage/framework/core/commerce/src/{ => waitlists}/restaurant/fetch.ts (100%) rename storage/framework/core/commerce/src/{ => waitlists}/restaurant/index.ts (100%) rename storage/framework/core/commerce/src/{ => waitlists}/restaurant/store.ts (100%) rename storage/framework/core/commerce/src/{ => waitlists}/restaurant/update.ts (100%) diff --git a/app/Actions/Commerce/TransactionIndexAction.ts b/app/Actions/Commerce/TransactionIndexAction.ts deleted file mode 100644 index 80d6164bbc..0000000000 --- a/app/Actions/Commerce/TransactionIndexAction.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Action } from '@stacksjs/actions' -import { response } from '@stacksjs/router' - -export default new Action({ - name: 'Transaction Index', - description: 'Transaction Index ORM Action', - method: 'GET', - async handle() { - const results = Transaction.all() - - return response.json(results) - }, -}) diff --git a/app/Actions/Commerce/TransactionShowAction.ts b/app/Actions/Commerce/TransactionShowAction.ts deleted file mode 100644 index e1525a8783..0000000000 --- a/app/Actions/Commerce/TransactionShowAction.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { TransactionRequestType } from '@stacksjs/orm' -import { Action } from '@stacksjs/actions' - -import { response } from '@stacksjs/router' - -export default new Action({ - name: 'Transaction Show', - description: 'Transaction Show ORM Action', - method: 'GET', - async handle(request: TransactionRequestType) { - const id = request.getParam('id') - - const model = await Transaction.findOrFail(id) - - return response.json(model) - }, -}) diff --git a/app/Actions/Commerce/TransactionStoreAction.ts b/app/Actions/Commerce/TransactionStoreAction.ts deleted file mode 100644 index e2bfd01e5d..0000000000 --- a/app/Actions/Commerce/TransactionStoreAction.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { TransactionRequestType } from '@stacksjs/orm' -import { Action } from '@stacksjs/actions' - -import { response } from '@stacksjs/router' - -export default new Action({ - name: 'Transaction Store', - description: 'Transaction Store ORM Action', - method: 'POST', - async handle(request: TransactionRequestType) { - await request.validate() - const model = await Transaction.create(request.all()) - - return response.json(model) - }, -}) diff --git a/storage/framework/core/commerce/src/index.ts b/storage/framework/core/commerce/src/index.ts index 4afc484ea2..b66584f166 100644 --- a/storage/framework/core/commerce/src/index.ts +++ b/storage/framework/core/commerce/src/index.ts @@ -7,10 +7,10 @@ import * as orders from './orders' import * as payments from './payments' import * as products from './products' import * as receipts from './receipts' -import * as restaurant from './restaurant' +import * as restaurant from './waitlists/restaurant' import * as shippings from './shippings' import * as tax from './tax' -import * as waitlist from './waitlist' +import * as waitlist from './waitlists/products' type CouponsModule = typeof coupons type CustomersModule = typeof customers diff --git a/storage/framework/core/commerce/src/shippings/rates/index.ts b/storage/framework/core/commerce/src/shippings/rates/index.ts index ea6b6a55d6..e4e4d3f249 100644 --- a/storage/framework/core/commerce/src/shippings/rates/index.ts +++ b/storage/framework/core/commerce/src/shippings/rates/index.ts @@ -12,6 +12,7 @@ export { getRateByWeightAndZone, getRatesByZone, getShippingRatesByMethod, + fetchAll, } from './fetch' // Functions from store.ts diff --git a/storage/framework/core/commerce/src/tests/restaurant.test.ts b/storage/framework/core/commerce/src/tests/restaurant.test.ts index 80f5f66d52..baec48744c 100644 --- a/storage/framework/core/commerce/src/tests/restaurant.test.ts +++ b/storage/framework/core/commerce/src/tests/restaurant.test.ts @@ -2,7 +2,7 @@ import type { WaitlistRestaurantJsonResponse } from '@stacksjs/orm' import { beforeEach, describe, expect, it } from 'bun:test' import { formatDate } from '@stacksjs/orm' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, destroy } from '../restaurant/destroy' +import { bulkDestroy, destroy } from '../waitlists/restaurant/destroy' import { fetchAll, fetchAverageWaitTimes, @@ -20,9 +20,9 @@ import { fetchWaiting, fetchWaitingWithPartySizes, fetchWaitingWithQuotedTimes, -} from '../restaurant/fetch' -import { bulkStore, store } from '../restaurant/store' -import { update, updatePartySize, updateQueuePosition, updateStatus, updateWaitTimes } from '../restaurant/update' +} from '../waitlists/restaurant/fetch' +import { bulkStore, store } from '../waitlists/restaurant/store' +import { update, updatePartySize, updateQueuePosition, updateStatus, updateWaitTimes } from '../waitlists/restaurant/update' // Create a request-like object for testing class TestRequest { diff --git a/storage/framework/core/commerce/src/tests/waitlist.test.ts b/storage/framework/core/commerce/src/tests/waitlist.test.ts index 95b76bbdf4..ef954a6d0b 100644 --- a/storage/framework/core/commerce/src/tests/waitlist.test.ts +++ b/storage/framework/core/commerce/src/tests/waitlist.test.ts @@ -2,7 +2,7 @@ import type { WaitlistProductJsonResponse } from '@stacksjs/orm' import { beforeEach, describe, expect, it } from 'bun:test' import { formatDate } from '@stacksjs/orm' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, destroy } from '../waitlist/destroy' +import { bulkDestroy, destroy } from '../waitlists/products/destroy' import { fetchAll, fetchBetweenDates, @@ -16,9 +16,9 @@ import { fetchNotifiedBetweenDates, fetchPurchasedBetweenDates, fetchWaiting, -} from '../waitlist/fetch' -import { bulkStore, store } from '../waitlist/store' -import { update, updatePartySize, updateStatus } from '../waitlist/update' +} from '../waitlists/products/fetch' +import { bulkStore, store } from '../waitlists/products/store' +import { update, updatePartySize, updateStatus } from '../waitlists/products/update' // Create a request-like object for testing class TestRequest { diff --git a/storage/framework/core/commerce/src/waitlists/index.ts b/storage/framework/core/commerce/src/waitlists/index.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/storage/framework/core/commerce/src/waitlist/destroy.ts b/storage/framework/core/commerce/src/waitlists/products/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/waitlist/destroy.ts rename to storage/framework/core/commerce/src/waitlists/products/destroy.ts diff --git a/storage/framework/core/commerce/src/waitlist/export.ts b/storage/framework/core/commerce/src/waitlists/products/export.ts similarity index 100% rename from storage/framework/core/commerce/src/waitlist/export.ts rename to storage/framework/core/commerce/src/waitlists/products/export.ts diff --git a/storage/framework/core/commerce/src/waitlist/fetch.ts b/storage/framework/core/commerce/src/waitlists/products/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/waitlist/fetch.ts rename to storage/framework/core/commerce/src/waitlists/products/fetch.ts diff --git a/storage/framework/core/commerce/src/waitlist/index.ts b/storage/framework/core/commerce/src/waitlists/products/index.ts similarity index 100% rename from storage/framework/core/commerce/src/waitlist/index.ts rename to storage/framework/core/commerce/src/waitlists/products/index.ts diff --git a/storage/framework/core/commerce/src/waitlist/store.ts b/storage/framework/core/commerce/src/waitlists/products/store.ts similarity index 100% rename from storage/framework/core/commerce/src/waitlist/store.ts rename to storage/framework/core/commerce/src/waitlists/products/store.ts diff --git a/storage/framework/core/commerce/src/waitlist/update.ts b/storage/framework/core/commerce/src/waitlists/products/update.ts similarity index 100% rename from storage/framework/core/commerce/src/waitlist/update.ts rename to storage/framework/core/commerce/src/waitlists/products/update.ts diff --git a/storage/framework/core/commerce/src/restaurant/destroy.ts b/storage/framework/core/commerce/src/waitlists/restaurant/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/restaurant/destroy.ts rename to storage/framework/core/commerce/src/waitlists/restaurant/destroy.ts diff --git a/storage/framework/core/commerce/src/restaurant/export.ts b/storage/framework/core/commerce/src/waitlists/restaurant/export.ts similarity index 100% rename from storage/framework/core/commerce/src/restaurant/export.ts rename to storage/framework/core/commerce/src/waitlists/restaurant/export.ts diff --git a/storage/framework/core/commerce/src/restaurant/fetch.ts b/storage/framework/core/commerce/src/waitlists/restaurant/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/restaurant/fetch.ts rename to storage/framework/core/commerce/src/waitlists/restaurant/fetch.ts diff --git a/storage/framework/core/commerce/src/restaurant/index.ts b/storage/framework/core/commerce/src/waitlists/restaurant/index.ts similarity index 100% rename from storage/framework/core/commerce/src/restaurant/index.ts rename to storage/framework/core/commerce/src/waitlists/restaurant/index.ts diff --git a/storage/framework/core/commerce/src/restaurant/store.ts b/storage/framework/core/commerce/src/waitlists/restaurant/store.ts similarity index 100% rename from storage/framework/core/commerce/src/restaurant/store.ts rename to storage/framework/core/commerce/src/waitlists/restaurant/store.ts diff --git a/storage/framework/core/commerce/src/restaurant/update.ts b/storage/framework/core/commerce/src/waitlists/restaurant/update.ts similarity index 100% rename from storage/framework/core/commerce/src/restaurant/update.ts rename to storage/framework/core/commerce/src/waitlists/restaurant/update.ts From baeb49ef8b8148438821e51081689da652192aca Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Wed, 2 Apr 2025 22:58:01 +0800 Subject: [PATCH 58/78] chore: wip --- .../Commerce/DeliveryRouteDestroyAction.ts | 4 ++-- .../Commerce/DeliveryRouteShowAction.ts | 4 ++-- .../Commerce/DeliveryRouteStoreAction.ts | 4 ++-- .../Commerce/DeliveryRouteUpdateAction.ts | 4 ++-- .../Commerce/DigitalDeliveryDestroyAction.ts | 4 ++-- .../Commerce/DigitalDeliveryIndexAction.ts | 4 ++-- .../Commerce/DigitalDeliveryShowAction.ts | 4 ++-- .../Commerce/DigitalDeliveryStoreAction.ts | 6 ++---- .../Commerce/DigitalDeliveryUpdateAction.ts | 5 ++--- app/Actions/Commerce/DriverDestroyAction.ts | 4 ++-- app/Actions/Commerce/DriverIndexAction.ts | 4 ++-- app/Actions/Commerce/DriverShowAction.ts | 4 ++-- app/Actions/Commerce/DriverStoreAction.ts | 6 ++---- app/Actions/Commerce/DriverUpdateAction.ts | 5 ++--- app/Actions/Commerce/GiftCardStoreAction.ts | 2 -- app/Actions/Commerce/GiftCardUpdateAction.ts | 1 - app/Actions/Commerce/OrderStoreAction.ts | 2 -- app/Actions/Commerce/PaymentStoreAction.ts | 2 -- .../Commerce/PrintDeviceStoreAction.ts | 2 -- .../Commerce/PrintDeviceUpdateAction.ts | 2 -- .../Commerce/ProductUnitStoreAction.ts | 1 - .../Commerce/ProductVariantStoreAction.ts | 1 - .../Commerce/ProductVariantUpdateAction.ts | 2 -- app/Actions/Commerce/ReceiptUpdateAction.ts | 2 -- .../Commerce/ShippingMethodUpdateAction.ts | 2 -- .../Commerce/ShippingZoneUpdateAction.ts | 2 -- .../Commerce/WaitlistProductDestroyAction.ts | 9 +++------ .../Commerce/WaitlistProductIndexAction.ts | 3 ++- .../Commerce/WaitlistProductShowAction.ts | 5 ++--- .../Commerce/WaitlistProductStoreAction.ts | 6 ++---- .../Commerce/WaitlistProductUpdateAction.ts | 11 +++-------- .../WaitlistRestaurantDestroyAction.ts | 9 +++------ .../Commerce/WaitlistRestaurantIndexAction.ts | 3 ++- .../Commerce/WaitlistRestaurantShowAction.ts | 5 ++--- .../Commerce/WaitlistRestaurantStoreAction.ts | 6 ++---- .../WaitlistRestaurantUpdateAction.ts | 11 +++-------- storage/framework/core/commerce/src/index.ts | 12 ++++++------ .../commerce/src/shippings/rates/index.ts | 2 +- .../core/commerce/src/waitlists/index.ts | 19 +++++++++++++++++++ 39 files changed, 78 insertions(+), 106 deletions(-) diff --git a/app/Actions/Commerce/DeliveryRouteDestroyAction.ts b/app/Actions/Commerce/DeliveryRouteDestroyAction.ts index 59fda7e6d1..121e5a3398 100644 --- a/app/Actions/Commerce/DeliveryRouteDestroyAction.ts +++ b/app/Actions/Commerce/DeliveryRouteDestroyAction.ts @@ -1,7 +1,7 @@ import type { DeliveryRouteRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { deliveryRoutes } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -12,7 +12,7 @@ export default new Action({ async handle(request: DeliveryRouteRequestType) { const id = request.getParam('id') - await deliveryRoutes.destroy(id) + await shippings.routes.destroy(id) return response.json({ message: 'DeliveryRoute deleted successfully' }) }, diff --git a/app/Actions/Commerce/DeliveryRouteShowAction.ts b/app/Actions/Commerce/DeliveryRouteShowAction.ts index ef0f9ea99f..22aec6676e 100644 --- a/app/Actions/Commerce/DeliveryRouteShowAction.ts +++ b/app/Actions/Commerce/DeliveryRouteShowAction.ts @@ -1,7 +1,7 @@ import type { DeliveryRouteRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { deliveryRoutes } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -12,7 +12,7 @@ export default new Action({ async handle(request: DeliveryRouteRequestType) { const id = request.getParam('id') - const model = await deliveryRoutes.fetchById(id) + const model = await shippings.routes.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/DeliveryRouteStoreAction.ts b/app/Actions/Commerce/DeliveryRouteStoreAction.ts index fc07613d1b..12732f3215 100644 --- a/app/Actions/Commerce/DeliveryRouteStoreAction.ts +++ b/app/Actions/Commerce/DeliveryRouteStoreAction.ts @@ -1,7 +1,7 @@ import type { DeliveryRouteRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { deliveryRoutes } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -10,7 +10,7 @@ export default new Action({ description: 'DeliveryRoute Store ORM Action', method: 'POST', async handle(request: DeliveryRouteRequestType) { - const model = await deliveryRoutes.store(request) + const model = await shippings.routes.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/DeliveryRouteUpdateAction.ts b/app/Actions/Commerce/DeliveryRouteUpdateAction.ts index 7a1a596c41..e9eb9b7b80 100644 --- a/app/Actions/Commerce/DeliveryRouteUpdateAction.ts +++ b/app/Actions/Commerce/DeliveryRouteUpdateAction.ts @@ -1,7 +1,7 @@ import type { DeliveryRouteRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { deliveryRoutes } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -12,7 +12,7 @@ export default new Action({ async handle(request: DeliveryRouteRequestType) { const id = request.getParam('id') - const model = await deliveryRoutes.update(id, request) + const model = await shippings.routes.update(id, request) return response.json(model) }, diff --git a/app/Actions/Commerce/DigitalDeliveryDestroyAction.ts b/app/Actions/Commerce/DigitalDeliveryDestroyAction.ts index 4434a0650f..602763f773 100644 --- a/app/Actions/Commerce/DigitalDeliveryDestroyAction.ts +++ b/app/Actions/Commerce/DigitalDeliveryDestroyAction.ts @@ -1,7 +1,7 @@ import type { DigitalDeliveryRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { digital } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -12,7 +12,7 @@ export default new Action({ async handle(request: DigitalDeliveryRequestType) { const id = request.getParam('id') - await digital.destroy(id) + await shippings.digital.destroy(id) return response.json({ message: 'DigitalDelivery deleted successfully' }) }, diff --git a/app/Actions/Commerce/DigitalDeliveryIndexAction.ts b/app/Actions/Commerce/DigitalDeliveryIndexAction.ts index 4f6eed8356..38d040590d 100644 --- a/app/Actions/Commerce/DigitalDeliveryIndexAction.ts +++ b/app/Actions/Commerce/DigitalDeliveryIndexAction.ts @@ -1,6 +1,6 @@ import { Action } from '@stacksjs/actions' -import { digital } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -9,7 +9,7 @@ export default new Action({ description: 'DigitalDelivery Index ORM Action', method: 'GET', async handle() { - const results = await digital.fetchAll() + const results = await shippings.digital.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/DigitalDeliveryShowAction.ts b/app/Actions/Commerce/DigitalDeliveryShowAction.ts index f462cc2f17..7859f533b7 100644 --- a/app/Actions/Commerce/DigitalDeliveryShowAction.ts +++ b/app/Actions/Commerce/DigitalDeliveryShowAction.ts @@ -1,7 +1,7 @@ import type { DigitalDeliveryRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { digital } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -12,7 +12,7 @@ export default new Action({ async handle(request: DigitalDeliveryRequestType) { const id = request.getParam('id') - const model = await digital.fetchById(id) + const model = await shippings.digital.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/DigitalDeliveryStoreAction.ts b/app/Actions/Commerce/DigitalDeliveryStoreAction.ts index 4bbc5c2456..6a9386893b 100644 --- a/app/Actions/Commerce/DigitalDeliveryStoreAction.ts +++ b/app/Actions/Commerce/DigitalDeliveryStoreAction.ts @@ -1,7 +1,7 @@ import type { DigitalDeliveryRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { digital } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -10,9 +10,7 @@ export default new Action({ description: 'DigitalDelivery Store ORM Action', method: 'POST', async handle(request: DigitalDeliveryRequestType) { - await request.validate() - - const model = await digital.store(request) + const model = await shippings.digital.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/DigitalDeliveryUpdateAction.ts b/app/Actions/Commerce/DigitalDeliveryUpdateAction.ts index 1b4bab8f16..71953ce56e 100644 --- a/app/Actions/Commerce/DigitalDeliveryUpdateAction.ts +++ b/app/Actions/Commerce/DigitalDeliveryUpdateAction.ts @@ -1,7 +1,7 @@ import type { DigitalDeliveryRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { digital } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -10,10 +10,9 @@ export default new Action({ description: 'DigitalDelivery Update ORM Action', method: 'PUT', async handle(request: DigitalDeliveryRequestType) { - await request.validate() const id = request.getParam('id') - const model = await digital.update(id, request) + const model = await shippings.digital.update(id, request) return response.json(model) }, diff --git a/app/Actions/Commerce/DriverDestroyAction.ts b/app/Actions/Commerce/DriverDestroyAction.ts index 1692419956..8b9ab702a2 100644 --- a/app/Actions/Commerce/DriverDestroyAction.ts +++ b/app/Actions/Commerce/DriverDestroyAction.ts @@ -1,7 +1,7 @@ import type { DriverRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { drivers } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -12,7 +12,7 @@ export default new Action({ async handle(request: DriverRequestType) { const id = request.getParam('id') - await drivers.destroy(id) + await shippings.drivers.destroy(id) return response.json({ message: 'Driver deleted successfully' }) }, diff --git a/app/Actions/Commerce/DriverIndexAction.ts b/app/Actions/Commerce/DriverIndexAction.ts index eb9b12ad96..f93aa85759 100644 --- a/app/Actions/Commerce/DriverIndexAction.ts +++ b/app/Actions/Commerce/DriverIndexAction.ts @@ -1,6 +1,6 @@ import { Action } from '@stacksjs/actions' -import { drivers } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -9,7 +9,7 @@ export default new Action({ description: 'Driver Index ORM Action', method: 'GET', async handle() { - const results = await drivers.fetchAll() + const results = await shippings.drivers.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/DriverShowAction.ts b/app/Actions/Commerce/DriverShowAction.ts index e647b175e0..6acf61aa89 100644 --- a/app/Actions/Commerce/DriverShowAction.ts +++ b/app/Actions/Commerce/DriverShowAction.ts @@ -1,7 +1,7 @@ import type { DriverRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { drivers } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -12,7 +12,7 @@ export default new Action({ async handle(request: DriverRequestType) { const id = request.getParam('id') - const model = await drivers.fetchById(id) + const model = await shippings.drivers.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/DriverStoreAction.ts b/app/Actions/Commerce/DriverStoreAction.ts index a30855d677..906ffac0c2 100644 --- a/app/Actions/Commerce/DriverStoreAction.ts +++ b/app/Actions/Commerce/DriverStoreAction.ts @@ -1,7 +1,7 @@ import type { DriverRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { drivers } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -10,9 +10,7 @@ export default new Action({ description: 'Driver Store ORM Action', method: 'POST', async handle(request: DriverRequestType) { - await request.validate() - - const model = await drivers.store(request) + const model = await shippings.drivers.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/DriverUpdateAction.ts b/app/Actions/Commerce/DriverUpdateAction.ts index c8ba235d4a..f1091415d0 100644 --- a/app/Actions/Commerce/DriverUpdateAction.ts +++ b/app/Actions/Commerce/DriverUpdateAction.ts @@ -1,7 +1,7 @@ import type { DriverRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' -import { drivers } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -10,10 +10,9 @@ export default new Action({ description: 'Driver Update ORM Action', method: 'PUT', async handle(request: DriverRequestType) { - await request.validate() const id = request.getParam('id') - const model = await drivers.update(id, request) + const model = await shippings.drivers.update(id, request) return response.json(model) }, diff --git a/app/Actions/Commerce/GiftCardStoreAction.ts b/app/Actions/Commerce/GiftCardStoreAction.ts index 00613c89df..45603c816b 100644 --- a/app/Actions/Commerce/GiftCardStoreAction.ts +++ b/app/Actions/Commerce/GiftCardStoreAction.ts @@ -10,8 +10,6 @@ export default new Action({ description: 'GiftCard Store ORM Action', method: 'POST', async handle(request: GiftCardRequestType) { - await request.validate() - const model = await giftCards.store(request) return response.json(model) diff --git a/app/Actions/Commerce/GiftCardUpdateAction.ts b/app/Actions/Commerce/GiftCardUpdateAction.ts index b1f844d2d3..a79aa7bc8f 100644 --- a/app/Actions/Commerce/GiftCardUpdateAction.ts +++ b/app/Actions/Commerce/GiftCardUpdateAction.ts @@ -10,7 +10,6 @@ export default new Action({ description: 'GiftCard Update ORM Action', method: 'PUT', async handle(request: GiftCardRequestType) { - await request.validate() const id = request.getParam('id') const model = await giftCards.update(id, request) diff --git a/app/Actions/Commerce/OrderStoreAction.ts b/app/Actions/Commerce/OrderStoreAction.ts index a4188de607..94350437e2 100644 --- a/app/Actions/Commerce/OrderStoreAction.ts +++ b/app/Actions/Commerce/OrderStoreAction.ts @@ -10,8 +10,6 @@ export default new Action({ description: 'Order Store ORM Action', method: 'POST', async handle(request: OrderRequestType) { - await request.validate() - const model = await orders.store(request) return response.json(model) diff --git a/app/Actions/Commerce/PaymentStoreAction.ts b/app/Actions/Commerce/PaymentStoreAction.ts index d3b8966707..c29b5e2865 100644 --- a/app/Actions/Commerce/PaymentStoreAction.ts +++ b/app/Actions/Commerce/PaymentStoreAction.ts @@ -8,8 +8,6 @@ export default new Action({ description: 'Payment Store ORM Action', method: 'POST', async handle(request: PaymentRequestType) { - await request.validate() - const model = await payments.store(request) return response.json(model) diff --git a/app/Actions/Commerce/PrintDeviceStoreAction.ts b/app/Actions/Commerce/PrintDeviceStoreAction.ts index a156fc972e..96ad50a0af 100644 --- a/app/Actions/Commerce/PrintDeviceStoreAction.ts +++ b/app/Actions/Commerce/PrintDeviceStoreAction.ts @@ -9,8 +9,6 @@ export default new Action({ description: 'PrintDevice Store ORM Action', method: 'POST', async handle(request: PrintDeviceRequestType) { - await request.validate() - const model = await devices.store(request) return response.json(model) diff --git a/app/Actions/Commerce/PrintDeviceUpdateAction.ts b/app/Actions/Commerce/PrintDeviceUpdateAction.ts index 4d80e0e45a..7c781c02db 100644 --- a/app/Actions/Commerce/PrintDeviceUpdateAction.ts +++ b/app/Actions/Commerce/PrintDeviceUpdateAction.ts @@ -9,8 +9,6 @@ export default new Action({ description: 'PrintDevice Update ORM Action', method: 'PATCH', async handle(request: PrintDeviceRequestType) { - await request.validate() - const id = request.getParam('id') const model = await devices.update(id, request) diff --git a/app/Actions/Commerce/ProductUnitStoreAction.ts b/app/Actions/Commerce/ProductUnitStoreAction.ts index 56cde9cb8f..df177d5fa7 100644 --- a/app/Actions/Commerce/ProductUnitStoreAction.ts +++ b/app/Actions/Commerce/ProductUnitStoreAction.ts @@ -9,7 +9,6 @@ export default new Action({ description: 'ProductUnit Store ORM Action', method: 'POST', async handle(request: ProductUnitRequestType) { - await request.validate() const model = await products.units.store(request) return response.json(model) diff --git a/app/Actions/Commerce/ProductVariantStoreAction.ts b/app/Actions/Commerce/ProductVariantStoreAction.ts index feb3e76ca0..86a49ff0bb 100644 --- a/app/Actions/Commerce/ProductVariantStoreAction.ts +++ b/app/Actions/Commerce/ProductVariantStoreAction.ts @@ -8,7 +8,6 @@ export default new Action({ description: 'ProductVariant Store ORM Action', method: 'POST', async handle(request: ProductVariantRequestType) { - await request.validate() const model = await products.variants.store(request) return response.json(model) diff --git a/app/Actions/Commerce/ProductVariantUpdateAction.ts b/app/Actions/Commerce/ProductVariantUpdateAction.ts index 20a219059e..7ce43442bb 100644 --- a/app/Actions/Commerce/ProductVariantUpdateAction.ts +++ b/app/Actions/Commerce/ProductVariantUpdateAction.ts @@ -8,8 +8,6 @@ export default new Action({ description: 'ProductVariant Update ORM Action', method: 'PATCH', async handle(request: ProductVariantRequestType) { - await request.validate() - const id = request.getParam('id') const result = await products.variants.update(id, request) diff --git a/app/Actions/Commerce/ReceiptUpdateAction.ts b/app/Actions/Commerce/ReceiptUpdateAction.ts index 5c2ffd35f6..572e865e23 100644 --- a/app/Actions/Commerce/ReceiptUpdateAction.ts +++ b/app/Actions/Commerce/ReceiptUpdateAction.ts @@ -9,8 +9,6 @@ export default new Action({ description: 'Receipt Update ORM Action', method: 'PATCH', async handle(request: ReceiptRequestType) { - await request.validate() - const id = request.getParam('id') const result = await receipts.update(id, request) diff --git a/app/Actions/Commerce/ShippingMethodUpdateAction.ts b/app/Actions/Commerce/ShippingMethodUpdateAction.ts index c36384c863..2930f0f2e2 100644 --- a/app/Actions/Commerce/ShippingMethodUpdateAction.ts +++ b/app/Actions/Commerce/ShippingMethodUpdateAction.ts @@ -8,8 +8,6 @@ export default new Action({ description: 'ShippingMethod Update ORM Action', method: 'PATCH', async handle(request: ShippingMethodRequestType) { - await request.validate() - const id = request.getParam('id') const model = await shippings.methods.update(id, request) diff --git a/app/Actions/Commerce/ShippingZoneUpdateAction.ts b/app/Actions/Commerce/ShippingZoneUpdateAction.ts index 7b144476d0..30b7bcafb8 100644 --- a/app/Actions/Commerce/ShippingZoneUpdateAction.ts +++ b/app/Actions/Commerce/ShippingZoneUpdateAction.ts @@ -8,8 +8,6 @@ export default new Action({ description: 'ShippingZone Update ORM Action', method: 'PATCH', async handle(request: ShippingZoneRequestType) { - await request.validate() - const id = request.getParam('id') const model = await shippings.zones.update(id, request) diff --git a/app/Actions/Commerce/WaitlistProductDestroyAction.ts b/app/Actions/Commerce/WaitlistProductDestroyAction.ts index 94f5b152a2..8a921fcfea 100644 --- a/app/Actions/Commerce/WaitlistProductDestroyAction.ts +++ b/app/Actions/Commerce/WaitlistProductDestroyAction.ts @@ -1,7 +1,6 @@ import type { WaitlistProductRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - -import { WaitlistProduct } from '@stacksjs/orm' +import { waitlists } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -11,10 +10,8 @@ export default new Action({ async handle(request: WaitlistProductRequestType) { const id = request.getParam('id') - const model = await WaitlistProduct.findOrFail(id) - - model.delete() + await waitlists.products.destroy(id) - return response.json({ message: 'Model deleted!' }) + return response.json({ message: 'WaitlistProduct deleted successfully' }) }, }) diff --git a/app/Actions/Commerce/WaitlistProductIndexAction.ts b/app/Actions/Commerce/WaitlistProductIndexAction.ts index 13b9ea8522..9145784153 100644 --- a/app/Actions/Commerce/WaitlistProductIndexAction.ts +++ b/app/Actions/Commerce/WaitlistProductIndexAction.ts @@ -1,4 +1,5 @@ import { Action } from '@stacksjs/actions' +import { waitlists } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -6,7 +7,7 @@ export default new Action({ description: 'WaitlistProduct Index ORM Action', method: 'GET', async handle() { - const results = WaitlistProduct.all() + const results = await waitlists.products.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/WaitlistProductShowAction.ts b/app/Actions/Commerce/WaitlistProductShowAction.ts index e889ea0b14..cbba8944f9 100644 --- a/app/Actions/Commerce/WaitlistProductShowAction.ts +++ b/app/Actions/Commerce/WaitlistProductShowAction.ts @@ -1,7 +1,6 @@ import type { WaitlistProductRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - -import { WaitlistProduct } from '@stacksjs/orm' +import { waitlists } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -11,7 +10,7 @@ export default new Action({ async handle(request: WaitlistProductRequestType) { const id = request.getParam('id') - const model = await WaitlistProduct.findOrFail(id) + const model = await waitlists.products.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/WaitlistProductStoreAction.ts b/app/Actions/Commerce/WaitlistProductStoreAction.ts index e1c25a0159..7737762075 100644 --- a/app/Actions/Commerce/WaitlistProductStoreAction.ts +++ b/app/Actions/Commerce/WaitlistProductStoreAction.ts @@ -1,7 +1,6 @@ import type { WaitlistProductRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - -import { WaitlistProduct } from '@stacksjs/orm' +import { waitlists } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -9,8 +8,7 @@ export default new Action({ description: 'WaitlistProduct Store ORM Action', method: 'POST', async handle(request: WaitlistProductRequestType) { - await request.validate() - const model = await WaitlistProduct.create(request.all()) + const model = await waitlists.products.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/WaitlistProductUpdateAction.ts b/app/Actions/Commerce/WaitlistProductUpdateAction.ts index 004c96b5fc..f3fec1b53a 100644 --- a/app/Actions/Commerce/WaitlistProductUpdateAction.ts +++ b/app/Actions/Commerce/WaitlistProductUpdateAction.ts @@ -1,7 +1,6 @@ import type { WaitlistProductRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - -import { WaitlistProduct } from '@stacksjs/orm' +import { waitlists } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -9,13 +8,9 @@ export default new Action({ description: 'WaitlistProduct Update ORM Action', method: 'PATCH', async handle(request: WaitlistProductRequestType) { - await request.validate() - const id = request.getParam('id') - const model = await WaitlistProduct.findOrFail(id) - - const result = model.update(request.all()) + const model = await waitlists.products.update(id, request) - return response.json(result) + return response.json(model) }, }) diff --git a/app/Actions/Commerce/WaitlistRestaurantDestroyAction.ts b/app/Actions/Commerce/WaitlistRestaurantDestroyAction.ts index f994322e1e..0cddec5e70 100644 --- a/app/Actions/Commerce/WaitlistRestaurantDestroyAction.ts +++ b/app/Actions/Commerce/WaitlistRestaurantDestroyAction.ts @@ -1,7 +1,6 @@ import type { WaitlistRestaurantRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - -import { WaitlistRestaurant } from '@stacksjs/orm' +import { waitlists } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -11,10 +10,8 @@ export default new Action({ async handle(request: WaitlistRestaurantRequestType) { const id = request.getParam('id') - const model = await WaitlistRestaurant.findOrFail(id) - - model.delete() + await waitlists.restaurant.destroy(id) - return response.json({ message: 'Model deleted!' }) + return response.json({ message: 'WaitlistRestaurant deleted successfully' }) }, }) diff --git a/app/Actions/Commerce/WaitlistRestaurantIndexAction.ts b/app/Actions/Commerce/WaitlistRestaurantIndexAction.ts index bbf8e22628..bac83dc28f 100644 --- a/app/Actions/Commerce/WaitlistRestaurantIndexAction.ts +++ b/app/Actions/Commerce/WaitlistRestaurantIndexAction.ts @@ -1,4 +1,5 @@ import { Action } from '@stacksjs/actions' +import { waitlists } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -6,7 +7,7 @@ export default new Action({ description: 'WaitlistRestaurant Index ORM Action', method: 'GET', async handle() { - const results = WaitlistRestaurant.all() + const results = await waitlists.restaurant.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/WaitlistRestaurantShowAction.ts b/app/Actions/Commerce/WaitlistRestaurantShowAction.ts index 03c817fd80..94a32b6b60 100644 --- a/app/Actions/Commerce/WaitlistRestaurantShowAction.ts +++ b/app/Actions/Commerce/WaitlistRestaurantShowAction.ts @@ -1,7 +1,6 @@ import type { WaitlistRestaurantRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - -import { WaitlistRestaurant } from '@stacksjs/orm' +import { waitlists } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -11,7 +10,7 @@ export default new Action({ async handle(request: WaitlistRestaurantRequestType) { const id = request.getParam('id') - const model = await WaitlistRestaurant.findOrFail(id) + const model = await waitlists.restaurant.fetchById(id) return response.json(model) }, diff --git a/app/Actions/Commerce/WaitlistRestaurantStoreAction.ts b/app/Actions/Commerce/WaitlistRestaurantStoreAction.ts index 1ce99b3e70..8a57df7260 100644 --- a/app/Actions/Commerce/WaitlistRestaurantStoreAction.ts +++ b/app/Actions/Commerce/WaitlistRestaurantStoreAction.ts @@ -1,7 +1,6 @@ import type { WaitlistRestaurantRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - -import { WaitlistRestaurant } from '@stacksjs/orm' +import { waitlists } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -9,8 +8,7 @@ export default new Action({ description: 'WaitlistRestaurant Store ORM Action', method: 'POST', async handle(request: WaitlistRestaurantRequestType) { - await request.validate() - const model = await WaitlistRestaurant.create(request.all()) + const model = await waitlists.restaurant.store(request) return response.json(model) }, diff --git a/app/Actions/Commerce/WaitlistRestaurantUpdateAction.ts b/app/Actions/Commerce/WaitlistRestaurantUpdateAction.ts index 22616409cc..61eb9520c7 100644 --- a/app/Actions/Commerce/WaitlistRestaurantUpdateAction.ts +++ b/app/Actions/Commerce/WaitlistRestaurantUpdateAction.ts @@ -1,7 +1,6 @@ import type { WaitlistRestaurantRequestType } from '@stacksjs/orm' import { Action } from '@stacksjs/actions' - -import { WaitlistRestaurant } from '@stacksjs/orm' +import { waitlists } from '@stacksjs/commerce' import { response } from '@stacksjs/router' export default new Action({ @@ -9,13 +8,9 @@ export default new Action({ description: 'WaitlistRestaurant Update ORM Action', method: 'PATCH', async handle(request: WaitlistRestaurantRequestType) { - await request.validate() - const id = request.getParam('id') - const model = await WaitlistRestaurant.findOrFail(id) - - const result = model.update(request.all()) + const model = await waitlists.restaurant.update(id, request) - return response.json(result) + return response.json(model) }, }) diff --git a/storage/framework/core/commerce/src/index.ts b/storage/framework/core/commerce/src/index.ts index b66584f166..fb903ac4ab 100644 --- a/storage/framework/core/commerce/src/index.ts +++ b/storage/framework/core/commerce/src/index.ts @@ -7,10 +7,10 @@ import * as orders from './orders' import * as payments from './payments' import * as products from './products' import * as receipts from './receipts' -import * as restaurant from './waitlists/restaurant' import * as shippings from './shippings' import * as tax from './tax' -import * as waitlist from './waitlists/products' +import * as waitlists from './waitlists' +import * as restaurant from './waitlists/restaurant' type CouponsModule = typeof coupons type CustomersModule = typeof customers @@ -21,7 +21,7 @@ type PaymentsModule = typeof payments type ProductsModule = typeof products type RestaurantModule = typeof restaurant type TaxModule = typeof tax -type WaitlistModule = typeof waitlist +type WaitlistsModule = typeof waitlists type DevicesModule = typeof devices type ReceiptsModule = typeof receipts @@ -35,7 +35,7 @@ export interface EcommerceNamespace { restaurant: RestaurantModule shippings: ShippingsModule tax: TaxModule - waitlist: WaitlistModule + waitlists: WaitlistsModule devices: DevicesModule receipts: ReceiptsModule } @@ -52,7 +52,7 @@ export const ecommerce: EcommerceNamespace = { restaurant, shippings, tax, - waitlist, + waitlists, } export default ecommerce @@ -69,5 +69,5 @@ export { restaurant, shippings, tax, - waitlist, + waitlists, } diff --git a/storage/framework/core/commerce/src/shippings/rates/index.ts b/storage/framework/core/commerce/src/shippings/rates/index.ts index e4e4d3f249..44b9b07fee 100644 --- a/storage/framework/core/commerce/src/shippings/rates/index.ts +++ b/storage/framework/core/commerce/src/shippings/rates/index.ts @@ -7,12 +7,12 @@ export { // Functions from fetch.ts export { + fetchAll, fetchById, formatShippingRateOptions, getRateByWeightAndZone, getRatesByZone, getShippingRatesByMethod, - fetchAll, } from './fetch' // Functions from store.ts diff --git a/storage/framework/core/commerce/src/waitlists/index.ts b/storage/framework/core/commerce/src/waitlists/index.ts index e69de29bb2..3775adf3a7 100644 --- a/storage/framework/core/commerce/src/waitlists/index.ts +++ b/storage/framework/core/commerce/src/waitlists/index.ts @@ -0,0 +1,19 @@ +import * as products from './products' +import * as restaurant from './restaurant' + +export { + products, + restaurant, +} + +interface WaitlistsNamespace { + products: typeof products + restaurant: typeof restaurant +} + +const waitlists: WaitlistsNamespace = { + products, + restaurant, +} + +export default waitlists From 0768e33babddb525e436f1380c3aef528ae1d7aa Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 08:20:08 -0700 Subject: [PATCH 59/78] chore(deps): update devdependency supports-hyperlinks to v4 (#1330) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- storage/framework/core/cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/framework/core/cli/package.json b/storage/framework/core/cli/package.json index 3b7849609d..8f88d1cd61 100644 --- a/storage/framework/core/cli/package.json +++ b/storage/framework/core/cli/package.json @@ -68,6 +68,6 @@ "kolorist": "1.8.0", "ora": "^8.2.0", "prompts": "^2.4.2", - "supports-hyperlinks": "^3.2.0" + "supports-hyperlinks": "^4.0.0" } } From 3ec1ce51db3bf1a14912903a43115fcf8df98bea Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 08:20:28 -0700 Subject: [PATCH 60/78] chore(deps): update all non-major dependencies (#1326) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- cloud/Dockerfile | 4 ++-- storage/framework/cloud/package.json | 8 ++++---- storage/framework/core/ai/package.json | 2 +- storage/framework/core/cloud/package.json | 8 ++++---- storage/framework/core/components/stepper/package.json | 2 +- storage/framework/core/components/table/package.json | 2 +- storage/framework/core/desktop/package.json | 4 ++-- storage/framework/core/dns/package.json | 2 +- storage/framework/core/raycast/package.json | 2 +- storage/framework/core/server/package.json | 2 +- storage/framework/core/storage/package.json | 2 +- storage/framework/core/types/package.json | 6 +++--- storage/framework/core/ui/package.json | 6 +++--- storage/framework/core/utils/package.json | 2 +- storage/framework/core/vite-config/package.json | 4 ++-- storage/framework/core/vite-plugin/package.json | 4 ++-- storage/framework/defaults/ide/vscode/package.json | 2 +- storage/framework/server/Dockerfile | 4 ++-- storage/framework/views/dashboard/src-tauri/Cargo.toml | 4 ++-- storage/framework/views/desktop/src-tauri/Cargo.toml | 4 ++-- storage/framework/views/web/package.json | 8 ++++---- 21 files changed, 41 insertions(+), 41 deletions(-) diff --git a/cloud/Dockerfile b/cloud/Dockerfile index 441c1ee5b1..8d71dc9ecb 100644 --- a/cloud/Dockerfile +++ b/cloud/Dockerfile @@ -1,5 +1,5 @@ # Build stage -FROM oven/bun:1.2.7-debian AS builder +FROM oven/bun:1.2.8-debian AS builder WORKDIR /usr/src # Copy source files @@ -15,7 +15,7 @@ COPY ./tsconfig.docker.json ./tsconfig.json # RUN bun run build # Final stage -FROM oven/bun:1.2.7-debian AS release +FROM oven/bun:1.2.8-debian AS release WORKDIR /usr/src # Copy built files from builder stage diff --git a/storage/framework/cloud/package.json b/storage/framework/cloud/package.json index cfd82e5579..5db3a7f8e0 100644 --- a/storage/framework/cloud/package.json +++ b/storage/framework/cloud/package.json @@ -46,14 +46,14 @@ "@aws-sdk/client-cloudfront": "^3.777.0", "@aws-sdk/client-cloudwatch-logs": "^3.777.0", "@aws-sdk/client-dynamodb": "3.777.0", - "@aws-sdk/client-ec2": "^3.777.0", + "@aws-sdk/client-ec2": "^3.779.0", "@aws-sdk/client-efs": "^3.777.0", "@aws-sdk/client-iam": "^3.777.0", "@aws-sdk/client-lambda": "^3.777.0", "@aws-sdk/client-route-53-domains": "^3.777.0", - "@aws-sdk/client-s3": "^3.777.0", + "@aws-sdk/client-s3": "^3.779.0", "@aws-sdk/client-ses": "^3.777.0", - "@aws-sdk/client-sesv2": "^3.777.0", + "@aws-sdk/client-sesv2": "^3.779.0", "@aws-sdk/client-ssm": "^3.777.0", "@stacksjs/config": "workspace:*", "@stacksjs/dns": "workspace:*", @@ -65,7 +65,7 @@ "@stacksjs/utils": "workspace:*", "@stacksjs/validation": "workspace:*", "aws-cdk": "^2.1006.0", - "aws-cdk-lib": "^2.186.0", + "aws-cdk-lib": "^2.187.0", "aws4fetch": "^1.0.20", "constructs": "^10.4.2" }, diff --git a/storage/framework/core/ai/package.json b/storage/framework/core/ai/package.json index 40ea75453a..2c0e5bcd4b 100644 --- a/storage/framework/core/ai/package.json +++ b/storage/framework/core/ai/package.json @@ -42,7 +42,7 @@ "prepublishOnly": "bun run build" }, "devDependencies": { - "@aws-sdk/client-bedrock-runtime": "^3.778.0", + "@aws-sdk/client-bedrock-runtime": "^3.779.0", "@aws-sdk/credential-providers": "^3.778.0", "@stacksjs/development": "workspace:*", "aws-sdk-client-mock": "^4.1.0" diff --git a/storage/framework/core/cloud/package.json b/storage/framework/core/cloud/package.json index 09b2cfd304..39834f1804 100644 --- a/storage/framework/core/cloud/package.json +++ b/storage/framework/core/cloud/package.json @@ -50,14 +50,14 @@ "@aws-sdk/client-cloudfront": "^3.777.0", "@aws-sdk/client-cloudwatch-logs": "^3.777.0", "@aws-sdk/client-dynamodb": "3.777.0", - "@aws-sdk/client-ec2": "^3.777.0", + "@aws-sdk/client-ec2": "^3.779.0", "@aws-sdk/client-efs": "^3.777.0", "@aws-sdk/client-iam": "^3.777.0", "@aws-sdk/client-lambda": "^3.777.0", "@aws-sdk/client-route-53-domains": "^3.777.0", - "@aws-sdk/client-s3": "^3.777.0", + "@aws-sdk/client-s3": "^3.779.0", "@aws-sdk/client-ses": "^3.777.0", - "@aws-sdk/client-sesv2": "^3.777.0", + "@aws-sdk/client-sesv2": "^3.779.0", "@aws-sdk/client-ssm": "^3.777.0", "@stacksjs/cli": "workspace:*", "@stacksjs/config": "workspace:*", @@ -71,7 +71,7 @@ "@stacksjs/utils": "workspace:*", "@stacksjs/validation": "workspace:*", "aws-cdk": "^2.1006.0", - "aws-cdk-lib": "^2.186.0", + "aws-cdk-lib": "^2.187.0", "aws4fetch": "^1.0.20", "constructs": "^10.4.2", "source-map-support": "^0.5.21" diff --git a/storage/framework/core/components/stepper/package.json b/storage/framework/core/components/stepper/package.json index 23064b3be1..99323541e2 100644 --- a/storage/framework/core/components/stepper/package.json +++ b/storage/framework/core/components/stepper/package.json @@ -52,7 +52,7 @@ }, "devDependencies": { "@iconify-json/hugeicons": "^1.2.4", - "@microsoft/api-extractor": "^7.52.1", + "@microsoft/api-extractor": "^7.52.2", "@stacksjs/alias": "workspace:*", "@stacksjs/development": "workspace:*", "@stacksjs/dialog": "workspace:*", diff --git a/storage/framework/core/components/table/package.json b/storage/framework/core/components/table/package.json index 5213dc1e28..8c658a5d54 100644 --- a/storage/framework/core/components/table/package.json +++ b/storage/framework/core/components/table/package.json @@ -35,6 +35,6 @@ }, "devDependencies": { "@stacksjs/development": "workspace:*", - "vite": "^6.2.3" + "vite": "^6.2.4" } } diff --git a/storage/framework/core/desktop/package.json b/storage/framework/core/desktop/package.json index 008a4b513f..2b4622d8b6 100644 --- a/storage/framework/core/desktop/package.json +++ b/storage/framework/core/desktop/package.json @@ -53,8 +53,8 @@ "@stacksjs/build": "workspace:*", "@stacksjs/development": "workspace:*", "@stacksjs/server": "workspace:*", - "@tauri-apps/api": "^2.4.0", - "@tauri-apps/cli": "^2.4.0", + "@tauri-apps/api": "^2.4.1", + "@tauri-apps/cli": "^2.4.1", "@types/d3": "^7.4.3", "d3": "^7.9.0", "unified-network": "^0.6.4", diff --git a/storage/framework/core/dns/package.json b/storage/framework/core/dns/package.json index 0301dc7b5a..bf565376fa 100644 --- a/storage/framework/core/dns/package.json +++ b/storage/framework/core/dns/package.json @@ -52,6 +52,6 @@ "@stacksjs/storage": "workspace:*", "@stacksjs/strings": "workspace:*", "@stacksjs/whois": "workspace:*", - "aws-cdk-lib": "^2.186.0" + "aws-cdk-lib": "^2.187.0" } } diff --git a/storage/framework/core/raycast/package.json b/storage/framework/core/raycast/package.json index 719359ec82..8c1d29b7db 100644 --- a/storage/framework/core/raycast/package.json +++ b/storage/framework/core/raycast/package.json @@ -26,7 +26,7 @@ "publish": "bunx --bun @raycast/api@latest publish" }, "devDependencies": { - "@raycast/api": "^1.94.2", + "@raycast/api": "^1.94.3", "@raycast/utils": "^1.19.1", "@stacksjs/development": "workspace:*", "typescript": "^5.8.2" diff --git a/storage/framework/core/server/package.json b/storage/framework/core/server/package.json index 5f0b6aba3a..951f3a2eeb 100644 --- a/storage/framework/core/server/package.json +++ b/storage/framework/core/server/package.json @@ -48,6 +48,6 @@ "@stacksjs/router": "workspace:*", "@stacksjs/validation": "workspace:*", "bun-plugin-auto-imports": "^0.3.1", - "vite": "^6.2.3" + "vite": "^6.2.4" } } diff --git a/storage/framework/core/storage/package.json b/storage/framework/core/storage/package.json index 387e64d09c..c3780ce7b6 100644 --- a/storage/framework/core/storage/package.json +++ b/storage/framework/core/storage/package.json @@ -48,7 +48,7 @@ "prepublishOnly": "bun run build" }, "devDependencies": { - "@aws-sdk/client-s3": "^3.777.0", + "@aws-sdk/client-s3": "^3.779.0", "@flystorage/aws-s3": "^1.0.1", "@flystorage/chaos": "^1.0.0", "@flystorage/file-storage": "^1.0.1", diff --git a/storage/framework/core/types/package.json b/storage/framework/core/types/package.json index 74999a61f7..1a5fcde60f 100644 --- a/storage/framework/core/types/package.json +++ b/storage/framework/core/types/package.json @@ -57,7 +57,7 @@ "@types/minimatch": "^5.1.2", "@types/nprogress": "^0.2.3", "@vinejs/vine": "^3.0.1", - "aws-cdk-lib": "^2.186.0", + "aws-cdk-lib": "^2.187.0", "cac": "^6.7.14", "markdown-it": "^14.1.0", "meilisearch": "^0.49.0", @@ -67,10 +67,10 @@ "unocss": "66.0.0", "unplugin-auto-import": "^19.1.2", "unplugin-vue-components": "^28.4.1", - "vite": "^6.2.3", + "vite": "^6.2.4", "vite-plugin-inspect": "^11.0.0", "vite-plugin-pwa": "^1.0.0", - "vite-ssg": "^26.1.0", + "vite-ssg": "^26.1.1", "vitepress": "1.6.3", "vue": "^3.5.13" } diff --git a/storage/framework/core/ui/package.json b/storage/framework/core/ui/package.json index 07a84166f3..270abdc697 100644 --- a/storage/framework/core/ui/package.json +++ b/storage/framework/core/ui/package.json @@ -59,17 +59,17 @@ "devDependencies": { "@headlessui/vue": "^1.7.23", "@iconify-json/hugeicons": "^1.2.4", - "@iconify/json": "^2.2.321", + "@iconify/json": "^2.2.323", "@julr/unocss-preset-forms": "^1.0.0", "@stacksjs/build": "workspace:*", "@stacksjs/config": "workspace:*", "@stacksjs/development": "workspace:*", "@stacksjs/router": "workspace:*", - "@unhead/vue": "^2.0.2", + "@unhead/vue": "^2.0.3", "bun-plugin-unocss": "^0.1.2", "chart.js": "^4.4.8", "pinia": "^3.0.1", - "unhead": "^2.0.2", + "unhead": "^2.0.3", "unocss": "66.0.0", "unocss-preset-primitives": "0.0.2-beta.1", "vite-plugin-vue-layouts": "^0.11.0", diff --git a/storage/framework/core/utils/package.json b/storage/framework/core/utils/package.json index 6461907470..6334b5ae30 100644 --- a/storage/framework/core/utils/package.json +++ b/storage/framework/core/utils/package.json @@ -78,6 +78,6 @@ "resize-observer-polyfill": "^1.5.1", "vue-starport": "^0.4.0", "vue3-ace-editor": "^2.2.4", - "yaml": "^2.7.0" + "yaml": "^2.7.1" } } diff --git a/storage/framework/core/vite-config/package.json b/storage/framework/core/vite-config/package.json index 4ffbc084b2..98700f0dd9 100644 --- a/storage/framework/core/vite-config/package.json +++ b/storage/framework/core/vite-config/package.json @@ -90,12 +90,12 @@ "unplugin-auto-import": "^19.1.2", "unplugin-vue-components": "^28.4.1", "unplugin-vue-markdown": "^28.3.1", - "vite": "^6.2.3", + "vite": "^6.2.4", "vite-plugin-full-reload": "^1.2.0", "vite-plugin-inspect": "^11.0.0", "vite-plugin-local": "^0.5.0", "vite-plugin-pwa": "^1.0.0", - "vite-ssg": "^26.1.0", + "vite-ssg": "^26.1.1", "vite-ssg-sitemap": "^0.8.1 " } } diff --git a/storage/framework/core/vite-plugin/package.json b/storage/framework/core/vite-plugin/package.json index a60d9fa7ef..a72c842cf4 100644 --- a/storage/framework/core/vite-plugin/package.json +++ b/storage/framework/core/vite-plugin/package.json @@ -96,11 +96,11 @@ "unplugin-auto-import": "^19.1.2", "unplugin-vue-components": "^28.4.1", "unplugin-vue-markdown": "^28.3.1", - "vite": "^6.2.3", + "vite": "^6.2.4", "vite-plugin-full-reload": "^1.2.0", "vite-plugin-inspect": "^11.0.0", "vite-plugin-pwa": "^1.0.0", - "vite-ssg": "^26.1.0", + "vite-ssg": "^26.1.1", "vite-ssg-sitemap": "^0.8.1" } } diff --git a/storage/framework/defaults/ide/vscode/package.json b/storage/framework/defaults/ide/vscode/package.json index 219533e647..dabaed5c24 100644 --- a/storage/framework/defaults/ide/vscode/package.json +++ b/storage/framework/defaults/ide/vscode/package.json @@ -57,6 +57,6 @@ "vue.volar" ], "devDependencies": { - "@vscode/vsce": "^3.3.1" + "@vscode/vsce": "^3.3.2" } } diff --git a/storage/framework/server/Dockerfile b/storage/framework/server/Dockerfile index 441c1ee5b1..8d71dc9ecb 100644 --- a/storage/framework/server/Dockerfile +++ b/storage/framework/server/Dockerfile @@ -1,5 +1,5 @@ # Build stage -FROM oven/bun:1.2.7-debian AS builder +FROM oven/bun:1.2.8-debian AS builder WORKDIR /usr/src # Copy source files @@ -15,7 +15,7 @@ COPY ./tsconfig.docker.json ./tsconfig.json # RUN bun run build # Final stage -FROM oven/bun:1.2.7-debian AS release +FROM oven/bun:1.2.8-debian AS release WORKDIR /usr/src # Copy built files from builder stage diff --git a/storage/framework/views/dashboard/src-tauri/Cargo.toml b/storage/framework/views/dashboard/src-tauri/Cargo.toml index af2e701271..64cd727a3f 100644 --- a/storage/framework/views/dashboard/src-tauri/Cargo.toml +++ b/storage/framework/views/dashboard/src-tauri/Cargo.toml @@ -12,12 +12,12 @@ rust-version = "1.74.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [build-dependencies] -tauri-build = { version = "2.1.0", features = [] } +tauri-build = { version = "2.1.1", features = [] } [dependencies] serde_json = "1.0.140" serde = { version = "1.0.219", features = [ "derive" ] } -tauri = { version = "2.4.0", features = [] } +tauri = { version = "2.4.1", features = [] } [features] # this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled. diff --git a/storage/framework/views/desktop/src-tauri/Cargo.toml b/storage/framework/views/desktop/src-tauri/Cargo.toml index af2e701271..64cd727a3f 100644 --- a/storage/framework/views/desktop/src-tauri/Cargo.toml +++ b/storage/framework/views/desktop/src-tauri/Cargo.toml @@ -12,12 +12,12 @@ rust-version = "1.74.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [build-dependencies] -tauri-build = { version = "2.1.0", features = [] } +tauri-build = { version = "2.1.1", features = [] } [dependencies] serde_json = "1.0.140" serde = { version = "1.0.219", features = [ "derive" ] } -tauri = { version = "2.4.0", features = [] } +tauri = { version = "2.4.1", features = [] } [features] # this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled. diff --git a/storage/framework/views/web/package.json b/storage/framework/views/web/package.json index becf86e05e..e276a6e05f 100644 --- a/storage/framework/views/web/package.json +++ b/storage/framework/views/web/package.json @@ -15,7 +15,7 @@ "@stacksjs/alias": "workspace:*", "@stacksjs/config": "workspace:*", "@stacksjs/server": "workspace:*", - "@unhead/vue": "^2.0.2", + "@unhead/vue": "^2.0.3", "@unocss/reset": "66.0.0", "@vueuse/core": "^13.0.0", "@vueuse/head": "^2.0.0", @@ -35,20 +35,20 @@ "@vue-macros/volar": "^0.30.15", "@vue/test-utils": "^2.4.6", "markdown-it-link-attributes": "^4.0.1", - "rollup": "^4.37.0", + "rollup": "^4.39.0", "shiki": "^3.2.1", "unocss": "66.0.0", "unplugin-auto-import": "^19.1.2", "unplugin-vue-components": "^28.4.1", "unplugin-vue-markdown": "^28.3.1", "unplugin-vue-router": "^0.12.0", - "vite": "^6.2.3", + "vite": "^6.2.4", "vite-bundle-visualizer": "^1.2.1", "vite-plugin-inspect": "^11.0.0", "vite-plugin-pwa": "^1.0.0", "vite-plugin-vue-devtools": "^7.7.2", "vite-plugin-vue-layouts": "^0.11.0", - "vite-ssg": "^26.1.0", + "vite-ssg": "^26.1.1", "vite-ssg-sitemap": "^0.8.1", "vue-tsc": "^2.2.8" } From 57198c3495bb71de4339c583f291b7b342e66f8e Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 3 Apr 2025 01:40:34 +0800 Subject: [PATCH 61/78] chore: logging updates and exclude desktop --- storage/framework/core/build.ts | 2 +- storage/framework/core/logging/package.json | 1 + storage/framework/core/logging/src/index.ts | 28 +++++++++++++-------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/storage/framework/core/build.ts b/storage/framework/core/build.ts index cb25e232cd..8ac5bff430 100644 --- a/storage/framework/core/build.ts +++ b/storage/framework/core/build.ts @@ -24,7 +24,7 @@ dirs.push(...components) const startTime = Date.now() for (const dir of dirs) { - if (dir.includes('bun-create') || dir.includes('dist')) + if (dir.includes('bun-create') || dir.includes('dist') || dir.includes('core/desktop')) continue console.log(`Building ${dir}`) diff --git a/storage/framework/core/logging/package.json b/storage/framework/core/logging/package.json index a9c6a3e712..a691212930 100644 --- a/storage/framework/core/logging/package.json +++ b/storage/framework/core/logging/package.json @@ -41,6 +41,7 @@ "@stacksjs/path": "workspace:*", "@stacksjs/storage": "workspace:*", "@stacksjs/validation": "workspace:*", + "@stacksjs/clarity": "^0.3.2", "typescript": "^5.8.2" } } diff --git a/storage/framework/core/logging/src/index.ts b/storage/framework/core/logging/src/index.ts index 3e45e39868..5acc4c3993 100644 --- a/storage/framework/core/logging/src/index.ts +++ b/storage/framework/core/logging/src/index.ts @@ -4,6 +4,14 @@ import { buddyOptions, stripAnsi } from '@stacksjs/cli' import { handleError, writeToLogFile } from '@stacksjs/error-handling' import { ExitCode } from '@stacksjs/types' import { consola, createConsola } from 'consola' +import * as p from '@stacksjs/path' +import { Logger } from '@stacksjs/clarity' + +const clarityLog = new Logger('stacks', { + level: 'debug', + logDirectory: p.projectPath('storage/logs'), +}) + // import type { Prompt } from '@stacksjs/cli' @@ -80,30 +88,30 @@ export const log: Log = { info: async (message: string, options?: LogOptions) => { if (options?.styled === false) console.log(message) - else logger.info(message) - await writeToLogFile(`INFO: ${stripAnsi(message)}`) + // else clarityLog.info(message) + // await writeToLogFile(`INFO: ${stripAnsi(message)}`) }, success: async (message: string, options?: LogOptions) => { if (options?.styled === false) console.log(message) - else logger.success(message) - await writeToLogFile(`SUCCESS: ${stripAnsi(message)}`) + else clarityLog.success(message) + // await writeToLogFile(`SUCCESS: ${stripAnsi(message)}`) }, warn: async (message: string, options?: LogOptions) => { if (options?.styled === false) console.log(message) - else logger.warn(message) - await writeToLogFile(`WARN: ${stripAnsi(message)}`) + else clarityLog.warn(message) + // await writeToLogFile(`WARN: ${stripAnsi(message)}`) }, /** alias for `log.warn()`. */ warning: async (message: string, options?: LogOptions) => { if (options?.styled === false) console.log(message) - else logger.warn(message) - await writeToLogFile(`WARN: ${stripAnsi(message)}`) + else clarityLog.warn(message) + // await writeToLogFile(`WARN: ${stripAnsi(message)}`) }, error: async (err: string | Error | object | unknown, options?: ErrorOptions) => { @@ -117,8 +125,8 @@ export const log: Log = { if (process.env.APP_ENV === 'production' || process.env.APP_ENV === 'prod') return writeToLogFile(message) - logger.debug(message) - await writeToLogFile(stripAnsi(message)) + clarityLog.debug(message) + // await writeToLogFile(stripAnsi(message)) }, dump: (...args: any[]) => args.forEach(arg => console.log(arg)), From e8c70128c4ab14d72e7601b94df303735fe32c49 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Thu, 3 Apr 2025 20:02:43 +0800 Subject: [PATCH 62/78] chore: wip --- .../Commerce/DeliveryRouteIndexAction.ts | 4 +- app/Actions/Commerce/OrderExportAction.ts | 15 ++ .../core/browser/src/composables/useFetch.ts | 120 ++++++++++ .../framework/core/browser/src/utils/fetch.ts | 122 ++++++++++ .../framework/core/browser/src/utils/index.ts | 2 +- .../core/commerce/src/orders/index.ts | 1 - .../defaults/functions/commerce/customers.ts | 40 ++++ storage/framework/orm/routes.ts | 218 ------------------ 8 files changed, 300 insertions(+), 222 deletions(-) create mode 100644 app/Actions/Commerce/OrderExportAction.ts create mode 100644 storage/framework/core/browser/src/composables/useFetch.ts create mode 100644 storage/framework/core/browser/src/utils/fetch.ts create mode 100644 storage/framework/defaults/functions/commerce/customers.ts diff --git a/app/Actions/Commerce/DeliveryRouteIndexAction.ts b/app/Actions/Commerce/DeliveryRouteIndexAction.ts index 19e2a2a729..7b94ccd892 100644 --- a/app/Actions/Commerce/DeliveryRouteIndexAction.ts +++ b/app/Actions/Commerce/DeliveryRouteIndexAction.ts @@ -1,6 +1,6 @@ import { Action } from '@stacksjs/actions' -import { deliveryRoutes } from '@stacksjs/commerce' +import { shippings } from '@stacksjs/commerce' import { response } from '@stacksjs/router' @@ -9,7 +9,7 @@ export default new Action({ description: 'DeliveryRoute Index ORM Action', method: 'GET', async handle() { - const results = await deliveryRoutes.fetchAll() + const results = await shippings.routes.fetchAll() return response.json(results) }, diff --git a/app/Actions/Commerce/OrderExportAction.ts b/app/Actions/Commerce/OrderExportAction.ts new file mode 100644 index 0000000000..be8d8991f3 --- /dev/null +++ b/app/Actions/Commerce/OrderExportAction.ts @@ -0,0 +1,15 @@ +import { Action } from '@stacksjs/actions' +import { orders } from '@stacksjs/commerce' + +import { response } from '@stacksjs/router' + +export default new Action({ + name: 'Order Export', + description: 'Order Export ORM Action', + method: 'GET', + async handle() { + const results = await orders.exportOrders() + + return response.json(results) + }, +}) diff --git a/storage/framework/core/browser/src/composables/useFetch.ts b/storage/framework/core/browser/src/composables/useFetch.ts new file mode 100644 index 0000000000..3d3a9ac652 --- /dev/null +++ b/storage/framework/core/browser/src/composables/useFetch.ts @@ -0,0 +1,120 @@ +import type { Ref } from 'vue' +import { ofetch } from 'ofetch' +import { ref } from 'vue' + +interface Params { + [key: string]: any +} + +type FetchResponse = string | Blob | ArrayBuffer | ReadableStream + +interface UseFetchReturn { + get: (url: string, params?: Params, headers?: Headers) => Promise + post: (url: string, params?: Params, headers?: Headers) => Promise + patch: (url: string, params?: Params, headers?: Headers) => Promise + put: (url: string, params?: Params, headers?: Headers) => Promise + destroy: (url: string, params?: Params, headers?: Headers) => Promise + setToken: (authToken: string) => void + loading: Ref + token: Ref + baseURL: Ref +} + +export function useFetch(): UseFetchReturn { + const loading = ref(false) + const token = ref('') + const baseURL = ref('/') + + const setToken = (authToken: string): void => { + token.value = authToken + } + + const getHeaders = (headers?: Headers): Headers | undefined => { + if (headers && token.value) { + headers.set('Authorization', `Bearer ${token.value}`) + } + return headers + } + + const get = async (url: string, params?: Params, headers?: Headers): Promise => { + return await ofetch(url, { + method: 'GET', + baseURL: baseURL.value, + params, + headers: getHeaders(headers), + }) + } + + const post = async (url: string, params?: Params, headers?: Headers): Promise => { + loading.value = true + try { + const result = await ofetch(url, { + method: 'POST', + baseURL: baseURL.value, + params, + headers: getHeaders(headers), + }) + return result + } + finally { + loading.value = false + } + } + + const patch = async (url: string, params?: Params, headers?: Headers): Promise => { + loading.value = true + try { + return await ofetch(url, { + method: 'PATCH', + baseURL: baseURL.value, + params, + headers: getHeaders(headers), + }) + } + finally { + loading.value = false + } + } + + const put = async (url: string, params?: Params, headers?: Headers): Promise => { + loading.value = true + try { + return await ofetch(url, { + method: 'PUT', + baseURL: baseURL.value, + params, + headers: getHeaders(headers), + }) + } + finally { + loading.value = false + } + } + + const destroy = async (url: string, params?: Params, headers?: Headers): Promise => { + loading.value = true + try { + return await ofetch(url, { + method: 'DELETE', + baseURL: baseURL.value, + params, + headers: getHeaders(headers), + }) + } + finally { + loading.value = false + } + } + + return { + get, + post, + patch, + put, + destroy, + setToken, + loading, + token, + baseURL, + } +} diff --git a/storage/framework/core/browser/src/utils/fetch.ts b/storage/framework/core/browser/src/utils/fetch.ts new file mode 100644 index 0000000000..2a073b7924 --- /dev/null +++ b/storage/framework/core/browser/src/utils/fetch.ts @@ -0,0 +1,122 @@ +import { ofetch } from 'ofetch' + +interface Params { + [key: string]: any // Replace 'any' with more specific types if possible +} + +interface ApiFetch { + get: (url: string, params?: Params, header?: Headers) => Promise + post: (url: string, params?: Params, header?: Headers) => Promise + destroy: (url: string, params?: Params, header?: Headers) => Promise + patch: (url: string, params?: Params, header?: Headers) => Promise + put: (url: string, params?: Params, header?: Headers) => Promise + setToken: (authToken: string) => void + baseURL: '/' | string + loading: boolean + token: string +} + +type FetchResponse = string | Blob | ArrayBuffer | ReadableStream + +let loading = false +let token = '' +const baseURL = '/' + +async function get(url: string, params?: Params, headers?: Headers): Promise { + if (headers) { + if (token) + headers.set('Authorization', `Bearer ${token}`) + } + + return await ofetch(url, { method: 'GET', baseURL, params, headers }) +} + +async function post(url: string, params?: Params, headers?: Headers): Promise { + if (headers) { + if (token) + headers.set('Authorization', `Bearer ${token}`) + } + + loading = true + + try { + const result: string | FetchResponse | Blob | ArrayBuffer | ReadableStream = await ofetch(url, { + method: 'POST', + baseURL, + params, + headers, + }) + + loading = false + return result + } + catch (err: any) { + loading = false + + throw err + } +} + +async function patch(url: string, params?: Params, headers?: Headers): Promise { + if (headers) { + if (token) + headers.set('Authorization', `Bearer ${token}`) + } + + loading = true + + return await ofetch(url, { + method: 'PATCH', + baseURL, + params, + headers, + }) +} + +async function put(url: string, params?: Params, headers?: Headers): Promise { + if (headers) { + if (token) + headers.set('Authorization', `Bearer ${token}`) + } + + loading = true + + return await ofetch(url, { + method: 'PUT', + baseURL, + params, + headers, + }) +} + +async function destroy(url: string, params?: Params, headers?: Headers): Promise { + if (headers) { + if (token) + headers.set('Authorization', `Bearer ${token}`) + } + + loading = true + + return await ofetch(url, { + method: 'DELETE', + baseURL, + params, + headers, + }) +} + +function setToken(authToken: string): void { + token = authToken +} + +export const Fetch: ApiFetch = { + get, + post, + patch, + put, + destroy, + baseURL, + token, + setToken, + loading, +} diff --git a/storage/framework/core/browser/src/utils/index.ts b/storage/framework/core/browser/src/utils/index.ts index d756d65c02..8fa61f380b 100644 --- a/storage/framework/core/browser/src/utils/index.ts +++ b/storage/framework/core/browser/src/utils/index.ts @@ -2,7 +2,7 @@ export * from './base' export * from './billable' export * from './date' export * from './debounce' -export * from './function' +export * from './fetch' export * from './guards' export * from './lazy' export * from './math' diff --git a/storage/framework/core/commerce/src/orders/index.ts b/storage/framework/core/commerce/src/orders/index.ts index 39d8b1ccb6..36bd2f15ec 100644 --- a/storage/framework/core/commerce/src/orders/index.ts +++ b/storage/framework/core/commerce/src/orders/index.ts @@ -21,7 +21,6 @@ export { } from './fetch' export { - bulkStore, store, } from './store' diff --git a/storage/framework/defaults/functions/commerce/customers.ts b/storage/framework/defaults/functions/commerce/customers.ts new file mode 100644 index 0000000000..f8488e3b40 --- /dev/null +++ b/storage/framework/defaults/functions/commerce/customers.ts @@ -0,0 +1,40 @@ +import { fetch } from '@stacksjs/browser' +import { useStorage } from '@vueuse/core' + +// Create a persistent customers array using VueUse's useStorage +const customers = useStorage('customers', []) + +// Basic fetch function to get all customers +async function fetchCustomers() { + try { + const response = await fetch('/api/commerce/customers') + + if (!response.ok) { + throw new Error(`HTTP error! Status: ${response.status}`) + } + + const data = await response.json() + + // Ensure data is an array before assigning + if (Array.isArray(data)) { + customers.value = data + return data + } + else { + console.error('Expected array of customers but received:', typeof data) + return [] + } + } + catch (error) { + console.error('Error fetching customers:', error) + return [] + } +} + +// Export the composable +export function useCustomers() { + return { + customers, + fetchCustomers, + } +} diff --git a/storage/framework/orm/routes.ts b/storage/framework/orm/routes.ts index cca8927054..31abba244f 100644 --- a/storage/framework/orm/routes.ts +++ b/storage/framework/orm/routes.ts @@ -6,224 +6,6 @@ route.post('users', 'UserStoreOrmAction') route.get('users/{id}', 'UserShowOrmAction') -route.get('print-devices', 'PrintDeviceIndexOrmAction') - -route.post('print-devices', 'PrintDeviceStoreOrmAction') - -route.get('print-devices/{id}', 'PrintDeviceShowOrmAction') - -route.patch('print-devices/{id}', 'PrintDeviceUpdateOrmAction') - -route.delete('print-devices/{id}', 'PrintDeviceDestroyOrmAction') - -route.get('product-categories', 'CategoryIndexOrmAction') - -route.post('product-categories', 'CategoryStoreOrmAction') - -route.get('product-categories/{id}', 'CategoryShowOrmAction') - -route.get('payments', 'PaymentIndexOrmAction') - -route.post('payments', 'PaymentStoreOrmAction') - -route.get('payments/{id}', 'PaymentShowOrmAction') - -route.get('drivers', 'DriverIndexOrmAction') - -route.post('drivers', 'DriverStoreOrmAction') - -route.get('drivers/{id}', 'DriverShowOrmAction') - -route.patch('drivers/{id}', 'DriverUpdateOrmAction') - -route.delete('drivers/{id}', 'DriverDestroyOrmAction') - -route.get('waitlist-products', 'WaitlistProductIndexOrmAction') - -route.post('waitlist-products', 'WaitlistProductStoreOrmAction') - -route.get('waitlist-products/{id}', 'WaitlistProductShowOrmAction') - -route.patch('waitlist-products/{id}', 'WaitlistProductUpdateOrmAction') - -route.delete('waitlist-products/{id}', 'WaitlistProductDestroyOrmAction') - -route.get('digital-deliveries', 'DigitalDeliveryIndexOrmAction') - -route.post('digital-deliveries', 'DigitalDeliveryStoreOrmAction') - -route.get('digital-deliveries/{id}', 'DigitalDeliveryShowOrmAction') - -route.patch('digital-deliveries/{id}', 'DigitalDeliveryUpdateOrmAction') - -route.delete('digital-deliveries/{id}', 'DigitalDeliveryDestroyOrmAction') - -route.get('product-manufacturers', 'ManufacturerIndexOrmAction') - -route.post('product-manufacturers', 'ManufacturerStoreOrmAction') - -route.get('product-manufacturers/{id}', 'ManufacturerShowOrmAction') - -route.get('shipping-zones', 'ShippingZoneIndexOrmAction') - -route.post('shipping-zones', 'ShippingZoneStoreOrmAction') - -route.get('shipping-zones/{id}', 'ShippingZoneShowOrmAction') - -route.patch('shipping-zones/{id}', 'ShippingZoneUpdateOrmAction') - -route.delete('shipping-zones/{id}', 'ShippingZoneDestroyOrmAction') - -route.get('customers', 'CustomerIndexOrmAction') - -route.post('customers', 'CustomerStoreOrmAction') - -route.get('customers/{id}', 'CustomerShowOrmAction') - -route.patch('customers/{id}', 'CustomerUpdateOrmAction') - -route.delete('customers/{id}', 'CustomerDestroyOrmAction') - -route.get('products', 'ProductIndexOrmAction') - -route.post('products', 'ProductStoreOrmAction') - -route.get('products/{id}', 'ProductShowOrmAction') - -route.get('print-logs', 'ReceiptIndexOrmAction') - -route.post('print-logs', 'ReceiptStoreOrmAction') - -route.get('print-logs/{id}', 'ReceiptShowOrmAction') - -route.patch('print-logs/{id}', 'ReceiptUpdateOrmAction') - -route.delete('print-logs/{id}', 'ReceiptDestroyOrmAction') - -route.get('product-variants', 'ProductVariantIndexOrmAction') - -route.post('product-variants', 'ProductVariantStoreOrmAction') - -route.get('product-variants/{id}', 'ProductVariantShowOrmAction') - -route.patch('product-variants/{id}', 'ProductVariantUpdateOrmAction') - -route.delete('product-variants/{id}', 'ProductVariantDestroyOrmAction') - -route.get('license-keys', 'LicenseKeyIndexOrmAction') - -route.post('license-keys', 'LicenseKeyStoreOrmAction') - -route.get('license-keys/{id}', 'LicenseKeyShowOrmAction') - -route.patch('license-keys/{id}', 'LicenseKeyUpdateOrmAction') - -route.delete('license-keys/{id}', 'LicenseKeyDestroyOrmAction') - -route.get('waitlist-restaurants', 'WaitlistRestaurantIndexOrmAction') - -route.post('waitlist-restaurants', 'WaitlistRestaurantStoreOrmAction') - -route.get('waitlist-restaurants/{id}', 'WaitlistRestaurantShowOrmAction') - -route.patch('waitlist-restaurants/{id}', 'WaitlistRestaurantUpdateOrmAction') - -route.delete('waitlist-restaurants/{id}', 'WaitlistRestaurantDestroyOrmAction') - -route.get('product-reviews', 'ReviewIndexOrmAction') - -route.post('product-reviews', 'ReviewStoreOrmAction') - -route.get('product-reviews/{id}', 'ReviewShowOrmAction') - -route.get('product-units', 'ProductUnitIndexOrmAction') - -route.post('product-units', 'ProductUnitStoreOrmAction') - -route.get('product-units/{id}', 'ProductUnitShowOrmAction') - -route.get('gift-cards', 'GiftCardIndexOrmAction') - -route.post('gift-cards', 'GiftCardStoreOrmAction') - -route.get('gift-cards/{id}', 'GiftCardShowOrmAction') - -route.get('orders', 'OrderIndexOrmAction') - -route.post('orders', 'OrderStoreOrmAction') - -route.get('orders/{id}', 'OrderShowOrmAction') - -route.get('coupons', 'CouponIndexOrmAction') - -route.post('coupons', 'CouponStoreOrmAction') - -route.get('coupons/{id}', 'CouponShowOrmAction') - -route.get('tax-rates', 'TaxRateIndexOrmAction') - -route.post('tax-rates', 'TaxRateStoreOrmAction') - -route.get('tax-rates/{id}', 'TaxRateShowOrmAction') - -route.patch('tax-rates/{id}', 'TaxRateUpdateOrmAction') - -route.delete('tax-rates/{id}', 'TaxRateDestroyOrmAction') - -route.get('transactions', 'TransactionIndexOrmAction') - -route.post('transactions', 'TransactionStoreOrmAction') - -route.get('transactions/{id}', 'TransactionShowOrmAction') - -route.get('loyalty-points', 'LoyaltyPointIndexOrmAction') - -route.post('loyalty-points', 'LoyaltyPointStoreOrmAction') - -route.get('loyalty-points/{id}', 'LoyaltyPointShowOrmAction') - -route.get('product-items', 'ProductItemIndexOrmAction') - -route.post('product-items', 'ProductItemStoreOrmAction') - -route.get('product-items/{id}', 'ProductItemShowOrmAction') - -route.get('loyalty-rewards', 'LoyaltyRewardIndexOrmAction') - -route.post('loyalty-rewards', 'LoyaltyRewardStoreOrmAction') - -route.get('loyalty-rewards/{id}', 'LoyaltyRewardShowOrmAction') - -route.get('shipping-methods', 'ShippingMethodIndexOrmAction') - -route.post('shipping-methods', 'ShippingMethodStoreOrmAction') - -route.get('shipping-methods/{id}', 'ShippingMethodShowOrmAction') - -route.patch('shipping-methods/{id}', 'ShippingMethodUpdateOrmAction') - -route.delete('shipping-methods/{id}', 'ShippingMethodDestroyOrmAction') - -route.get('shipping-rates', 'ShippingRateIndexOrmAction') - -route.post('shipping-rates', 'ShippingRateStoreOrmAction') - -route.get('shipping-rates/{id}', 'ShippingRateShowOrmAction') - -route.patch('shipping-rates/{id}', 'ShippingRateUpdateOrmAction') - -route.delete('shipping-rates/{id}', 'ShippingRateDestroyOrmAction') - -route.get('delivery-routes', 'DeliveryRouteIndexOrmAction') - -route.post('delivery-routes', 'DeliveryRouteStoreOrmAction') - -route.get('delivery-routes/{id}', 'DeliveryRouteShowOrmAction') - -route.patch('delivery-routes/{id}', 'DeliveryRouteUpdateOrmAction') - -route.delete('delivery-routes/{id}', 'DeliveryRouteDestroyOrmAction') - route.get('requests', 'storage/framework/actions/src/RequestIndexOrmAction.ts') route.get('requests/{id}', 'storage/framework/actions/src/RequestShowOrmAction.ts') From 926acc6e8a1a1995231f903695b963023d533ab3 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Thu, 3 Apr 2025 20:27:06 +0800 Subject: [PATCH 63/78] chore: wip --- bun.lock | 191 ++++++++++-------- routes/api.ts | 167 +++++++++++++++ .../defaults/functions/commerce/customers.ts | 10 +- storage/framework/defaults/types/customer.ts | 14 ++ 4 files changed, 298 insertions(+), 84 deletions(-) create mode 100644 storage/framework/defaults/types/customer.ts diff --git a/bun.lock b/bun.lock index 57b6bb8689..3d882281a7 100644 --- a/bun.lock +++ b/bun.lock @@ -97,7 +97,7 @@ "name": "@stacksjs/ai", "version": "0.70.22", "devDependencies": { - "@aws-sdk/client-bedrock-runtime": "^3.778.0", + "@aws-sdk/client-bedrock-runtime": "^3.779.0", "@aws-sdk/credential-providers": "^3.778.0", "@stacksjs/development": "workspace:*", "aws-sdk-client-mock": "^4.1.0", @@ -319,7 +319,7 @@ "kolorist": "1.8.0", "ora": "^8.2.0", "prompts": "^2.4.2", - "supports-hyperlinks": "^3.2.0", + "supports-hyperlinks": "^4.0.0", }, }, "storage/framework/core/cloud": { @@ -331,14 +331,14 @@ "@aws-sdk/client-cloudfront": "^3.777.0", "@aws-sdk/client-cloudwatch-logs": "^3.777.0", "@aws-sdk/client-dynamodb": "3.777.0", - "@aws-sdk/client-ec2": "^3.777.0", + "@aws-sdk/client-ec2": "^3.779.0", "@aws-sdk/client-efs": "^3.777.0", "@aws-sdk/client-iam": "^3.777.0", "@aws-sdk/client-lambda": "^3.777.0", "@aws-sdk/client-route-53-domains": "^3.777.0", - "@aws-sdk/client-s3": "^3.777.0", + "@aws-sdk/client-s3": "^3.779.0", "@aws-sdk/client-ses": "^3.777.0", - "@aws-sdk/client-sesv2": "^3.777.0", + "@aws-sdk/client-sesv2": "^3.779.0", "@aws-sdk/client-ssm": "^3.777.0", "@stacksjs/cli": "workspace:*", "@stacksjs/config": "workspace:*", @@ -352,7 +352,7 @@ "@stacksjs/utils": "workspace:*", "@stacksjs/validation": "workspace:*", "aws-cdk": "^2.1006.0", - "aws-cdk-lib": "^2.186.0", + "aws-cdk-lib": "^2.187.0", "aws4fetch": "^1.0.20", "constructs": "^10.4.2", "source-map-support": "^0.5.21", @@ -671,7 +671,7 @@ }, "devDependencies": { "@iconify-json/hugeicons": "^1.2.4", - "@microsoft/api-extractor": "^7.52.1", + "@microsoft/api-extractor": "^7.52.2", "@stacksjs/alias": "workspace:*", "@stacksjs/development": "workspace:*", "@stacksjs/dialog": "workspace:*", @@ -705,7 +705,7 @@ }, "devDependencies": { "@stacksjs/development": "workspace:*", - "vite": "^6.2.3", + "vite": "^6.2.4", }, }, "storage/framework/core/components/transition": { @@ -796,8 +796,8 @@ "@stacksjs/build": "workspace:*", "@stacksjs/development": "workspace:*", "@stacksjs/server": "workspace:*", - "@tauri-apps/api": "^2.4.0", - "@tauri-apps/cli": "^2.4.0", + "@tauri-apps/api": "^2.4.1", + "@tauri-apps/cli": "^2.4.1", "@types/d3": "^7.4.3", "d3": "^7.9.0", "unified-network": "^0.6.4", @@ -837,7 +837,7 @@ "@stacksjs/storage": "workspace:*", "@stacksjs/strings": "workspace:*", "@stacksjs/whois": "workspace:*", - "aws-cdk-lib": "^2.186.0", + "aws-cdk-lib": "^2.187.0", }, }, "storage/framework/core/docs": { @@ -970,6 +970,7 @@ "name": "@stacksjs/logging", "version": "0.70.22", "devDependencies": { + "@stacksjs/clarity": "^0.3.2", "@stacksjs/cli": "workspace:*", "@stacksjs/config": "workspace:*", "@stacksjs/error-handling": "workspace:*", @@ -1077,7 +1078,7 @@ "name": "buddy", "version": "0.70.22", "devDependencies": { - "@raycast/api": "^1.94.2", + "@raycast/api": "^1.94.3", "@raycast/utils": "^1.19.1", "@stacksjs/development": "workspace:*", "typescript": "^5.8.2", @@ -1165,7 +1166,7 @@ "@stacksjs/router": "workspace:*", "@stacksjs/validation": "workspace:*", "bun-plugin-auto-imports": "^0.3.1", - "vite": "^6.2.3", + "vite": "^6.2.4", }, }, "storage/framework/core/shell": { @@ -1202,7 +1203,7 @@ "name": "@stacksjs/storage", "version": "0.70.22", "devDependencies": { - "@aws-sdk/client-s3": "^3.777.0", + "@aws-sdk/client-s3": "^3.779.0", "@flystorage/aws-s3": "^1.0.1", "@flystorage/chaos": "^1.0.0", "@flystorage/file-storage": "^1.0.1", @@ -1273,7 +1274,7 @@ "@types/minimatch": "^5.1.2", "@types/nprogress": "^0.2.3", "@vinejs/vine": "^3.0.1", - "aws-cdk-lib": "^2.186.0", + "aws-cdk-lib": "^2.187.0", "cac": "^6.7.14", "markdown-it": "^14.1.0", "meilisearch": "^0.49.0", @@ -1283,10 +1284,10 @@ "unocss": "66.0.0", "unplugin-auto-import": "^19.1.2", "unplugin-vue-components": "^28.4.1", - "vite": "^6.2.3", + "vite": "^6.2.4", "vite-plugin-inspect": "^11.0.0", "vite-plugin-pwa": "^1.0.0", - "vite-ssg": "^26.1.0", + "vite-ssg": "^26.1.1", "vitepress": "1.6.3", "vue": "^3.5.13", }, @@ -1297,17 +1298,17 @@ "devDependencies": { "@headlessui/vue": "^1.7.23", "@iconify-json/hugeicons": "^1.2.4", - "@iconify/json": "^2.2.321", + "@iconify/json": "^2.2.323", "@julr/unocss-preset-forms": "^1.0.0", "@stacksjs/build": "workspace:*", "@stacksjs/config": "workspace:*", "@stacksjs/development": "workspace:*", "@stacksjs/router": "workspace:*", - "@unhead/vue": "^2.0.2", + "@unhead/vue": "^2.0.3", "bun-plugin-unocss": "^0.1.2", "chart.js": "^4.4.8", "pinia": "^3.0.1", - "unhead": "^2.0.2", + "unhead": "^2.0.3", "unocss": "66.0.0", "unocss-preset-primitives": "0.0.2-beta.1", "vite-plugin-vue-layouts": "^0.11.0", @@ -1353,7 +1354,7 @@ "resize-observer-polyfill": "^1.5.1", "vue-starport": "^0.4.0", "vue3-ace-editor": "^2.2.4", - "yaml": "^2.7.0", + "yaml": "^2.7.1", }, }, "storage/framework/core/validation": { @@ -1388,12 +1389,12 @@ "unplugin-auto-import": "^19.1.2", "unplugin-vue-components": "^28.4.1", "unplugin-vue-markdown": "^28.3.1", - "vite": "^6.2.3", + "vite": "^6.2.4", "vite-plugin-full-reload": "^1.2.0", "vite-plugin-inspect": "^11.0.0", "vite-plugin-local": "^0.5.0", "vite-plugin-pwa": "^1.0.0", - "vite-ssg": "^26.1.0", + "vite-ssg": "^26.1.1", "vite-ssg-sitemap": "^0.8.1 ", }, }, @@ -1418,11 +1419,11 @@ "unplugin-auto-import": "^19.1.2", "unplugin-vue-components": "^28.4.1", "unplugin-vue-markdown": "^28.3.1", - "vite": "^6.2.3", + "vite": "^6.2.4", "vite-plugin-full-reload": "^1.2.0", "vite-plugin-inspect": "^11.0.0", "vite-plugin-pwa": "^1.0.0", - "vite-ssg": "^26.1.0", + "vite-ssg": "^26.1.1", "vite-ssg-sitemap": "^0.8.1", }, }, @@ -1530,7 +1531,7 @@ "@stacksjs/alias": "workspace:*", "@stacksjs/config": "workspace:*", "@stacksjs/server": "workspace:*", - "@unhead/vue": "^2.0.2", + "@unhead/vue": "^2.0.3", "@unocss/reset": "66.0.0", "@vueuse/core": "^13.0.0", "@vueuse/head": "^2.0.0", @@ -1550,20 +1551,20 @@ "@vue-macros/volar": "^0.30.15", "@vue/test-utils": "^2.4.6", "markdown-it-link-attributes": "^4.0.1", - "rollup": "^4.37.0", + "rollup": "^4.39.0", "shiki": "^3.2.1", "unocss": "66.0.0", "unplugin-auto-import": "^19.1.2", "unplugin-vue-components": "^28.4.1", "unplugin-vue-markdown": "^28.3.1", "unplugin-vue-router": "^0.12.0", - "vite": "^6.2.3", + "vite": "^6.2.4", "vite-bundle-visualizer": "^1.2.1", "vite-plugin-inspect": "^11.0.0", "vite-plugin-pwa": "^1.0.0", "vite-plugin-vue-devtools": "^7.7.2", "vite-plugin-vue-layouts": "^0.11.0", - "vite-ssg": "^26.1.0", + "vite-ssg": "^26.1.1", "vite-ssg-sitemap": "^0.8.1", "vue-tsc": "^2.2.8", }, @@ -1619,11 +1620,11 @@ "@asamuzakjp/css-color": ["@asamuzakjp/css-color@3.1.1", "", { "dependencies": { "@csstools/css-calc": "^2.1.2", "@csstools/css-color-parser": "^3.0.8", "@csstools/css-parser-algorithms": "^3.0.4", "@csstools/css-tokenizer": "^3.0.3", "lru-cache": "^10.4.3" } }, "sha512-hpRD68SV2OMcZCsrbdkccTw5FXjNDLo5OuqSHyHZfwweGsDWZwDJ2+gONyNAbazZclobMirACLw0lk8WVxIqxA=="], - "@aws-cdk/asset-awscli-v1": ["@aws-cdk/asset-awscli-v1@2.2.228", "", {}, "sha512-ToZPI+dEz2BKj//kD2V8oXAvpeBFec5w6tXxIQh/U2iiMLcaUVZw4sxR820jF2GDArZY2D/alVkcSkId0J6rtA=="], + "@aws-cdk/asset-awscli-v1": ["@aws-cdk/asset-awscli-v1@2.2.230", "", {}, "sha512-kUnhKIYu42hqBa6a8x2/7o29ObpJgjYGQy28lZDq9awXyvpR62I2bRxrNKNR3uFUQz3ySuT9JXhGHhuZPdbnFw=="], "@aws-cdk/asset-node-proxy-agent-v6": ["@aws-cdk/asset-node-proxy-agent-v6@2.1.0", "", {}, "sha512-7bY3J8GCVxLupn/kNmpPc5VJz8grx+4RKfnnJiO1LG+uxkZfANZG3RMHhE+qQxxwkyQ9/MfPtTpf748UhR425A=="], - "@aws-cdk/cloud-assembly-schema": ["@aws-cdk/cloud-assembly-schema@40.7.0", "", { "dependencies": { "jsonschema": "~1.4.1", "semver": "^7.7.1" } }, "sha512-00wVKn9pOOGXbeNwA4E8FUFt0zIB4PmSO7PvIiDWgpaFX3G/sWyy0A3s6bg/n2Yvkghu8r4a8ckm+mAzkAYmfA=="], + "@aws-cdk/cloud-assembly-schema": ["@aws-cdk/cloud-assembly-schema@41.2.0", "", { "dependencies": { "jsonschema": "~1.4.1", "semver": "^7.7.1" } }, "sha512-JaulVS6z9y5+u4jNmoWbHZRs9uGOnmn/ktXygNWKNu1k6lF3ad4so3s18eRu15XCbUIomxN9WPYT6Ehh7hzONw=="], "@aws-crypto/crc32": ["@aws-crypto/crc32@5.2.0", "", { "dependencies": { "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "tslib": "^2.6.2" } }, "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg=="], @@ -1641,7 +1642,7 @@ "@aws-sdk/client-bedrock": ["@aws-sdk/client-bedrock@3.777.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-utf8": "^4.0.0", "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" } }, "sha512-+sJ62DRDxv/92p5RQ1PQm5/4+esyoCZgkD5sxsoGR8SgEMr31Qh0L0+LifvFXsapCS02PYmGzHpDWjSAS6B/Aw=="], - "@aws-sdk/client-bedrock-runtime": ["@aws-sdk/client-bedrock-runtime@3.778.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/eventstream-serde-browser": "^4.0.2", "@smithy/eventstream-serde-config-resolver": "^4.1.0", "@smithy/eventstream-serde-node": "^4.0.2", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-stream": "^4.2.0", "@smithy/util-utf8": "^4.0.0", "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" } }, "sha512-FCDwxgzx06JE+QotlJY/DHqu2y6MMVQTa+qxhjZHGBsIqEWDr7wy+b/rtOV/pUxoysKyVx+wmvEwj1e0KlTkOg=="], + "@aws-sdk/client-bedrock-runtime": ["@aws-sdk/client-bedrock-runtime@3.779.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/eventstream-serde-browser": "^4.0.2", "@smithy/eventstream-serde-config-resolver": "^4.1.0", "@smithy/eventstream-serde-node": "^4.0.2", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-stream": "^4.2.0", "@smithy/util-utf8": "^4.0.0", "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" } }, "sha512-MyzZks8XxWwdsA4VlyPW4IekUjpgDI91VwMvEtOITHD8w+9nTGJtD32HcCKNQQCHWYfSoOj7yIoHRisVatR8yw=="], "@aws-sdk/client-cloudformation": ["@aws-sdk/client-cloudformation@3.777.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-utf8": "^4.0.0", "@smithy/util-waiter": "^4.0.3", "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" } }, "sha512-6JhXEeIRNWkXTrohzARxnGXevkC+c4/RONCNhTA2BVcjTa3crTdO13NyddWvL2ExwUOkb1IsElsjd5A2ina7Vg=="], @@ -1653,7 +1654,7 @@ "@aws-sdk/client-dynamodb": ["@aws-sdk/client-dynamodb@3.777.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-endpoint-discovery": "3.775.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-utf8": "^4.0.0", "@smithy/util-waiter": "^4.0.3", "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" } }, "sha512-LgFgdyGh8ZuBnbY1QNc+7ahNy5HFKK9OA6knEKr7UpWYZ0ct41EdPkGrsH9Ea/TMSu/C9p3W4rawwdUkfLepUQ=="], - "@aws-sdk/client-ec2": ["@aws-sdk/client-ec2@3.777.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-sdk-ec2": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-utf8": "^4.0.0", "@smithy/util-waiter": "^4.0.3", "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" } }, "sha512-LX2dxIRCdDDdpwzAGclzHAECDhxp+ca44AVcdFc0v174cJPsPVqK4WevdIefSsHYGqplsC4QFZiHWniUSFFIDg=="], + "@aws-sdk/client-ec2": ["@aws-sdk/client-ec2@3.779.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-sdk-ec2": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-utf8": "^4.0.0", "@smithy/util-waiter": "^4.0.3", "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" } }, "sha512-EgF9E8zXPIV7HXzMh5QnnEEnoslgI3nGNDIUWxLudG10UzUknR0yU1gpiWq78LG7HKKlh2aEC0Vqf4HsmG840Q=="], "@aws-sdk/client-efs": ["@aws-sdk/client-efs@3.777.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-utf8": "^4.0.0", "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" } }, "sha512-gf3OEytblIHEz1tBwEmsO43Ylc2VxC/kVCtRsL8EK6XeLrjPuOqtWnS1xGVjiAkHAyI4/fmYMs6CBOjoHL+wDg=="], @@ -1665,11 +1666,11 @@ "@aws-sdk/client-route-53-domains": ["@aws-sdk/client-route-53-domains@3.777.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-utf8": "^4.0.0", "tslib": "^2.6.2" } }, "sha512-nIA8MfdRn+8Vdcmftg6GQdGcRYDHNw8TPJr79QrX3oOO0nb/fguPh9FihDtxLtLTfuaNdGEbpg4cXk742v5syA=="], - "@aws-sdk/client-s3": ["@aws-sdk/client-s3@3.777.0", "", { "dependencies": { "@aws-crypto/sha1-browser": "5.2.0", "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-bucket-endpoint": "3.775.0", "@aws-sdk/middleware-expect-continue": "3.775.0", "@aws-sdk/middleware-flexible-checksums": "3.775.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-location-constraint": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-sdk-s3": "3.775.0", "@aws-sdk/middleware-ssec": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/signature-v4-multi-region": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@aws-sdk/xml-builder": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/eventstream-serde-browser": "^4.0.2", "@smithy/eventstream-serde-config-resolver": "^4.1.0", "@smithy/eventstream-serde-node": "^4.0.2", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-blob-browser": "^4.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/hash-stream-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/md5-js": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-stream": "^4.2.0", "@smithy/util-utf8": "^4.0.0", "@smithy/util-waiter": "^4.0.3", "tslib": "^2.6.2" } }, "sha512-KVX2QD6lLczZxtzIRCpmztgNnGq+spiMIDYqkum/rCBjCX1YJoDHwMYXaMf2EtAH8tFkJmBiA/CiT/J36iN7Xg=="], + "@aws-sdk/client-s3": ["@aws-sdk/client-s3@3.779.0", "", { "dependencies": { "@aws-crypto/sha1-browser": "5.2.0", "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-bucket-endpoint": "3.775.0", "@aws-sdk/middleware-expect-continue": "3.775.0", "@aws-sdk/middleware-flexible-checksums": "3.775.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-location-constraint": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-sdk-s3": "3.775.0", "@aws-sdk/middleware-ssec": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/signature-v4-multi-region": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@aws-sdk/xml-builder": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/eventstream-serde-browser": "^4.0.2", "@smithy/eventstream-serde-config-resolver": "^4.1.0", "@smithy/eventstream-serde-node": "^4.0.2", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-blob-browser": "^4.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/hash-stream-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/md5-js": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-stream": "^4.2.0", "@smithy/util-utf8": "^4.0.0", "@smithy/util-waiter": "^4.0.3", "tslib": "^2.6.2" } }, "sha512-Lagz+ersQaLNYkpOU9V12PYspT//lGvhPXlKU3OXDj3whDchdqUdtRKY8rmV+jli4KXe+udx/hj2yqrFRfKGvQ=="], "@aws-sdk/client-ses": ["@aws-sdk/client-ses@3.777.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-utf8": "^4.0.0", "@smithy/util-waiter": "^4.0.3", "tslib": "^2.6.2" } }, "sha512-COZ6Yb5qt/JLmWtJG1rGXhvTFnaWHt0X8r9j0uGFuSRhLcguItxYlOnIskYePz/NJ0u/OXYbad0uG1M4V5IJ/w=="], - "@aws-sdk/client-sesv2": ["@aws-sdk/client-sesv2@3.777.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/signature-v4-multi-region": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-utf8": "^4.0.0", "tslib": "^2.6.2" } }, "sha512-Zddw7DjT9QKn66wYfUM1BPlWlVP/98kU17BoXd7573FQSEVTTtOtY8xT23Kq7jXXPAoDQPXq86AItNWRzV/DTg=="], + "@aws-sdk/client-sesv2": ["@aws-sdk/client-sesv2@3.779.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/signature-v4-multi-region": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-utf8": "^4.0.0", "tslib": "^2.6.2" } }, "sha512-Ltwb6FwTu8p/HJ3x7vtWzaTGIa8WJ/SctYF9ai6faZZoHT6td3XW71Ttv1UM2lps/Svlcl1M4tij8nER9f1uNQ=="], "@aws-sdk/client-ssm": ["@aws-sdk/client-ssm@3.777.0", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.775.0", "@aws-sdk/credential-provider-node": "3.777.0", "@aws-sdk/middleware-host-header": "3.775.0", "@aws-sdk/middleware-logger": "3.775.0", "@aws-sdk/middleware-recursion-detection": "3.775.0", "@aws-sdk/middleware-user-agent": "3.775.0", "@aws-sdk/region-config-resolver": "3.775.0", "@aws-sdk/types": "3.775.0", "@aws-sdk/util-endpoints": "3.775.0", "@aws-sdk/util-user-agent-browser": "3.775.0", "@aws-sdk/util-user-agent-node": "3.775.0", "@smithy/config-resolver": "^4.1.0", "@smithy/core": "^3.2.0", "@smithy/fetch-http-handler": "^5.0.2", "@smithy/hash-node": "^4.0.2", "@smithy/invalid-dependency": "^4.0.2", "@smithy/middleware-content-length": "^4.0.2", "@smithy/middleware-endpoint": "^4.1.0", "@smithy/middleware-retry": "^4.1.0", "@smithy/middleware-serde": "^4.0.3", "@smithy/middleware-stack": "^4.0.2", "@smithy/node-config-provider": "^4.0.2", "@smithy/node-http-handler": "^4.0.4", "@smithy/protocol-http": "^5.1.0", "@smithy/smithy-client": "^4.2.0", "@smithy/types": "^4.2.0", "@smithy/url-parser": "^4.0.2", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.8", "@smithy/util-defaults-mode-node": "^4.0.8", "@smithy/util-endpoints": "^3.0.2", "@smithy/util-middleware": "^4.0.2", "@smithy/util-retry": "^4.0.2", "@smithy/util-utf8": "^4.0.0", "@smithy/util-waiter": "^4.0.3", "@types/uuid": "^9.0.1", "tslib": "^2.6.2", "uuid": "^9.0.1" } }, "sha512-iyJmmjzI/OaccP8bRYPWiLQ3zIlrxVLiYWJ5xdJKQjD1bT4UjxAQcTVwyGPd7z9GL5y/BhvCj+CNfo4KVQPAAA=="], @@ -2141,7 +2142,7 @@ "@iconify-json/simple-icons": ["@iconify-json/simple-icons@1.2.29", "", { "dependencies": { "@iconify/types": "*" } }, "sha512-KYrxmxtRz6iOAulRiUsIBMUuXek+H+Evwf8UvYPIkbQ+KDoOqTegHx3q/w3GDDVC0qJYB+D3hXPMZcpm78qIuA=="], - "@iconify/json": ["@iconify/json@2.2.321", "", { "dependencies": { "@iconify/types": "*", "pathe": "^1.1.2" } }, "sha512-0D1OjRK77jD7dhrb4IhGiBTqLufi6I6HaYso6qkSkvm0WqbWgzGnoNEpw+g/jzSJAiLfuBwOGz6b7Q/ZJqsYrw=="], + "@iconify/json": ["@iconify/json@2.2.323", "", { "dependencies": { "@iconify/types": "*", "pathe": "^1.1.2" } }, "sha512-PtRN4hK9OkT2nlEa76A5QT54E6/SOukceKQkOZv9mk44UOlaS/9fhJFNUEA+FBAXEPcnnCQb2nVui+IAn7xTSw=="], "@iconify/types": ["@iconify/types@2.0.0", "", {}, "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg=="], @@ -2333,7 +2334,7 @@ "@publint/pack": ["@publint/pack@0.1.2", "", {}, "sha512-S+9ANAvUmjutrshV4jZjaiG8XQyuJIZ8a4utWmN/vW1sgQ9IfBnPndwkmQYw53QmouOIytT874u65HEmu6H5jw=="], - "@raycast/api": ["@raycast/api@1.94.2", "", { "dependencies": { "@oclif/core": "^4.0.33", "@oclif/plugin-autocomplete": "^3.2.10", "@oclif/plugin-help": "^6.2.18", "@oclif/plugin-not-found": "^3.2.28", "@types/node": "22.13.10", "@types/react": "19.0.10", "esbuild": "^0.25.1", "react": "19.0.0" }, "peerDependencies": { "react-devtools": "6.1.1" }, "optionalPeers": ["react-devtools"], "bin": { "ray": "bin/run.js" } }, "sha512-BtuYJLyw5S8DdbXCa8A8IZu6/JWJ39L7Qni76GMw9xLbleRYS01SjiKSt7gBWmgtUb9+Wcf/Dw2J39mKSZp6bQ=="], + "@raycast/api": ["@raycast/api@1.94.3", "", { "dependencies": { "@oclif/core": "^4.0.33", "@oclif/plugin-autocomplete": "^3.2.10", "@oclif/plugin-help": "^6.2.18", "@oclif/plugin-not-found": "^3.2.28", "@types/node": "22.13.10", "@types/react": "19.0.10", "esbuild": "^0.25.1", "react": "19.0.0" }, "peerDependencies": { "react-devtools": "6.1.1" }, "optionalPeers": ["react-devtools"], "bin": { "ray": "bin/run.js" } }, "sha512-f1d8Tafpc5ZbG9GALzPOmlr3wArjHl6AuylwPys5iFtoRGVWhNr0DWoFjvw3iFd/Or92vqCydH7py9JELKdlJg=="], "@raycast/utils": ["@raycast/utils@1.19.1", "", { "dependencies": { "cross-fetch": "^3.1.6", "dequal": "^2.0.3", "object-hash": "^3.0.0", "signal-exit": "^4.0.2", "stream-chain": "^2.2.5", "stream-json": "^1.8.0" }, "peerDependencies": { "@raycast/api": ">=1.69.0" } }, "sha512-/udUGcTZCgZZwzesmjBkqG5naQZTD/ZLHbqRwkWcF+W97vf9tr9raxKyQjKsdZ17OVllw2T3sHBQsVUdEmCm2g=="], @@ -2353,45 +2354,45 @@ "@rollup/pluginutils": ["@rollup/pluginutils@5.1.4", "", { "dependencies": { "@types/estree": "^1.0.0", "estree-walker": "^2.0.2", "picomatch": "^4.0.2" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" }, "optionalPeers": ["rollup"] }, "sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ=="], - "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.37.0", "", { "os": "android", "cpu": "arm" }, "sha512-l7StVw6WAa8l3vA1ov80jyetOAEo1FtHvZDbzXDO/02Sq/QVvqlHkYoFwDJPIMj0GKiistsBudfx5tGFnwYWDQ=="], + "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.39.0", "", { "os": "android", "cpu": "arm" }, "sha512-lGVys55Qb00Wvh8DMAocp5kIcaNzEFTmGhfFd88LfaogYTRKrdxgtlO5H6S49v2Nd8R2C6wLOal0qv6/kCkOwA=="], - "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.37.0", "", { "os": "android", "cpu": "arm64" }, "sha512-6U3SlVyMxezt8Y+/iEBcbp945uZjJwjZimu76xoG7tO1av9VO691z8PkhzQ85ith2I8R2RddEPeSfcbyPfD4hA=="], + "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.39.0", "", { "os": "android", "cpu": "arm64" }, "sha512-It9+M1zE31KWfqh/0cJLrrsCPiF72PoJjIChLX+rEcujVRCb4NLQ5QzFkzIZW8Kn8FTbvGQBY5TkKBau3S8cCQ=="], - "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.37.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-+iTQ5YHuGmPt10NTzEyMPbayiNTcOZDWsbxZYR1ZnmLnZxG17ivrPSWFO9j6GalY0+gV3Jtwrrs12DBscxnlYA=="], + "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.39.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-lXQnhpFDOKDXiGxsU9/l8UEGGM65comrQuZ+lDcGUx+9YQ9dKpF3rSEGepyeR5AHZ0b5RgiligsBhWZfSSQh8Q=="], - "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.37.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-m8W2UbxLDcmRKVjgl5J/k4B8d7qX2EcJve3Sut7YGrQoPtCIQGPH5AMzuFvYRWZi0FVS0zEY4c8uttPfX6bwYQ=="], + "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.39.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-mKXpNZLvtEbgu6WCkNij7CGycdw9cJi2k9v0noMb++Vab12GZjFgUXD69ilAbBh034Zwn95c2PNSz9xM7KYEAQ=="], - "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.37.0", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-FOMXGmH15OmtQWEt174v9P1JqqhlgYge/bUjIbiVD1nI1NeJ30HYT9SJlZMqdo1uQFyt9cz748F1BHghWaDnVA=="], + "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.39.0", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-jivRRlh2Lod/KvDZx2zUR+I4iBfHcu2V/BA2vasUtdtTN2Uk3jfcZczLa81ESHZHPHy4ih3T/W5rPFZ/hX7RtQ=="], - "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.37.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-SZMxNttjPKvV14Hjck5t70xS3l63sbVwl98g3FlVVx2YIDmfUIy29jQrsw06ewEYQ8lQSuY9mpAPlmgRD2iSsA=="], + "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.39.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-8RXIWvYIRK9nO+bhVz8DwLBepcptw633gv/QT4015CpJ0Ht8punmoHU/DuEd3iw9Hr8UwUV+t+VNNuZIWYeY7Q=="], - "@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.37.0", "", { "os": "linux", "cpu": "arm" }, "sha512-hhAALKJPidCwZcj+g+iN+38SIOkhK2a9bqtJR+EtyxrKKSt1ynCBeqrQy31z0oWU6thRZzdx53hVgEbRkuI19w=="], + "@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.39.0", "", { "os": "linux", "cpu": "arm" }, "sha512-mz5POx5Zu58f2xAG5RaRRhp3IZDK7zXGk5sdEDj4o96HeaXhlUwmLFzNlc4hCQi5sGdR12VDgEUqVSHer0lI9g=="], - "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.37.0", "", { "os": "linux", "cpu": "arm" }, "sha512-jUb/kmn/Gd8epbHKEqkRAxq5c2EwRt0DqhSGWjPFxLeFvldFdHQs/n8lQ9x85oAeVb6bHcS8irhTJX2FCOd8Ag=="], + "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.39.0", "", { "os": "linux", "cpu": "arm" }, "sha512-+YDwhM6gUAyakl0CD+bMFpdmwIoRDzZYaTWV3SDRBGkMU/VpIBYXXEvkEcTagw/7VVkL2vA29zU4UVy1mP0/Yw=="], - "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.37.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-oNrJxcQT9IcbcmKlkF+Yz2tmOxZgG9D9GRq+1OE6XCQwCVwxixYAa38Z8qqPzQvzt1FCfmrHX03E0pWoXm1DqA=="], + "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.39.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-EKf7iF7aK36eEChvlgxGnk7pdJfzfQbNvGV/+l98iiMwU23MwvmV0Ty3pJ0p5WQfm3JRHOytSIqD9LB7Bq7xdQ=="], - "@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.37.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-pfxLBMls+28Ey2enpX3JvjEjaJMBX5XlPCZNGxj4kdJyHduPBXtxYeb8alo0a7bqOoWZW2uKynhHxF/MWoHaGQ=="], + "@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.39.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-vYanR6MtqC7Z2SNr8gzVnzUul09Wi1kZqJaek3KcIlI/wq5Xtq4ZPIZ0Mr/st/sv/NnaPwy/D4yXg5x0B3aUUA=="], - "@rollup/rollup-linux-loongarch64-gnu": ["@rollup/rollup-linux-loongarch64-gnu@4.37.0", "", { "os": "linux", "cpu": "none" }, "sha512-yCE0NnutTC/7IGUq/PUHmoeZbIwq3KRh02e9SfFh7Vmc1Z7atuJRYWhRME5fKgT8aS20mwi1RyChA23qSyRGpA=="], + "@rollup/rollup-linux-loongarch64-gnu": ["@rollup/rollup-linux-loongarch64-gnu@4.39.0", "", { "os": "linux", "cpu": "none" }, "sha512-NMRUT40+h0FBa5fb+cpxtZoGAggRem16ocVKIv5gDB5uLDgBIwrIsXlGqYbLwW8YyO3WVTk1FkFDjMETYlDqiw=="], - "@rollup/rollup-linux-powerpc64le-gnu": ["@rollup/rollup-linux-powerpc64le-gnu@4.37.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-NxcICptHk06E2Lh3a4Pu+2PEdZ6ahNHuK7o6Np9zcWkrBMuv21j10SQDJW3C9Yf/A/P7cutWoC/DptNLVsZ0VQ=="], + "@rollup/rollup-linux-powerpc64le-gnu": ["@rollup/rollup-linux-powerpc64le-gnu@4.39.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-0pCNnmxgduJ3YRt+D+kJ6Ai/r+TaePu9ZLENl+ZDV/CdVczXl95CbIiwwswu4L+K7uOIGf6tMo2vm8uadRaICQ=="], - "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.37.0", "", { "os": "linux", "cpu": "none" }, "sha512-PpWwHMPCVpFZLTfLq7EWJWvrmEuLdGn1GMYcm5MV7PaRgwCEYJAwiN94uBuZev0/J/hFIIJCsYw4nLmXA9J7Pw=="], + "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.39.0", "", { "os": "linux", "cpu": "none" }, "sha512-t7j5Zhr7S4bBtksT73bO6c3Qa2AV/HqiGlj9+KB3gNF5upcVkx+HLgxTm8DK4OkzsOYqbdqbLKwvGMhylJCPhQ=="], - "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.37.0", "", { "os": "linux", "cpu": "none" }, "sha512-DTNwl6a3CfhGTAOYZ4KtYbdS8b+275LSLqJVJIrPa5/JuIufWWZ/QFvkxp52gpmguN95eujrM68ZG+zVxa8zHA=="], + "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.39.0", "", { "os": "linux", "cpu": "none" }, "sha512-m6cwI86IvQ7M93MQ2RF5SP8tUjD39Y7rjb1qjHgYh28uAPVU8+k/xYWvxRO3/tBN2pZkSMa5RjnPuUIbrwVxeA=="], - "@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.37.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-hZDDU5fgWvDdHFuExN1gBOhCuzo/8TMpidfOR+1cPZJflcEzXdCy1LjnklQdW8/Et9sryOPJAKAQRw8Jq7Tg+A=="], + "@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.39.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-iRDJd2ebMunnk2rsSBYlsptCyuINvxUfGwOUldjv5M4tpa93K8tFMeYGpNk2+Nxl+OBJnBzy2/JCscGeO507kA=="], "@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.36.0", "", { "os": "linux", "cpu": "x64" }, "sha512-5KtoW8UWmwFKQ96aQL3LlRXX16IMwyzMq/jSSVIIyAANiE1doaQsx/KRyhAvpHlPjPiSU/AYX/8m+lQ9VToxFQ=="], - "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.37.0", "", { "os": "linux", "cpu": "x64" }, "sha512-E2lPrLKE8sQbY/2bEkVTGDEk4/49UYRVWgj90MY8yPjpnGBQ+Xi1Qnr7b7UIWw1NOggdFQFOLZ8+5CzCiz143w=="], + "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.39.0", "", { "os": "linux", "cpu": "x64" }, "sha512-ThFdkrFDP55AIsIZDKSBWEt/JcWlCzydbZHinZ0F/r1h83qbGeenCt/G/wG2O0reuENDD2tawfAj2s8VK7Bugg=="], - "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.37.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-Jm7biMazjNzTU4PrQtr7VS8ibeys9Pn29/1bm4ph7CP2kf21950LgN+BaE2mJ1QujnvOc6p54eWWiVvn05SOBg=="], + "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.39.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-jDrLm6yUtbOg2TYB3sBF3acUnAwsIksEYjLeHL+TJv9jg+TmTwdyjnDex27jqEMakNKf3RwwPahDIt7QXCSqRQ=="], - "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.37.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-e3/1SFm1OjefWICB2Ucstg2dxYDkDTZGDYgwufcbsxTHyqQps1UQf33dFEChBNmeSsTOyrjw2JJq0zbG5GF6RA=="], + "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.39.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-6w9uMuza+LbLCVoNKL5FSLE7yvYkq9laSd09bwS0tMjkwXrmib/4KmoJcrKhLWHvw19mwU+33ndC69T7weNNjQ=="], - "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.37.0", "", { "os": "win32", "cpu": "x64" }, "sha512-LWbXUBwn/bcLx2sSsqy7pK5o+Nr+VCoRoAohfJ5C/aBio9nfJmGQqHAhU6pwxV/RmyTk5AqdySma7uwWGlmeuA=="], + "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.39.0", "", { "os": "win32", "cpu": "x64" }, "sha512-yAkUOkIKZlK5dl7u6dg897doBgLXmUHhIINM2c+sND3DZwnrdQkkSiDh7N75Ll4mM4dxSkYfXqU9fW3lLkMFug=="], "@rushstack/node-core-library": ["@rushstack/node-core-library@5.13.0", "", { "dependencies": { "ajv": "~8.13.0", "ajv-draft-04": "~1.0.0", "ajv-formats": "~3.0.1", "fs-extra": "~11.3.0", "import-lazy": "~4.0.0", "jju": "~1.4.0", "resolve": "~1.22.1", "semver": "~7.5.4" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-IGVhy+JgUacAdCGXKUrRhwHMTzqhWwZUI+qEPcdzsb80heOw0QPbhhoVsoiMF7Klp8eYsp7hzpScMXmOa3Uhfg=="], @@ -2573,6 +2574,8 @@ "@stacksjs/chat": ["@stacksjs/chat@workspace:storage/framework/core/chat"], + "@stacksjs/clarity": ["@stacksjs/clarity@0.3.2", "", { "bin": { "clarity": "dist/bin/cli.js" } }, "sha512-7NlGpvoA2U5Nw8NJCjyJnFBgTHQ9vCOjLWCsyJiE6LzzKZdZAbp2IrHqbL2/aH27aXZa2p6fda7mg2CIfkk4xA=="], + "@stacksjs/cli": ["@stacksjs/cli@workspace:storage/framework/core/cli"], "@stacksjs/cloud": ["@stacksjs/cloud@workspace:storage/framework/core/cloud"], @@ -2751,31 +2754,31 @@ "@tanstack/vue-virtual": ["@tanstack/vue-virtual@3.13.4", "", { "dependencies": { "@tanstack/virtual-core": "3.13.4" }, "peerDependencies": { "vue": "^2.7.0 || ^3.0.0" } }, "sha512-1fPrd3hE1SS4R/9JbX1AlzueY4duCK7ixuLcMW5GMnk9N6WbLo9MioNKiv22V+UaXKOLNy8tLdzT8NYerOFTOQ=="], - "@tauri-apps/api": ["@tauri-apps/api@2.4.0", "", {}, "sha512-F1zXTsmwcCp+ocg6fbzD/YL0OHeSG1eynCag1UNlX2tD5+dlXy7eRbTu9cAcscPjcR7Nix7by2wiv/+VfWUieg=="], + "@tauri-apps/api": ["@tauri-apps/api@2.4.1", "", {}, "sha512-5sYwZCSJb6PBGbBL4kt7CnE5HHbBqwH+ovmOW6ZVju3nX4E3JX6tt2kRklFEH7xMOIwR0btRkZktuLhKvyEQYg=="], - "@tauri-apps/cli": ["@tauri-apps/cli@2.4.0", "", { "optionalDependencies": { "@tauri-apps/cli-darwin-arm64": "2.4.0", "@tauri-apps/cli-darwin-x64": "2.4.0", "@tauri-apps/cli-linux-arm-gnueabihf": "2.4.0", "@tauri-apps/cli-linux-arm64-gnu": "2.4.0", "@tauri-apps/cli-linux-arm64-musl": "2.4.0", "@tauri-apps/cli-linux-riscv64-gnu": "2.4.0", "@tauri-apps/cli-linux-x64-gnu": "2.4.0", "@tauri-apps/cli-linux-x64-musl": "2.4.0", "@tauri-apps/cli-win32-arm64-msvc": "2.4.0", "@tauri-apps/cli-win32-ia32-msvc": "2.4.0", "@tauri-apps/cli-win32-x64-msvc": "2.4.0" }, "bin": { "tauri": "tauri.js" } }, "sha512-Esg7s20tuSULd2YF3lmtMa1vF7yr5eh/TlBHXjEyrC+XSD9aBxHVoXb6oz7oKybDY9Jf9OiBa0bf2PbybcmOLA=="], + "@tauri-apps/cli": ["@tauri-apps/cli@2.4.1", "", { "optionalDependencies": { "@tauri-apps/cli-darwin-arm64": "2.4.1", "@tauri-apps/cli-darwin-x64": "2.4.1", "@tauri-apps/cli-linux-arm-gnueabihf": "2.4.1", "@tauri-apps/cli-linux-arm64-gnu": "2.4.1", "@tauri-apps/cli-linux-arm64-musl": "2.4.1", "@tauri-apps/cli-linux-riscv64-gnu": "2.4.1", "@tauri-apps/cli-linux-x64-gnu": "2.4.1", "@tauri-apps/cli-linux-x64-musl": "2.4.1", "@tauri-apps/cli-win32-arm64-msvc": "2.4.1", "@tauri-apps/cli-win32-ia32-msvc": "2.4.1", "@tauri-apps/cli-win32-x64-msvc": "2.4.1" }, "bin": { "tauri": "tauri.js" } }, "sha512-9Ta81jx9+57FhtU/mPIckDcOBtPTUdKM75t4+aA0X84b8Sclb0jy1xA8NplmcRzp2fsfIHNngU2NiRxsW5+yOQ=="], - "@tauri-apps/cli-darwin-arm64": ["@tauri-apps/cli-darwin-arm64@2.4.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-MVzYrahJBgDyzUJ2gNEU8H+0oCVEucN115+CVorFnidHcJ6DtDRMCaKLkpjOZNfJyag1WQ25fu7imvZSe0mz/g=="], + "@tauri-apps/cli-darwin-arm64": ["@tauri-apps/cli-darwin-arm64@2.4.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-QME7s8XQwy3LWClTVlIlwXVSLKkeJ/z88pr917Mtn9spYOjnBfsgHAgGdmpWD3NfJxjg7CtLbhH49DxoFL+hLg=="], - "@tauri-apps/cli-darwin-x64": ["@tauri-apps/cli-darwin-x64@2.4.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-/4IdbWv6IWSuBn0WVe5JkiSIP1gZhXCZRcumSsYq3ZmOlq4BqXeXT36Oig5mlDnS/2/UpNS94kd8gOA1DNdIeQ=="], + "@tauri-apps/cli-darwin-x64": ["@tauri-apps/cli-darwin-x64@2.4.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-/r89IcW6Ya1sEsFUEH7wLNruDTj7WmDWKGpPy7gATFtQr5JEY4heernqE82isjTUimnHZD8SCr0jA3NceI4ybw=="], - "@tauri-apps/cli-linux-arm-gnueabihf": ["@tauri-apps/cli-linux-arm-gnueabihf@2.4.0", "", { "os": "linux", "cpu": "arm" }, "sha512-rOjlk3Vd6R847LXds4pOAFKUL5NVdSWlaiQvr4H9WDUwIWWoxnj7SQfpryTtElDb2wV7a0BNaOCXCpyFEAXjkw=="], + "@tauri-apps/cli-linux-arm-gnueabihf": ["@tauri-apps/cli-linux-arm-gnueabihf@2.4.1", "", { "os": "linux", "cpu": "arm" }, "sha512-9tDijkRB+CchAGjXxYdY9l/XzFpLp1yihUtGXJz9eh+3qIoRI043n3e+6xmU8ZURr7XPnu+R4sCmXs6HD+NCEQ=="], - "@tauri-apps/cli-linux-arm64-gnu": ["@tauri-apps/cli-linux-arm64-gnu@2.4.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-X/uCwao6R/weWT2y4f3JKJMeUsujo9H4nBMAv9RZhRsz93n9Amw9ETavAOP11pyhl57YkasvKTCRQN6FwsaoXg=="], + "@tauri-apps/cli-linux-arm64-gnu": ["@tauri-apps/cli-linux-arm64-gnu@2.4.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-pnFGDEXBAzS4iDYAVxTRhAzNu3K2XPGflYyBc0czfHDBXopqRgMyj5Q9Wj7HAwv6cM8BqzXINxnb2ZJFGmbSgA=="], - "@tauri-apps/cli-linux-arm64-musl": ["@tauri-apps/cli-linux-arm64-musl@2.4.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-GhvQtrTjadW3eLSmfrSfybSqgJMZzUXC+0WqDzFovLug3a1a1go0m9QK9YGvYLkyEpTY5zRxLtwv+tbZXN4tZw=="], + "@tauri-apps/cli-linux-arm64-musl": ["@tauri-apps/cli-linux-arm64-musl@2.4.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-Hp0zXgeZNKmT+eoJSCxSBUm2QndNuRxR55tmIeNm3vbyUMJN/49uW7nurZ5fBPsacN4Pzwlx1dIMK+Gnr9A69w=="], - "@tauri-apps/cli-linux-riscv64-gnu": ["@tauri-apps/cli-linux-riscv64-gnu@2.4.0", "", { "os": "linux", "cpu": "none" }, "sha512-NgeNihQ9uHS/ibMWLge5VA/BgsS/g8VPSVtCp8DSPyub3bBuCy79A8V+bzNKlMOiDVrqK4vQ//FS9kSxoJOtXw=="], + "@tauri-apps/cli-linux-riscv64-gnu": ["@tauri-apps/cli-linux-riscv64-gnu@2.4.1", "", { "os": "linux", "cpu": "none" }, "sha512-3T3bo2E4fdYRvzcXheWUeQOVB+LunEEi92iPRgOyuSVexVE4cmHYl+MPJF+EUV28Et0hIVTsHibmDO0/04lAFg=="], - "@tauri-apps/cli-linux-x64-gnu": ["@tauri-apps/cli-linux-x64-gnu@2.4.0", "", { "os": "linux", "cpu": "x64" }, "sha512-ebRmV2HLIVms1KlNNueQCp3OrXBv6cimU3mYEh5NbZ8dH88f2sF46dFCyPq8Qr/Zti4qPEaAArVG7RYFjfECPw=="], + "@tauri-apps/cli-linux-x64-gnu": ["@tauri-apps/cli-linux-x64-gnu@2.4.1", "", { "os": "linux", "cpu": "x64" }, "sha512-kLN0FdNONO+2i+OpU9+mm6oTGufRC00e197TtwjpC0N6K2K8130w7Q3FeODIM2CMyg0ov3tH+QWqKW7GNhHFzg=="], - "@tauri-apps/cli-linux-x64-musl": ["@tauri-apps/cli-linux-x64-musl@2.4.0", "", { "os": "linux", "cpu": "x64" }, "sha512-FOp2cBFyq5LnUr3he95Z99PQm3nCSJv2GZNeH7UqmUpeHwdcYuhBERU7C+8VDJJPR98Q5fkcoV00Pc4nw0v5KQ=="], + "@tauri-apps/cli-linux-x64-musl": ["@tauri-apps/cli-linux-x64-musl@2.4.1", "", { "os": "linux", "cpu": "x64" }, "sha512-a8exvA5Ub9eg66a6hsMQKJIkf63QAf9OdiuFKOsEnKZkNN2x0NLgfvEcqdw88VY0UMs9dBoZ1AGbWMeYnLrLwQ=="], - "@tauri-apps/cli-win32-arm64-msvc": ["@tauri-apps/cli-win32-arm64-msvc@2.4.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-SVf1wDagYsaFM+mpUYKmjNveKodcUSGPEM27WmMW4Enh6aXGzTJi4IYOE3GEFOJF1BpRNscslwE1Rd064kfpcg=="], + "@tauri-apps/cli-win32-arm64-msvc": ["@tauri-apps/cli-win32-arm64-msvc@2.4.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-4JFrslsMCJQG1c573T9uqQSAbF3j/tMKkMWzsIssv8jvPiP++OG61A2/F+y9te9/Q/O95cKhDK63kaiO5xQaeg=="], - "@tauri-apps/cli-win32-ia32-msvc": ["@tauri-apps/cli-win32-ia32-msvc@2.4.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-j+fOFVeSSejk9hrUePY7bJuaYr+80xr+ftjXzxCj0CS0d2oSbq+lT8/zS514WemJk9e9yxUus+2ke/Ng17wkkQ=="], + "@tauri-apps/cli-win32-ia32-msvc": ["@tauri-apps/cli-win32-ia32-msvc@2.4.1", "", { "os": "win32", "cpu": "ia32" }, "sha512-9eXfFORehYSCRwxg2KodfmX/mhr50CI7wyBYGbPLePCjr5z0jK/9IyW6r0tC+ZVjwpX48dkk7hKiUgI25jHjzA=="], - "@tauri-apps/cli-win32-x64-msvc": ["@tauri-apps/cli-win32-x64-msvc@2.4.0", "", { "os": "win32", "cpu": "x64" }, "sha512-nv84b3a8eI5Y7ksTLBKjjvtr9NOlAGGGo7OJbjKT+xZLdiPOZ0nJ2cT+4IdfnNAZ33pKJugAfuj1fBvQKeTy0w=="], + "@tauri-apps/cli-win32-x64-msvc": ["@tauri-apps/cli-win32-x64-msvc@2.4.1", "", { "os": "win32", "cpu": "x64" }, "sha512-60a4Ov7Jrwqz2hzDltlS7301dhSAmM9dxo+IRBD3xz7yobKrgaHXYpWvnRomYItHcDd51VaKc9292H8/eE/gsw=="], "@tokenizer/token": ["@tokenizer/token@0.3.0", "", {}, "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A=="], @@ -2963,7 +2966,7 @@ "@unhead/ssr": ["@unhead/ssr@1.11.20", "", { "dependencies": { "@unhead/schema": "1.11.20", "@unhead/shared": "1.11.20" } }, "sha512-j6ehzmdWGAvv0TEZyLE3WBnG1ULnsbKQcLqBDh3fvKS6b3xutcVZB7mjvrVE7ckSZt6WwOtG0ED3NJDS7IjzBA=="], - "@unhead/vue": ["@unhead/vue@2.0.2", "", { "dependencies": { "hookable": "^5.5.3", "unhead": "2.0.2" }, "peerDependencies": { "vue": ">=3.5.13" } }, "sha512-pUGcbmPNCALOVWnQRtIjJ5ubNaZus3nHfCBDPEVwhbiLzeLF6wbhgTakwksZ1EegKNOZwRAkmVbV6i+23OYEUQ=="], + "@unhead/vue": ["@unhead/vue@2.0.3", "", { "dependencies": { "hookable": "^5.5.3", "unhead": "2.0.3" }, "peerDependencies": { "vue": ">=3.5.13" } }, "sha512-6Yci+MTunYuJLYwujBA68hEr5PabBl87yEhImrG4AUogaYWqIwtMHukn0bQvcjaBksXartLJtGUhxhmKgBdyPw=="], "@unocss/astro": ["@unocss/astro@66.0.0", "", { "dependencies": { "@unocss/core": "66.0.0", "@unocss/reset": "66.0.0", "@unocss/vite": "66.0.0" }, "peerDependencies": { "vite": "^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0" }, "optionalPeers": ["vite"] }, "sha512-GBhXT6JPqXjDXoJZTXhySk83NgOt0UigChqrUUdG4x7Z+DVYkDBION8vZUJjw0OdIaxNQ4euGWu4GDsMF6gQQg=="], @@ -3213,7 +3216,7 @@ "aws-cdk": ["aws-cdk@2.1006.0", "", { "optionalDependencies": { "fsevents": "2.3.2" }, "bin": { "cdk": "bin/cdk" } }, "sha512-6qYnCt4mBN+3i/5F+FC2yMETkDHY/IL7gt3EuqKVPcaAO4jU7oXfVSlR60CYRkZWL4fnAurUV14RkJuJyVG/IA=="], - "aws-cdk-lib": ["aws-cdk-lib@2.186.0", "", { "dependencies": { "@aws-cdk/asset-awscli-v1": "^2.2.227", "@aws-cdk/asset-node-proxy-agent-v6": "^2.1.0", "@aws-cdk/cloud-assembly-schema": "^40.7.0", "@balena/dockerignore": "^1.0.2", "case": "1.6.3", "fs-extra": "^11.3.0", "ignore": "^5.3.2", "jsonschema": "^1.5.0", "mime-types": "^2.1.35", "minimatch": "^3.1.2", "punycode": "^2.3.1", "semver": "^7.7.1", "table": "^6.9.0", "yaml": "1.10.2" }, "peerDependencies": { "constructs": "^10.0.0" } }, "sha512-y/DD4h8CbhwGyPTpoHELATavZe5FWcy1xSuLlReOd3+cCRZ9rAzVSFdPB8kSJUD4nBPrIeGkW1u8ItUOhms17w=="], + "aws-cdk-lib": ["aws-cdk-lib@2.187.0", "", { "dependencies": { "@aws-cdk/asset-awscli-v1": "^2.2.229", "@aws-cdk/asset-node-proxy-agent-v6": "^2.1.0", "@aws-cdk/cloud-assembly-schema": "^41.0.0", "@balena/dockerignore": "^1.0.2", "case": "1.6.3", "fs-extra": "^11.3.0", "ignore": "^5.3.2", "jsonschema": "^1.5.0", "mime-types": "^2.1.35", "minimatch": "^3.1.2", "punycode": "^2.3.1", "semver": "^7.7.1", "table": "^6.9.0", "yaml": "1.10.2" }, "peerDependencies": { "constructs": "^10.0.0" } }, "sha512-OrAWin+LD5sZhRF5cWuEYEkmC/sxxlgcAasCpfzeRsj6yDImwmeQsaKhM7xqzZQBInog6ZbN6oFZYiWEGJMSIA=="], "aws-sdk": ["aws-sdk@2.1692.0", "", { "dependencies": { "buffer": "4.9.2", "events": "1.1.1", "ieee754": "1.1.13", "jmespath": "0.16.0", "querystring": "0.2.0", "sax": "1.2.1", "url": "0.10.3", "util": "^0.12.4", "uuid": "8.0.0", "xml2js": "0.6.2" } }, "sha512-x511uiJ/57FIsbgUe5csJ13k3uzu25uWQE+XqfBis/sB0SFoiElJWXRkgEAUh0U6n40eT3ay5Ue4oPkRMu1LYw=="], @@ -3895,7 +3898,7 @@ "has-bigints": ["has-bigints@1.1.0", "", {}, "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg=="], - "has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], + "has-flag": ["has-flag@5.0.1", "", {}, "sha512-CsNUt5x9LUdx6hnk/E2SZLsDyvfqANZSUq4+D3D8RzDJ2M+HDTIkF60ibS1vHaK55vzgiZw1bEPFG9yH7l33wA=="], "has-property-descriptors": ["has-property-descriptors@1.0.2", "", { "dependencies": { "es-define-property": "^1.0.0" } }, "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg=="], @@ -4757,7 +4760,7 @@ "robust-predicates": ["robust-predicates@3.0.2", "", {}, "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg=="], - "rollup": ["rollup@4.37.0", "", { "dependencies": { "@types/estree": "1.0.6" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.37.0", "@rollup/rollup-android-arm64": "4.37.0", "@rollup/rollup-darwin-arm64": "4.37.0", "@rollup/rollup-darwin-x64": "4.37.0", "@rollup/rollup-freebsd-arm64": "4.37.0", "@rollup/rollup-freebsd-x64": "4.37.0", "@rollup/rollup-linux-arm-gnueabihf": "4.37.0", "@rollup/rollup-linux-arm-musleabihf": "4.37.0", "@rollup/rollup-linux-arm64-gnu": "4.37.0", "@rollup/rollup-linux-arm64-musl": "4.37.0", "@rollup/rollup-linux-loongarch64-gnu": "4.37.0", "@rollup/rollup-linux-powerpc64le-gnu": "4.37.0", "@rollup/rollup-linux-riscv64-gnu": "4.37.0", "@rollup/rollup-linux-riscv64-musl": "4.37.0", "@rollup/rollup-linux-s390x-gnu": "4.37.0", "@rollup/rollup-linux-x64-gnu": "4.37.0", "@rollup/rollup-linux-x64-musl": "4.37.0", "@rollup/rollup-win32-arm64-msvc": "4.37.0", "@rollup/rollup-win32-ia32-msvc": "4.37.0", "@rollup/rollup-win32-x64-msvc": "4.37.0", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-iAtQy/L4QFU+rTJ1YUjXqJOJzuwEghqWzCEYD2FEghT7Gsy1VdABntrO4CLopA5IkflTyqNiLNwPcOJ3S7UKLg=="], + "rollup": ["rollup@4.39.0", "", { "dependencies": { "@types/estree": "1.0.7" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.39.0", "@rollup/rollup-android-arm64": "4.39.0", "@rollup/rollup-darwin-arm64": "4.39.0", "@rollup/rollup-darwin-x64": "4.39.0", "@rollup/rollup-freebsd-arm64": "4.39.0", "@rollup/rollup-freebsd-x64": "4.39.0", "@rollup/rollup-linux-arm-gnueabihf": "4.39.0", "@rollup/rollup-linux-arm-musleabihf": "4.39.0", "@rollup/rollup-linux-arm64-gnu": "4.39.0", "@rollup/rollup-linux-arm64-musl": "4.39.0", "@rollup/rollup-linux-loongarch64-gnu": "4.39.0", "@rollup/rollup-linux-powerpc64le-gnu": "4.39.0", "@rollup/rollup-linux-riscv64-gnu": "4.39.0", "@rollup/rollup-linux-riscv64-musl": "4.39.0", "@rollup/rollup-linux-s390x-gnu": "4.39.0", "@rollup/rollup-linux-x64-gnu": "4.39.0", "@rollup/rollup-linux-x64-musl": "4.39.0", "@rollup/rollup-win32-arm64-msvc": "4.39.0", "@rollup/rollup-win32-ia32-msvc": "4.39.0", "@rollup/rollup-win32-x64-msvc": "4.39.0", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-thI8kNc02yNvnmJp8dr3fNWJ9tCONDhp6TV35X6HkKGGs9E6q7YWCHbe5vKiTa7TAiNcFEmXKj3X/pG2b3ci0g=="], "rollup-plugin-visualizer": ["rollup-plugin-visualizer@5.14.0", "", { "dependencies": { "open": "^8.4.0", "picomatch": "^4.0.2", "source-map": "^0.7.4", "yargs": "^17.5.1" }, "peerDependencies": { "rolldown": "1.x", "rollup": "2.x || 3.x || 4.x" }, "optionalPeers": ["rolldown", "rollup"], "bin": { "rollup-plugin-visualizer": "dist/bin/cli.js" } }, "sha512-VlDXneTDaKsHIw8yzJAFWtrzguoJ/LnQ+lMpoVfYJ3jJF4Ihe5oYLAqLklIK/35lgUY+1yEzCkHyZ1j4A5w5fA=="], @@ -4973,7 +4976,7 @@ "supports-color": ["supports-color@9.4.0", "", {}, "sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw=="], - "supports-hyperlinks": ["supports-hyperlinks@3.2.0", "", { "dependencies": { "has-flag": "^4.0.0", "supports-color": "^7.0.0" } }, "sha512-zFObLMyZeEwzAoKCyu1B91U79K2t7ApXuQfo8OuxwXLDgcKxuwM+YvcbIhm6QWqz7mHUH1TVytR1PwVVjEuMig=="], + "supports-hyperlinks": ["supports-hyperlinks@4.0.0", "", { "dependencies": { "has-flag": "^5.0.1", "supports-color": "^10.0.0" } }, "sha512-+AGkj8vRkjR1g5ixsfzmoeYUaGyR4tU8JkGbWYGiilAwYc+oLyNHgoeYN/tGZJ7eyYpAF8QnTNzGTq/cwhn+bQ=="], "supports-preserve-symlinks-flag": ["supports-preserve-symlinks-flag@1.0.0", "", {}, "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="], @@ -5097,7 +5100,7 @@ "undici-types": ["undici-types@6.20.0", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="], - "unhead": ["unhead@2.0.2", "", { "dependencies": { "hookable": "^5.5.3" } }, "sha512-1pcK/rSA70sezpdgmupQPd/yrul8pVFJRwMvWjEthbsXoTXMqjNQlV7NBXWeWt5r2uje1lZJsvRTHF7IvdOhcg=="], + "unhead": ["unhead@2.0.3", "", { "dependencies": { "hookable": "^5.5.3" } }, "sha512-l2O1DSzEid8Fp+I+FMMhFnl1IewyAvBhbdYipaq9Jh2AMndv//yWZ2amjzDLpYpUmDr9E8WTcdoAXkm9wH60Aw=="], "unicode-canonical-property-names-ecmascript": ["unicode-canonical-property-names-ecmascript@2.0.1", "", {}, "sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg=="], @@ -5169,7 +5172,7 @@ "vfile-message": ["vfile-message@4.0.2", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-stringify-position": "^4.0.0" } }, "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw=="], - "vite": ["vite@6.2.3", "", { "dependencies": { "esbuild": "^0.25.0", "postcss": "^8.5.3", "rollup": "^4.30.1" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-IzwM54g4y9JA/xAeBPNaDXiBF8Jsgl3VBQ2YQ/wOY6fyW3xMdSoltIV3Bo59DErdqdE6RxUfv8W69DvUorE4Eg=="], + "vite": ["vite@6.2.5", "", { "dependencies": { "esbuild": "^0.25.0", "postcss": "^8.5.3", "rollup": "^4.30.1" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-j023J/hCAa4pRIUH6J9HemwYfjB5llR2Ps0CWeikOtdR8+pAURAk0DoJC5/mm9kd+UgdnIy7d6HE4EAvlYhPhA=="], "vite-bundle-visualizer": ["vite-bundle-visualizer@1.2.1", "", { "dependencies": { "cac": "^6.7.14", "import-from-esm": "^1.3.3", "rollup-plugin-visualizer": "^5.11.0", "tmp": "^0.2.1" }, "bin": { "vite-bundle-visualizer": "bin.js" } }, "sha512-cwz/Pg6+95YbgIDp+RPwEToc4TKxfsFWSG/tsl2DSZd9YZicUag1tQXjJ5xcL7ydvEoaC2FOZeaXOU60t9BRXw=="], @@ -5191,7 +5194,7 @@ "vite-plugin-vue-layouts": ["vite-plugin-vue-layouts@0.11.0", "", { "dependencies": { "debug": "^4.3.4", "fast-glob": "^3.3.2" }, "peerDependencies": { "vite": "^4.0.0 || ^5.0.0", "vue": "^3.2.4", "vue-router": "^4.0.11" } }, "sha512-uh6NW7lt+aOXujK4eHfiNbeo55K9OTuB7fnv+5RVc4OBn/cZull6ThXdYH03JzKanUfgt6QZ37NbbtJ0og59qw=="], - "vite-ssg": ["vite-ssg@26.1.0", "", { "dependencies": { "@unhead/dom": "^2.0.2", "@unhead/vue": "^2.0.2", "ansis": "^3.17.0", "cac": "^6.7.14", "html-minifier-terser": "^7.2.0", "html5parser": "^2.0.2", "jsdom": "^26.0.0" }, "peerDependencies": { "beasties": "^0.2.0", "prettier": "^3.3.0", "vite": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0", "vue": "^3.2.10", "vue-router": "^4.0.1" }, "optionalPeers": ["beasties", "prettier", "vue-router"], "bin": { "vite-ssg": "bin/vite-ssg.js" } }, "sha512-cNkvC7KzRrDMWZzG63xNe3mPuxYRP/yx2N81EG0o5od5Y0+UvdZyofrG8gPrrHeeSt1B8f5YHeW4rx96ul1p+g=="], + "vite-ssg": ["vite-ssg@26.1.1", "", { "dependencies": { "@unhead/dom": "^2.0.2", "@unhead/vue": "^2.0.2", "ansis": "^3.17.0", "cac": "^6.7.14", "html-minifier-terser": "^7.2.0", "html5parser": "^2.0.2", "jsdom": "^26.0.0" }, "peerDependencies": { "beasties": "^0.2.0", "prettier": "^3.3.0", "vite": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0", "vue": "^3.2.10", "vue-router": "^4.0.1" }, "optionalPeers": ["beasties", "prettier", "vue-router"], "bin": { "vite-ssg": "bin/vite-ssg.js" } }, "sha512-cLcSh6csGf34Vv1ah9VuZwmHTqAXcCjOEAPQ2pWQove185UJcq6gtrOZI66v5GwCzIIS5Gex/NDXHrWyZ2dEpg=="], "vite-ssg-sitemap": ["vite-ssg-sitemap@0.8.1", "", {}, "sha512-4IjhsnsC+Kcc/3Z4zOie9KIU633oH0lODZHNIjz3vJvw8aZ2SUor2tvcK16VWpMkkmQkU1iAIY04WWm3DzjM1w=="], @@ -5331,7 +5334,7 @@ "yallist": ["yallist@5.0.0", "", {}, "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw=="], - "yaml": ["yaml@2.7.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA=="], + "yaml": ["yaml@2.7.1", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-10ULxpnOCQXxJvBgxsn9ptjq6uviG/htZKk9veJGhlqn3w/DxQ631zFF+nlQXLwmImeS5amR2dl2U8sg6U9jsQ=="], "yaml-ast-parser": ["yaml-ast-parser@0.0.43", "", {}, "sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A=="], @@ -5555,6 +5558,8 @@ "@typescript-eslint/typescript-estree/semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], + "@unhead/dom/unhead": ["unhead@2.0.2", "", { "dependencies": { "hookable": "^5.5.3" } }, "sha512-1pcK/rSA70sezpdgmupQPd/yrul8pVFJRwMvWjEthbsXoTXMqjNQlV7NBXWeWt5r2uje1lZJsvRTHF7IvdOhcg=="], + "@vinejs/vine/@types/validator": ["@types/validator@13.12.2", "", {}, "sha512-6SlHBzUW8Jhf3liqrGGXyTJSIFe4nqlJ5A5KaMZ2l/vbM3Wh3KSybots/wfWVzNLK4D1NZluDlSQIbIEPx6oyA=="], "@vinejs/vine/validator": ["validator@13.12.0", "", {}, "sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg=="], @@ -5603,6 +5608,8 @@ "bumpp/semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], + "bumpp/yaml": ["yaml@2.7.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA=="], + "c12/chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="], "c12/confbox": ["confbox@0.1.8", "", {}, "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w=="], @@ -5763,6 +5770,8 @@ "lint-staged/execa": ["execa@8.0.1", "", { "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^8.0.1", "human-signals": "^5.0.0", "is-stream": "^3.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^5.1.0", "onetime": "^6.0.0", "signal-exit": "^4.1.0", "strip-final-newline": "^3.0.0" } }, "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg=="], + "lint-staged/yaml": ["yaml@2.7.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA=="], + "listr2/wrap-ansi": ["wrap-ansi@9.0.0", "", { "dependencies": { "ansi-styles": "^6.2.1", "string-width": "^7.0.0", "strip-ansi": "^7.1.0" } }, "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q=="], "log-symbols/is-unicode-supported": ["is-unicode-supported@1.3.0", "", {}, "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ=="], @@ -5803,8 +5812,12 @@ "pg/pg-types": ["pg-types@2.2.0", "", { "dependencies": { "pg-int8": "1.0.1", "postgres-array": "~2.0.0", "postgres-bytea": "~1.0.0", "postgres-date": "~1.0.4", "postgres-interval": "^1.1.0" } }, "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA=="], + "pnpm-workspace-yaml/yaml": ["yaml@2.7.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA=="], + "postcss-css-variables/escape-string-regexp": ["escape-string-regexp@1.0.5", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="], + "postcss-load-config/yaml": ["yaml@2.7.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA=="], + "prebuild-install/minimist": ["minimist@1.2.8", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="], "prebuild-install/tar-fs": ["tar-fs@2.1.2", "", { "dependencies": { "chownr": "^1.1.1", "mkdirp-classic": "^0.5.2", "pump": "^3.0.0", "tar-stream": "^2.1.4" } }, "sha512-EsaAXwxmx8UB7FRKqeozqEPop69DXcmYwTQwXvyAPF352HJsPdkVhvTaDPYqfNgruveJIJy3TA2l+2zj8LJIJA=="], @@ -5829,7 +5842,9 @@ "rimraf/glob": ["glob@10.4.5", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg=="], - "rollup/@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.37.0", "", { "os": "linux", "cpu": "x64" }, "sha512-pKivGpgJM5g8dwj0ywBwe/HeVAUSuVVJhUTa/URXjxvoyTT/AxsLTAbkHkDHG7qQxLoW2s3apEIl26uUe08LVQ=="], + "rollup/@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.39.0", "", { "os": "linux", "cpu": "x64" }, "sha512-t9jqYw27R6Lx0XKfEFe5vUeEJ5pF3SGIM6gTfONSMb7DuG6z6wfj2yjcoZxHg129veTqU7+wOhY6GX8wmf90dA=="], + + "rollup/@types/estree": ["@types/estree@1.0.7", "", {}, "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ=="], "rollup/fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="], @@ -5871,7 +5886,7 @@ "sucrase/glob": ["glob@10.4.5", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg=="], - "supports-hyperlinks/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], + "supports-hyperlinks/supports-color": ["supports-color@10.0.0", "", {}, "sha512-HRVVSbCCMbj7/kdWF9Q+bbckjBHLtHMEoJWlkmYzzdwhYMkjkOwubLM6t7NbWKjgKamGDrWL1++KrjUO1t9oAQ=="], "table/ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="], @@ -5913,6 +5928,8 @@ "unplugin-vue-router/chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="], + "unplugin-vue-router/yaml": ["yaml@2.7.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA=="], + "url/punycode": ["punycode@1.3.2", "", {}, "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw=="], "validate-npm-package-license/spdx-expression-parse": ["spdx-expression-parse@3.0.1", "", { "dependencies": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" } }, "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q=="], @@ -5977,6 +5994,8 @@ "yaml-eslint-parser/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="], + "yaml-eslint-parser/yaml": ["yaml@2.7.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA=="], + "yargs/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], "yargs/yargs-parser": ["yargs-parser@18.1.3", "", { "dependencies": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" } }, "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ=="], @@ -6213,6 +6232,8 @@ "@oclif/core/string-width/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], + "@oclif/core/supports-color/has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], + "@redocly/openapi-core/minimatch/brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="], "@rollup/plugin-babel/@rollup/pluginutils/@types/estree": ["@types/estree@0.0.39", "", {}, "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw=="], @@ -6231,6 +6252,8 @@ "@rollup/plugin-replace/rollup/fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="], + "@rushstack/terminal/supports-color/has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], + "@rushstack/ts-command-line/argparse/sprintf-js": ["sprintf-js@1.0.3", "", {}, "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="], "@shikijs/core/@shikijs/engine-javascript/oniguruma-to-es": ["oniguruma-to-es@3.1.1", "", { "dependencies": { "emoji-regex-xs": "^1.0.0", "regex": "^6.0.1", "regex-recursion": "^6.0.2" } }, "sha512-bUH8SDvPkH3ho3dvwJwfonjlQ4R80vjyvrU8YpxuROddv55vAEJrTuCuCVUhhsHbtlD9tGGbaNApGQckXhS8iQ=="], @@ -6491,6 +6514,8 @@ "sharp-ico/sharp/semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], + "sinon/supports-color/has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], + "string-width-cjs/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], "sucrase/glob/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="], @@ -6729,6 +6754,8 @@ "cz-conventional-changelog/chalk/supports-color/has-flag": ["has-flag@3.0.0", "", {}, "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw=="], + "eslint/chalk/supports-color/has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], + "eslint/find-up/locate-path/p-locate": ["p-locate@5.0.0", "", { "dependencies": { "p-limit": "^3.0.2" } }, "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw=="], "export-size/yargs/cliui/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], @@ -6739,8 +6766,12 @@ "gray-matter/js-yaml/argparse/sprintf-js": ["sprintf-js@1.0.3", "", {}, "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="], + "inquirer/chalk/supports-color/has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], + "inquirer/cli-cursor/restore-cursor/signal-exit": ["signal-exit@3.0.7", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="], + "jake/chalk/supports-color/has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], + "js-beautify/glob/minimatch/brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="], "lint-staged/execa/npm-run-path/path-key": ["path-key@4.0.0", "", {}, "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ=="], diff --git a/routes/api.ts b/routes/api.ts index 31e7ae4a10..af63f01303 100644 --- a/routes/api.ts +++ b/routes/api.ts @@ -51,6 +51,173 @@ route.group({ prefix: '/payments' }, async () => { route.post('/store-transaction/{id}', 'Actions/Payment/StoreTransactionAction') }) +route.group({ prefix: '/commerce' }, async () => { + route.get('/customers', 'Actions/Commerce/CustomersAction') + + // Print Devices + route.get('/print-devices', 'Actions/Commerce/PrintDeviceIndexOrmAction') + route.post('/print-devices', 'Actions/Commerce/PrintDeviceStoreOrmAction') + route.get('/print-devices/{id}', 'Actions/Commerce/PrintDeviceShowOrmAction') + route.patch('/print-devices/{id}', 'Actions/Commerce/PrintDeviceUpdateOrmAction') + route.delete('/print-devices/{id}', 'Actions/Commerce/PrintDeviceDestroyOrmAction') + + // Product Categories + route.get('/product-categories', 'Actions/Commerce/CategoryIndexOrmAction') + route.post('/product-categories', 'Actions/Commerce/CategoryStoreOrmAction') + route.get('/product-categories/{id}', 'Actions/Commerce/CategoryShowOrmAction') + + // Payments + route.get('/payments', 'Actions/Commerce/PaymentIndexOrmAction') + route.post('/payments', 'Actions/Commerce/PaymentStoreOrmAction') + route.get('/payments/{id}', 'Actions/Commerce/PaymentShowOrmAction') + + // Drivers + route.get('/drivers', 'Actions/Commerce/DriverIndexOrmAction') + route.post('/drivers', 'Actions/Commerce/DriverStoreOrmAction') + route.get('/drivers/{id}', 'Actions/Commerce/DriverShowOrmAction') + route.patch('/drivers/{id}', 'Actions/Commerce/DriverUpdateOrmAction') + route.delete('/drivers/{id}', 'Actions/Commerce/DriverDestroyOrmAction') + + // Waitlist Products + route.get('/waitlist-products', 'Actions/Commerce/WaitlistProductIndexOrmAction') + route.post('/waitlist-products', 'Actions/Commerce/WaitlistProductStoreOrmAction') + route.get('/waitlist-products/{id}', 'Actions/Commerce/WaitlistProductShowOrmAction') + route.patch('/waitlist-products/{id}', 'Actions/Commerce/WaitlistProductUpdateOrmAction') + route.delete('/waitlist-products/{id}', 'Actions/Commerce/WaitlistProductDestroyOrmAction') + + // Digital Deliveries + route.get('/digital-deliveries', 'Actions/Commerce/DigitalDeliveryIndexOrmAction') + route.post('/digital-deliveries', 'Actions/Commerce/DigitalDeliveryStoreOrmAction') + route.get('/digital-deliveries/{id}', 'Actions/Commerce/DigitalDeliveryShowOrmAction') + route.patch('/digital-deliveries/{id}', 'Actions/Commerce/DigitalDeliveryUpdateOrmAction') + route.delete('/digital-deliveries/{id}', 'Actions/Commerce/DigitalDeliveryDestroyOrmAction') + + // Product Manufacturers + route.get('/product-manufacturers', 'Actions/Commerce/ManufacturerIndexOrmAction') + route.post('/product-manufacturers', 'Actions/Commerce/ManufacturerStoreOrmAction') + route.get('/product-manufacturers/{id}', 'Actions/Commerce/ManufacturerShowOrmAction') + + // Shipping Zones + route.get('/shipping-zones', 'Actions/Commerce/ShippingZoneIndexOrmAction') + route.post('/shipping-zones', 'Actions/Commerce/ShippingZoneStoreOrmAction') + route.get('/shipping-zones/{id}', 'Actions/Commerce/ShippingZoneShowOrmAction') + route.patch('/shipping-zones/{id}', 'Actions/Commerce/ShippingZoneUpdateOrmAction') + route.delete('/shipping-zones/{id}', 'Actions/Commerce/ShippingZoneDestroyOrmAction') + + // Customers + route.get('/customers', 'Actions/Commerce/CustomerIndexOrmAction') + route.post('/customers', 'Actions/Commerce/CustomerStoreOrmAction') + route.get('/customers/{id}', 'Actions/Commerce/CustomerShowOrmAction') + route.patch('/customers/{id}', 'Actions/Commerce/CustomerUpdateOrmAction') + route.delete('/customers/{id}', 'Actions/Commerce/CustomerDestroyOrmAction') + + // Products + route.get('/products', 'Actions/Commerce/ProductIndexOrmAction') + route.post('/products', 'Actions/Commerce/ProductStoreOrmAction') + route.get('/products/{id}', 'Actions/Commerce/ProductShowOrmAction') + + // Print Logs + route.get('/print-logs', 'Actions/Commerce/ReceiptIndexOrmAction') + route.post('/print-logs', 'Actions/Commerce/ReceiptStoreOrmAction') + route.get('/print-logs/{id}', 'Actions/Commerce/ReceiptShowOrmAction') + route.patch('/print-logs/{id}', 'Actions/Commerce/ReceiptUpdateOrmAction') + route.delete('/print-logs/{id}', 'Actions/Commerce/ReceiptDestroyOrmAction') + + // Product Variants + route.get('/product-variants', 'Actions/Commerce/ProductVariantIndexOrmAction') + route.post('/product-variants', 'Actions/Commerce/ProductVariantStoreOrmAction') + route.get('/product-variants/{id}', 'Actions/Commerce/ProductVariantShowOrmAction') + route.patch('/product-variants/{id}', 'Actions/Commerce/ProductVariantUpdateOrmAction') + route.delete('/product-variants/{id}', 'Actions/Commerce/ProductVariantDestroyOrmAction') + + // License Keys + route.get('/license-keys', 'Actions/Commerce/LicenseKeyIndexOrmAction') + route.post('/license-keys', 'Actions/Commerce/LicenseKeyStoreOrmAction') + route.get('/license-keys/{id}', 'Actions/Commerce/LicenseKeyShowOrmAction') + route.patch('/license-keys/{id}', 'Actions/Commerce/LicenseKeyUpdateOrmAction') + route.delete('/license-keys/{id}', 'Actions/Commerce/LicenseKeyDestroyOrmAction') + + // Waitlist Restaurants + route.get('/waitlist-restaurants', 'Actions/Commerce/WaitlistRestaurantIndexOrmAction') + route.post('/waitlist-restaurants', 'Actions/Commerce/WaitlistRestaurantStoreOrmAction') + route.get('/waitlist-restaurants/{id}', 'Actions/Commerce/WaitlistRestaurantShowOrmAction') + route.patch('/waitlist-restaurants/{id}', 'Actions/Commerce/WaitlistRestaurantUpdateOrmAction') + route.delete('/waitlist-restaurants/{id}', 'Actions/Commerce/WaitlistRestaurantDestroyOrmAction') + + // Product Reviews + route.get('/product-reviews', 'Actions/Commerce/ReviewIndexOrmAction') + route.post('/product-reviews', 'Actions/Commerce/ReviewStoreOrmAction') + route.get('/product-reviews/{id}', 'Actions/Commerce/ReviewShowOrmAction') + + // Product Units + route.get('/product-units', 'Actions/Commerce/ProductUnitIndexOrmAction') + route.post('/product-units', 'Actions/Commerce/ProductUnitStoreOrmAction') + route.get('/product-units/{id}', 'Actions/Commerce/ProductUnitShowOrmAction') + + // Gift Cards + route.get('/gift-cards', 'Actions/Commerce/GiftCardIndexOrmAction') + route.post('/gift-cards', 'Actions/Commerce/GiftCardStoreOrmAction') + route.get('/gift-cards/{id}', 'Actions/Commerce/GiftCardShowOrmAction') + + // Orders + route.get('/orders', 'Actions/Commerce/OrderIndexOrmAction') + route.post('/orders', 'Actions/Commerce/OrderStoreOrmAction') + route.get('/orders/{id}', 'Actions/Commerce/OrderShowOrmAction') + + // Coupons + route.get('/coupons', 'Actions/Commerce/CouponIndexOrmAction') + route.post('/coupons', 'Actions/Commerce/CouponStoreOrmAction') + route.get('/coupons/{id}', 'Actions/Commerce/CouponShowOrmAction') + + // Tax Rates + route.get('/tax-rates', 'Actions/Commerce/TaxRateIndexOrmAction') + route.post('/tax-rates', 'Actions/Commerce/TaxRateStoreOrmAction') + route.get('/tax-rates/{id}', 'Actions/Commerce/TaxRateShowOrmAction') + route.patch('/tax-rates/{id}', 'Actions/Commerce/TaxRateUpdateOrmAction') + route.delete('/tax-rates/{id}', 'Actions/Commerce/TaxRateDestroyOrmAction') + + // Transactions + route.get('/transactions', 'Actions/Commerce/TransactionIndexOrmAction') + route.post('/transactions', 'Actions/Commerce/TransactionStoreOrmAction') + route.get('/transactions/{id}', 'Actions/Commerce/TransactionShowOrmAction') + + // Loyalty Points + route.get('/loyalty-points', 'Actions/Commerce/LoyaltyPointIndexOrmAction') + route.post('/loyalty-points', 'Actions/Commerce/LoyaltyPointStoreOrmAction') + route.get('/loyalty-points/{id}', 'Actions/Commerce/LoyaltyPointShowOrmAction') + + // Product Items + route.get('/product-items', 'Actions/Commerce/ProductItemIndexOrmAction') + route.post('/product-items', 'Actions/Commerce/ProductItemStoreOrmAction') + route.get('/product-items/{id}', 'Actions/Commerce/ProductItemShowOrmAction') + + // Loyalty Rewards + route.get('/loyalty-rewards', 'Actions/Commerce/LoyaltyRewardIndexOrmAction') + route.post('/loyalty-rewards', 'Actions/Commerce/LoyaltyRewardStoreOrmAction') + route.get('/loyalty-rewards/{id}', 'Actions/Commerce/LoyaltyRewardShowOrmAction') + + // Shipping Methods + route.get('/shipping-methods', 'Actions/Commerce/ShippingMethodIndexOrmAction') + route.post('/shipping-methods', 'Actions/Commerce/ShippingMethodStoreOrmAction') + route.get('/shipping-methods/{id}', 'Actions/Commerce/ShippingMethodShowOrmAction') + route.patch('/shipping-methods/{id}', 'Actions/Commerce/ShippingMethodUpdateOrmAction') + route.delete('/shipping-methods/{id}', 'Actions/Commerce/ShippingMethodDestroyOrmAction') + + // Shipping Rates + route.get('/shipping-rates', 'Actions/Commerce/ShippingRateIndexOrmAction') + route.post('/shipping-rates', 'Actions/Commerce/ShippingRateStoreOrmAction') + route.get('/shipping-rates/{id}', 'Actions/Commerce/ShippingRateShowOrmAction') + route.patch('/shipping-rates/{id}', 'Actions/Commerce/ShippingRateUpdateOrmAction') + route.delete('/shipping-rates/{id}', 'Actions/Commerce/ShippingRateDestroyOrmAction') + + // Delivery Routes + route.get('/delivery-routes', 'Actions/Commerce/DeliveryRouteIndexOrmAction') + route.post('/delivery-routes', 'Actions/Commerce/DeliveryRouteStoreOrmAction') + route.get('/delivery-routes/{id}', 'Actions/Commerce/DeliveryRouteShowOrmAction') + route.patch('/delivery-routes/{id}', 'Actions/Commerce/DeliveryRouteUpdateOrmAction') + route.delete('/delivery-routes/{id}', 'Actions/Commerce/DeliveryRouteDestroyOrmAction') +}) + route.group({ prefix: '/queues' }, async () => { route.get('/', 'Actions/Queue/FetchQueuesAction') }) diff --git a/storage/framework/defaults/functions/commerce/customers.ts b/storage/framework/defaults/functions/commerce/customers.ts index f8488e3b40..92e158549e 100644 --- a/storage/framework/defaults/functions/commerce/customers.ts +++ b/storage/framework/defaults/functions/commerce/customers.ts @@ -1,19 +1,21 @@ -import { fetch } from '@stacksjs/browser' import { useStorage } from '@vueuse/core' +import { Customers } from '../../types/customer' // Create a persistent customers array using VueUse's useStorage -const customers = useStorage('customers', []) +const customers = useStorage('customers', []) + +const baseURL = 'http://localhost:3008/api' // Basic fetch function to get all customers async function fetchCustomers() { try { - const response = await fetch('/api/commerce/customers') + const response = await fetch(`${baseURL}/commerce/customers`) if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`) } - const data = await response.json() + const data = await response.json() as Customers[] // Ensure data is an array before assigning if (Array.isArray(data)) { diff --git a/storage/framework/defaults/types/customer.ts b/storage/framework/defaults/types/customer.ts new file mode 100644 index 0000000000..57eca38151 --- /dev/null +++ b/storage/framework/defaults/types/customer.ts @@ -0,0 +1,14 @@ +export interface Customers { + id: number + user_id: number + name: string + email: string + phone: string + total_spent?: number + last_order?: string + status: string | string[] + avatar?: string + uuid?: string + created_at?: string + updated_at?: string +} \ No newline at end of file From d272dfc2902d34f09b0ba2c4b004556e610b946b Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Thu, 3 Apr 2025 20:51:38 +0800 Subject: [PATCH 64/78] chore: wip --- .../defaults/functions/commerce/customers.ts | 79 ++++++++++++ .../defaults/functions/commerce/orders.ts | 119 ++++++++++++++++++ storage/framework/defaults/types/order.ts | 19 +++ 3 files changed, 217 insertions(+) create mode 100644 storage/framework/defaults/functions/commerce/orders.ts create mode 100644 storage/framework/defaults/types/order.ts diff --git a/storage/framework/defaults/functions/commerce/customers.ts b/storage/framework/defaults/functions/commerce/customers.ts index 92e158549e..44fef3c8e3 100644 --- a/storage/framework/defaults/functions/commerce/customers.ts +++ b/storage/framework/defaults/functions/commerce/customers.ts @@ -33,10 +33,89 @@ async function fetchCustomers() { } } +async function createCustomer(customer: Customers) { + try { + const response = await fetch(`${baseURL}/commerce/customers`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(customer), + }) + + if (!response.ok) { + throw new Error(`HTTP error! Status: ${response.status}`) + } + + const data = await response.json() as Customers + customers.value.push(data) + return data + } + catch (error) { + console.error('Error creating customer:', error) + return null + } +} + +async function updateCustomer(customer: Customers) { + try { + const response = await fetch(`${baseURL}/commerce/customers/${customer.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(customer), + }) + + if (!response.ok) { + throw new Error(`HTTP error! Status: ${response.status}`) + } + + const data = await response.json() as Customers + const index = customers.value.findIndex(c => c.id === customer.id) + if (index !== -1) { + customers.value[index] = data + } + return data + } + catch (error) { + console.error('Error updating customer:', error) + return null + } +} + +async function deleteCustomer(id: number) { + try { + const response = await fetch(`${baseURL}/commerce/customers/${id}`, { + method: 'DELETE', + }) + + if (!response.ok) { + throw new Error(`HTTP error! Status: ${response.status}`) + } + + const index = customers.value.findIndex(c => c.id === id) + + if (index !== -1) { + customers.value.splice(index, 1) + } + + return true + } + catch (error) { + console.error('Error deleting customer:', error) + return false + } +} + + // Export the composable export function useCustomers() { return { customers, fetchCustomers, + createCustomer, + updateCustomer, + deleteCustomer, } } diff --git a/storage/framework/defaults/functions/commerce/orders.ts b/storage/framework/defaults/functions/commerce/orders.ts new file mode 100644 index 0000000000..cf521e297d --- /dev/null +++ b/storage/framework/defaults/functions/commerce/orders.ts @@ -0,0 +1,119 @@ +import { useStorage } from '@vueuse/core' +import type { Orders } from '../../types/order' + +// Create a persistent orders array using VueUse's useStorage +const orders = useStorage('orders', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all orders +async function fetchOrders() { + try { + const response = await fetch(`${baseURL}/commerce/orders`) + + if (!response.ok) { + throw new Error(`HTTP error! Status: ${response.status}`) + } + + const data = await response.json() as Orders[] + + // Ensure data is an array before assigning + if (Array.isArray(data)) { + orders.value = data + return data + } + else { + console.error('Expected array of orders but received:', typeof data) + return [] + } + } + catch (error) { + console.error('Error fetching orders:', error) + return [] + } +} + +async function createOrder(order: Orders) { + try { + const response = await fetch(`${baseURL}/commerce/orders`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(order), + }) + + if (!response.ok) { + throw new Error(`HTTP error! Status: ${response.status}`) + } + + const data = await response.json() as Orders + orders.value.push(data) + return data + } + catch (error) { + console.error('Error creating order:', error) + return null + } +} + +async function updateOrder(order: Orders) { + try { + const response = await fetch(`${baseURL}/commerce/orders/${order.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(order), + }) + + if (!response.ok) { + throw new Error(`HTTP error! Status: ${response.status}`) + } + + const data = await response.json() as Orders + const index = orders.value.findIndex(o => o.id === order.id) + if (index !== -1) { + orders.value[index] = data + } + return data + } + catch (error) { + console.error('Error updating order:', error) + return null + } +} + +async function deleteOrder(id: number) { + try { + const response = await fetch(`${baseURL}/commerce/orders/${id}`, { + method: 'DELETE', + }) + + if (!response.ok) { + throw new Error(`HTTP error! Status: ${response.status}`) + } + + const index = orders.value.findIndex(o => o.id === id) + if (index !== -1) { + orders.value.splice(index, 1) + } + + return true + } + catch (error) { + console.error('Error deleting order:', error) + return false + } +} + +// Export the composable +export function useOrders() { + return { + orders, + fetchOrders, + createOrder, + updateOrder, + deleteOrder, + } +} diff --git a/storage/framework/defaults/types/order.ts b/storage/framework/defaults/types/order.ts new file mode 100644 index 0000000000..6f3a04860f --- /dev/null +++ b/storage/framework/defaults/types/order.ts @@ -0,0 +1,19 @@ +export interface Orders { + id: number + customer_id: number + coupon_id: number + status: string + total_amount: number + tax_amount?: number + discount_amount?: number + delivery_fee?: number + tip_amount?: number + order_type: string + delivery_address?: string + special_instructions?: string + estimated_delivery_time?: string + applied_coupon_id?: string + uuid?: string + created_at?: string + updated_at?: string +} \ No newline at end of file From 919053079a60108a832e7fd4a417f458e674cb16 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Thu, 3 Apr 2025 21:10:23 +0800 Subject: [PATCH 65/78] chore: wip --- .../defaults/functions/commerce/coupons.ts | 119 ++++++++++++++++++ storage/framework/defaults/types/coupon.ts | 21 ++++ 2 files changed, 140 insertions(+) create mode 100644 storage/framework/defaults/functions/commerce/coupons.ts create mode 100644 storage/framework/defaults/types/coupon.ts diff --git a/storage/framework/defaults/functions/commerce/coupons.ts b/storage/framework/defaults/functions/commerce/coupons.ts new file mode 100644 index 0000000000..ff57983148 --- /dev/null +++ b/storage/framework/defaults/functions/commerce/coupons.ts @@ -0,0 +1,119 @@ +import { useStorage } from '@vueuse/core' +import type { Coupons } from '../../types/coupon' + +// Create a persistent coupons array using VueUse's useStorage +const coupons = useStorage('coupons', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all coupons +async function fetchCoupons() { + try { + const response = await fetch(`${baseURL}/commerce/coupons`) + + if (!response.ok) { + throw new Error(`HTTP error! Status: ${response.status}`) + } + + const data = await response.json() as Coupons[] + + // Ensure data is an array before assigning + if (Array.isArray(data)) { + coupons.value = data + return data + } + else { + console.error('Expected array of coupons but received:', typeof data) + return [] + } + } + catch (error) { + console.error('Error fetching coupons:', error) + return [] + } +} + +async function createCoupon(coupon: Coupons) { + try { + const response = await fetch(`${baseURL}/commerce/coupons`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(coupon), + }) + + if (!response.ok) { + throw new Error(`HTTP error! Status: ${response.status}`) + } + + const data = await response.json() as Coupons + coupons.value.push(data) + return data + } + catch (error) { + console.error('Error creating coupon:', error) + return null + } +} + +async function updateCoupon(coupon: Coupons) { + try { + const response = await fetch(`${baseURL}/commerce/coupons/${coupon.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(coupon), + }) + + if (!response.ok) { + throw new Error(`HTTP error! Status: ${response.status}`) + } + + const data = await response.json() as Coupons + const index = coupons.value.findIndex(c => c.id === coupon.id) + if (index !== -1) { + coupons.value[index] = data + } + return data + } + catch (error) { + console.error('Error updating coupon:', error) + return null + } +} + +async function deleteCoupon(id: number) { + try { + const response = await fetch(`${baseURL}/commerce/coupons/${id}`, { + method: 'DELETE', + }) + + if (!response.ok) { + throw new Error(`HTTP error! Status: ${response.status}`) + } + + const index = coupons.value.findIndex(c => c.id === id) + if (index !== -1) { + coupons.value.splice(index, 1) + } + + return true + } + catch (error) { + console.error('Error deleting coupon:', error) + return false + } +} + +// Export the composable +export function useCoupons() { + return { + coupons, + fetchCoupons, + createCoupon, + updateCoupon, + deleteCoupon, + } +} diff --git a/storage/framework/defaults/types/coupon.ts b/storage/framework/defaults/types/coupon.ts new file mode 100644 index 0000000000..ea89f8e6f4 --- /dev/null +++ b/storage/framework/defaults/types/coupon.ts @@ -0,0 +1,21 @@ +export interface Coupons { + id: number + product_id: number + code: string + description?: string + discount_type: string + discount_value: number + min_order_amount?: number + max_discount_amount?: number + free_product_id?: string + is_active?: boolean + usage_limit?: number + usage_count?: number + start_date: Date | string + end_date: Date | string + applicable_products?: string + applicable_categories?: string + uuid?: string + created_at?: string + updated_at?: string +} From bb5540f1f21fb991fd5672d89d5cecb2ee270799 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Thu, 3 Apr 2025 21:20:24 +0800 Subject: [PATCH 66/78] chore: wip --- .../defaults/functions/commerce/coupons.ts | 129 ++++++++--------- .../defaults/functions/commerce/customers.ts | 131 ++++++++---------- .../defaults/functions/commerce/orders.ts | 129 ++++++++--------- .../functions/commerce/products/categories.ts | 113 +++++++++++++++ .../functions/commerce/products/items.ts | 118 ++++++++++++++++ .../functions/commerce/products/reviews.ts | 0 .../functions/commerce/products/units.ts | 0 .../functions/commerce/products/variants.ts | 0 8 files changed, 397 insertions(+), 223 deletions(-) create mode 100644 storage/framework/defaults/functions/commerce/products/categories.ts create mode 100644 storage/framework/defaults/functions/commerce/products/items.ts create mode 100644 storage/framework/defaults/functions/commerce/products/reviews.ts create mode 100644 storage/framework/defaults/functions/commerce/products/units.ts create mode 100644 storage/framework/defaults/functions/commerce/products/variants.ts diff --git a/storage/framework/defaults/functions/commerce/coupons.ts b/storage/framework/defaults/functions/commerce/coupons.ts index ff57983148..811fcd1270 100644 --- a/storage/framework/defaults/functions/commerce/coupons.ts +++ b/storage/framework/defaults/functions/commerce/coupons.ts @@ -1,4 +1,4 @@ -import { useStorage } from '@vueuse/core' +import { useStorage, useFetch } from '@vueuse/core' import type { Coupons } from '../../types/coupon' // Create a persistent coupons array using VueUse's useStorage @@ -8,103 +8,84 @@ const baseURL = 'http://localhost:3008/api' // Basic fetch function to get all coupons async function fetchCoupons() { - try { - const response = await fetch(`${baseURL}/commerce/coupons`) + const { error, data } = useFetch(`${baseURL}/commerce/coupons`) - if (!response.ok) { - throw new Error(`HTTP error! Status: ${response.status}`) - } - - const data = await response.json() as Coupons[] + if (error.value) { + console.error('Error fetching coupons:', error.value) + return [] + } - // Ensure data is an array before assigning - if (Array.isArray(data)) { - coupons.value = data - return data - } - else { - console.error('Expected array of coupons but received:', typeof data) - return [] - } + if (Array.isArray(data.value)) { + coupons.value = data.value + return data.value } - catch (error) { - console.error('Error fetching coupons:', error) + else { + console.error('Expected array of coupons but received:', typeof data.value) return [] } } async function createCoupon(coupon: Coupons) { - try { - const response = await fetch(`${baseURL}/commerce/coupons`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(coupon), - }) - - if (!response.ok) { - throw new Error(`HTTP error! Status: ${response.status}`) - } - - const data = await response.json() as Coupons - coupons.value.push(data) - return data - } - catch (error) { - console.error('Error creating coupon:', error) + const { error, data } = useFetch(`${baseURL}/commerce/coupons`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(coupon), + }) + + if (error.value) { + console.error('Error creating coupon:', error.value) return null } + + if (data.value) { + coupons.value.push(data.value) + return data.value + } + return null } async function updateCoupon(coupon: Coupons) { - try { - const response = await fetch(`${baseURL}/commerce/coupons/${coupon.id}`, { - method: 'PATCH', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(coupon), - }) - - if (!response.ok) { - throw new Error(`HTTP error! Status: ${response.status}`) - } + const { error, data } = useFetch(`${baseURL}/commerce/coupons/${coupon.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(coupon), + }) + + if (error.value) { + console.error('Error updating coupon:', error.value) + return null + } - const data = await response.json() as Coupons + if (data.value) { const index = coupons.value.findIndex(c => c.id === coupon.id) if (index !== -1) { - coupons.value[index] = data + coupons.value[index] = data.value } - return data - } - catch (error) { - console.error('Error updating coupon:', error) - return null + return data.value } + return null } async function deleteCoupon(id: number) { - try { - const response = await fetch(`${baseURL}/commerce/coupons/${id}`, { - method: 'DELETE', - }) - - if (!response.ok) { - throw new Error(`HTTP error! Status: ${response.status}`) - } + const { error } = useFetch(`${baseURL}/commerce/coupons/${id}`, { + method: 'DELETE', + }) - const index = coupons.value.findIndex(c => c.id === id) - if (index !== -1) { - coupons.value.splice(index, 1) - } - - return true - } - catch (error) { - console.error('Error deleting coupon:', error) + if (error.value) { + console.error('Error deleting coupon:', error.value) return false } + + const index = coupons.value.findIndex(c => c.id === id) + if (index !== -1) { + coupons.value.splice(index, 1) + } + + return true } // Export the composable diff --git a/storage/framework/defaults/functions/commerce/customers.ts b/storage/framework/defaults/functions/commerce/customers.ts index 44fef3c8e3..d19f0d25d2 100644 --- a/storage/framework/defaults/functions/commerce/customers.ts +++ b/storage/framework/defaults/functions/commerce/customers.ts @@ -1,4 +1,4 @@ -import { useStorage } from '@vueuse/core' +import { useStorage, useFetch } from '@vueuse/core' import { Customers } from '../../types/customer' // Create a persistent customers array using VueUse's useStorage @@ -8,104 +8,85 @@ const baseURL = 'http://localhost:3008/api' // Basic fetch function to get all customers async function fetchCustomers() { - try { - const response = await fetch(`${baseURL}/commerce/customers`) + const { error, data } = useFetch(`${baseURL}/commerce/customers`) - if (!response.ok) { - throw new Error(`HTTP error! Status: ${response.status}`) - } - - const data = await response.json() as Customers[] + if (error.value) { + console.error('Error fetching customers:', error.value) + return [] + } - // Ensure data is an array before assigning - if (Array.isArray(data)) { - customers.value = data - return data - } - else { - console.error('Expected array of customers but received:', typeof data) - return [] - } + // Ensure data is an array before assigning + if (Array.isArray(data.value)) { + customers.value = data.value + return data.value } - catch (error) { - console.error('Error fetching customers:', error) + else { + console.error('Expected array of customers but received:', typeof data.value) return [] } } async function createCustomer(customer: Customers) { - try { - const response = await fetch(`${baseURL}/commerce/customers`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(customer), - }) - - if (!response.ok) { - throw new Error(`HTTP error! Status: ${response.status}`) - } - - const data = await response.json() as Customers - customers.value.push(data) - return data - } - catch (error) { - console.error('Error creating customer:', error) + const { error, data } = useFetch(`${baseURL}/commerce/customers`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(customer), + }) + + if (error.value) { + console.error('Error creating customer:', error.value) return null } + + if (data.value) { + customers.value.push(data.value) + return data.value + } + return null } async function updateCustomer(customer: Customers) { - try { - const response = await fetch(`${baseURL}/commerce/customers/${customer.id}`, { - method: 'PATCH', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(customer), - }) - - if (!response.ok) { - throw new Error(`HTTP error! Status: ${response.status}`) - } + const { error, data } = useFetch(`${baseURL}/commerce/customers/${customer.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(customer), + }) + + if (error.value) { + console.error('Error updating customer:', error.value) + return null + } - const data = await response.json() as Customers + if (data.value) { const index = customers.value.findIndex(c => c.id === customer.id) if (index !== -1) { - customers.value[index] = data + customers.value[index] = data.value } - return data - } - catch (error) { - console.error('Error updating customer:', error) - return null + return data.value } + return null } async function deleteCustomer(id: number) { - try { - const response = await fetch(`${baseURL}/commerce/customers/${id}`, { - method: 'DELETE', - }) - - if (!response.ok) { - throw new Error(`HTTP error! Status: ${response.status}`) - } + const { error } = useFetch(`${baseURL}/commerce/customers/${id}`, { + method: 'DELETE', + }) - const index = customers.value.findIndex(c => c.id === id) - - if (index !== -1) { - customers.value.splice(index, 1) - } - - return true - } - catch (error) { - console.error('Error deleting customer:', error) + if (error.value) { + console.error('Error deleting customer:', error.value) return false } + + const index = customers.value.findIndex(c => c.id === id) + if (index !== -1) { + customers.value.splice(index, 1) + } + + return true } diff --git a/storage/framework/defaults/functions/commerce/orders.ts b/storage/framework/defaults/functions/commerce/orders.ts index cf521e297d..21809faf94 100644 --- a/storage/framework/defaults/functions/commerce/orders.ts +++ b/storage/framework/defaults/functions/commerce/orders.ts @@ -1,4 +1,4 @@ -import { useStorage } from '@vueuse/core' +import { useStorage, useFetch } from '@vueuse/core' import type { Orders } from '../../types/order' // Create a persistent orders array using VueUse's useStorage @@ -8,103 +8,84 @@ const baseURL = 'http://localhost:3008/api' // Basic fetch function to get all orders async function fetchOrders() { - try { - const response = await fetch(`${baseURL}/commerce/orders`) + const { error, data } = useFetch(`${baseURL}/commerce/orders`) - if (!response.ok) { - throw new Error(`HTTP error! Status: ${response.status}`) - } - - const data = await response.json() as Orders[] + if (error.value) { + console.error('Error fetching orders:', error.value) + return [] + } - // Ensure data is an array before assigning - if (Array.isArray(data)) { - orders.value = data - return data - } - else { - console.error('Expected array of orders but received:', typeof data) - return [] - } + if (Array.isArray(data.value)) { + orders.value = data.value + return data.value } - catch (error) { - console.error('Error fetching orders:', error) + else { + console.error('Expected array of orders but received:', typeof data.value) return [] } } async function createOrder(order: Orders) { - try { - const response = await fetch(`${baseURL}/commerce/orders`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(order), - }) - - if (!response.ok) { - throw new Error(`HTTP error! Status: ${response.status}`) - } - - const data = await response.json() as Orders - orders.value.push(data) - return data - } - catch (error) { - console.error('Error creating order:', error) + const { error, data } = useFetch(`${baseURL}/commerce/orders`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(order), + }) + + if (error.value) { + console.error('Error creating order:', error.value) return null } + + if (data.value) { + orders.value.push(data.value) + return data.value + } + return null } async function updateOrder(order: Orders) { - try { - const response = await fetch(`${baseURL}/commerce/orders/${order.id}`, { - method: 'PATCH', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(order), - }) - - if (!response.ok) { - throw new Error(`HTTP error! Status: ${response.status}`) - } + const { error, data } = useFetch(`${baseURL}/commerce/orders/${order.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(order), + }) + + if (error.value) { + console.error('Error updating order:', error.value) + return null + } - const data = await response.json() as Orders + if (data.value) { const index = orders.value.findIndex(o => o.id === order.id) if (index !== -1) { - orders.value[index] = data + orders.value[index] = data.value } - return data - } - catch (error) { - console.error('Error updating order:', error) - return null + return data.value } + return null } async function deleteOrder(id: number) { - try { - const response = await fetch(`${baseURL}/commerce/orders/${id}`, { - method: 'DELETE', - }) - - if (!response.ok) { - throw new Error(`HTTP error! Status: ${response.status}`) - } + const { error } = useFetch(`${baseURL}/commerce/orders/${id}`, { + method: 'DELETE', + }) - const index = orders.value.findIndex(o => o.id === id) - if (index !== -1) { - orders.value.splice(index, 1) - } - - return true - } - catch (error) { - console.error('Error deleting order:', error) + if (error.value) { + console.error('Error deleting order:', error.value) return false } + + const index = orders.value.findIndex(o => o.id === id) + if (index !== -1) { + orders.value.splice(index, 1) + } + + return true } // Export the composable diff --git a/storage/framework/defaults/functions/commerce/products/categories.ts b/storage/framework/defaults/functions/commerce/products/categories.ts new file mode 100644 index 0000000000..0250c34198 --- /dev/null +++ b/storage/framework/defaults/functions/commerce/products/categories.ts @@ -0,0 +1,113 @@ +import { useStorage, useFetch } from '@vueuse/core' + + +export interface Categories { + id: number + name: string + description?: string + image_url?: string + is_active?: boolean + parent_category_id?: string + display_order: number + uuid?: string + created_at?: string + updated_at?: string +} + +// Create a persistent categories array using VueUse's useStorage +const categories = useStorage('categories', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all categories +async function fetchCategories() { + const { error, data } = useFetch(`${baseURL}/commerce/products/categories`) + + if (error.value) { + console.error('Error fetching categories:', error.value) + return [] + } + + if (Array.isArray(data.value)) { + categories.value = data.value + return data.value + } + else { + console.error('Expected array of categories but received:', typeof data.value) + return [] + } +} + +async function createCategory(category: Categories) { + const { error, data } = useFetch(`${baseURL}/commerce/products/categories`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(category), + }) + + if (error.value) { + console.error('Error creating category:', error.value) + return null + } + + if (data.value) { + categories.value.push(data.value) + return data.value + } + return null +} + +async function updateCategory(category: Categories) { + const { error, data } = useFetch(`${baseURL}/commerce/products/categories/${category.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(category), + }) + + if (error.value) { + console.error('Error updating category:', error.value) + return null + } + + if (data.value) { + const index = categories.value.findIndex(c => c.id === category.id) + if (index !== -1) { + categories.value[index] = data.value + } + return data.value + } + return null +} + +async function deleteCategory(id: number) { + const { error } = useFetch(`${baseURL}/commerce/products/categories/${id}`, { + method: 'DELETE', + }) + + if (error.value) { + console.error('Error deleting category:', error.value) + return false + } + + const index = categories.value.findIndex(c => c.id === id) + if (index !== -1) { + categories.value.splice(index, 1) + } + + return true +} + +// Export the composable +export function useCategories() { + return { + categories, + fetchCategories, + createCategory, + updateCategory, + deleteCategory, + } +} diff --git a/storage/framework/defaults/functions/commerce/products/items.ts b/storage/framework/defaults/functions/commerce/products/items.ts new file mode 100644 index 0000000000..3772be8048 --- /dev/null +++ b/storage/framework/defaults/functions/commerce/products/items.ts @@ -0,0 +1,118 @@ +import { useStorage, useFetch } from '@vueuse/core' + +export interface Items { + id: number + product_id: number + manufacturer_id: number + category_id: number + name: string + size?: string + color?: string + price: number + image_url?: string + is_available?: boolean + inventory_count?: number + sku: string + custom_options?: string + uuid?: string + created_at?: string + updated_at?: string +} + +// Create a persistent items array using VueUse's useStorage +const items = useStorage('items', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all items +async function fetchItems() { + const { error, data } = useFetch(`${baseURL}/commerce/products/items`) + + if (error.value) { + console.error('Error fetching items:', error.value) + return [] + } + + if (Array.isArray(data.value)) { + items.value = data.value + return data.value + } + else { + console.error('Expected array of items but received:', typeof data.value) + return [] + } +} + +async function createItem(item: Items) { + const { error, data } = useFetch(`${baseURL}/commerce/products/items`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(item), + }) + + if (error.value) { + console.error('Error creating item:', error.value) + return null + } + + if (data.value) { + items.value.push(data.value) + return data.value + } + return null +} + +async function updateItem(item: Items) { + const { error, data } = useFetch(`${baseURL}/commerce/products/items/${item.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(item), + }) + + if (error.value) { + console.error('Error updating item:', error.value) + return null + } + + if (data.value) { + const index = items.value.findIndex(i => i.id === item.id) + if (index !== -1) { + items.value[index] = data.value + } + return data.value + } + return null +} + +async function deleteItem(id: number) { + const { error } = useFetch(`${baseURL}/commerce/products/items/${id}`, { + method: 'DELETE', + }) + + if (error.value) { + console.error('Error deleting item:', error.value) + return false + } + + const index = items.value.findIndex(i => i.id === id) + if (index !== -1) { + items.value.splice(index, 1) + } + + return true +} + +// Export the composable +export function useItems() { + return { + items, + fetchItems, + createItem, + updateItem, + deleteItem, + } +} diff --git a/storage/framework/defaults/functions/commerce/products/reviews.ts b/storage/framework/defaults/functions/commerce/products/reviews.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/storage/framework/defaults/functions/commerce/products/units.ts b/storage/framework/defaults/functions/commerce/products/units.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/storage/framework/defaults/functions/commerce/products/variants.ts b/storage/framework/defaults/functions/commerce/products/variants.ts new file mode 100644 index 0000000000..e69de29bb2 From 57716e46c3773dc03bf80ea97670ac0415a263d1 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Thu, 3 Apr 2025 21:47:04 +0800 Subject: [PATCH 67/78] chore: wip --- storage/framework/core/logging/package.json | 2 +- storage/framework/core/logging/src/index.ts | 7 +- .../defaults/functions/commerce/coupons.ts | 6 +- .../defaults/functions/commerce/customers.ts | 7 +- .../defaults/functions/commerce/orders.ts | 6 +- .../functions/commerce/products/categories.ts | 18 +-- .../functions/commerce/products/items.ts | 23 +--- .../functions/commerce/products/reviews.ts | 118 ++++++++++++++++++ .../functions/commerce/products/units.ts | 112 +++++++++++++++++ .../functions/commerce/products/variants.ts | 112 +++++++++++++++++ storage/framework/defaults/types/coupon.ts | 21 ---- storage/framework/defaults/types/customer.ts | 14 --- storage/framework/defaults/types/index.ts | 88 +++++++++++++ storage/framework/defaults/types/order.ts | 19 --- 14 files changed, 447 insertions(+), 106 deletions(-) delete mode 100644 storage/framework/defaults/types/coupon.ts delete mode 100644 storage/framework/defaults/types/customer.ts create mode 100644 storage/framework/defaults/types/index.ts delete mode 100644 storage/framework/defaults/types/order.ts diff --git a/storage/framework/core/logging/package.json b/storage/framework/core/logging/package.json index a691212930..1759b7e68d 100644 --- a/storage/framework/core/logging/package.json +++ b/storage/framework/core/logging/package.json @@ -35,13 +35,13 @@ "prepublishOnly": "bun run build" }, "devDependencies": { + "@stacksjs/clarity": "^0.3.2", "@stacksjs/cli": "workspace:*", "@stacksjs/config": "workspace:*", "@stacksjs/error-handling": "workspace:*", "@stacksjs/path": "workspace:*", "@stacksjs/storage": "workspace:*", "@stacksjs/validation": "workspace:*", - "@stacksjs/clarity": "^0.3.2", "typescript": "^5.8.2" } } diff --git a/storage/framework/core/logging/src/index.ts b/storage/framework/core/logging/src/index.ts index 5acc4c3993..19c136dcef 100644 --- a/storage/framework/core/logging/src/index.ts +++ b/storage/framework/core/logging/src/index.ts @@ -1,18 +1,17 @@ /* eslint no-console: 0 */ import process from 'node:process' -import { buddyOptions, stripAnsi } from '@stacksjs/cli' +import { Logger } from '@stacksjs/clarity' +import { buddyOptions } from '@stacksjs/cli' import { handleError, writeToLogFile } from '@stacksjs/error-handling' +import * as p from '@stacksjs/path' import { ExitCode } from '@stacksjs/types' import { consola, createConsola } from 'consola' -import * as p from '@stacksjs/path' -import { Logger } from '@stacksjs/clarity' const clarityLog = new Logger('stacks', { level: 'debug', logDirectory: p.projectPath('storage/logs'), }) - // import type { Prompt } from '@stacksjs/cli' export function logLevel(): number { diff --git a/storage/framework/defaults/functions/commerce/coupons.ts b/storage/framework/defaults/functions/commerce/coupons.ts index 811fcd1270..b478d79c34 100644 --- a/storage/framework/defaults/functions/commerce/coupons.ts +++ b/storage/framework/defaults/functions/commerce/coupons.ts @@ -1,5 +1,5 @@ -import { useStorage, useFetch } from '@vueuse/core' -import type { Coupons } from '../../types/coupon' +import type { Coupons } from '../../types' +import { useFetch, useStorage } from '@vueuse/core' // Create a persistent coupons array using VueUse's useStorage const coupons = useStorage('coupons', []) @@ -84,7 +84,7 @@ async function deleteCoupon(id: number) { if (index !== -1) { coupons.value.splice(index, 1) } - + return true } diff --git a/storage/framework/defaults/functions/commerce/customers.ts b/storage/framework/defaults/functions/commerce/customers.ts index d19f0d25d2..9a949d7298 100644 --- a/storage/framework/defaults/functions/commerce/customers.ts +++ b/storage/framework/defaults/functions/commerce/customers.ts @@ -1,5 +1,5 @@ -import { useStorage, useFetch } from '@vueuse/core' -import { Customers } from '../../types/customer' +import type { Customers } from '../../types' +import { useFetch, useStorage } from '@vueuse/core' // Create a persistent customers array using VueUse's useStorage const customers = useStorage('customers', []) @@ -85,11 +85,10 @@ async function deleteCustomer(id: number) { if (index !== -1) { customers.value.splice(index, 1) } - + return true } - // Export the composable export function useCustomers() { return { diff --git a/storage/framework/defaults/functions/commerce/orders.ts b/storage/framework/defaults/functions/commerce/orders.ts index 21809faf94..63c4f48a11 100644 --- a/storage/framework/defaults/functions/commerce/orders.ts +++ b/storage/framework/defaults/functions/commerce/orders.ts @@ -1,5 +1,5 @@ -import { useStorage, useFetch } from '@vueuse/core' -import type { Orders } from '../../types/order' +import type { Orders } from '../../types' +import { useFetch, useStorage } from '@vueuse/core' // Create a persistent orders array using VueUse's useStorage const orders = useStorage('orders', []) @@ -84,7 +84,7 @@ async function deleteOrder(id: number) { if (index !== -1) { orders.value.splice(index, 1) } - + return true } diff --git a/storage/framework/defaults/functions/commerce/products/categories.ts b/storage/framework/defaults/functions/commerce/products/categories.ts index 0250c34198..a048239105 100644 --- a/storage/framework/defaults/functions/commerce/products/categories.ts +++ b/storage/framework/defaults/functions/commerce/products/categories.ts @@ -1,18 +1,4 @@ -import { useStorage, useFetch } from '@vueuse/core' - - -export interface Categories { - id: number - name: string - description?: string - image_url?: string - is_active?: boolean - parent_category_id?: string - display_order: number - uuid?: string - created_at?: string - updated_at?: string -} +import { useFetch, useStorage } from '@vueuse/core' // Create a persistent categories array using VueUse's useStorage const categories = useStorage('categories', []) @@ -97,7 +83,7 @@ async function deleteCategory(id: number) { if (index !== -1) { categories.value.splice(index, 1) } - + return true } diff --git a/storage/framework/defaults/functions/commerce/products/items.ts b/storage/framework/defaults/functions/commerce/products/items.ts index 3772be8048..5d66b8d888 100644 --- a/storage/framework/defaults/functions/commerce/products/items.ts +++ b/storage/framework/defaults/functions/commerce/products/items.ts @@ -1,23 +1,4 @@ -import { useStorage, useFetch } from '@vueuse/core' - -export interface Items { - id: number - product_id: number - manufacturer_id: number - category_id: number - name: string - size?: string - color?: string - price: number - image_url?: string - is_available?: boolean - inventory_count?: number - sku: string - custom_options?: string - uuid?: string - created_at?: string - updated_at?: string -} +import { useFetch, useStorage } from '@vueuse/core' // Create a persistent items array using VueUse's useStorage const items = useStorage('items', []) @@ -102,7 +83,7 @@ async function deleteItem(id: number) { if (index !== -1) { items.value.splice(index, 1) } - + return true } diff --git a/storage/framework/defaults/functions/commerce/products/reviews.ts b/storage/framework/defaults/functions/commerce/products/reviews.ts index e69de29bb2..7231033186 100644 --- a/storage/framework/defaults/functions/commerce/products/reviews.ts +++ b/storage/framework/defaults/functions/commerce/products/reviews.ts @@ -0,0 +1,118 @@ +import { useFetch, useStorage } from '@vueuse/core' + +export interface Reviews { + id: number + product_id: number + customer_id: number + rating: number + title: string + content: string + is_verified_purchase?: boolean + is_approved?: boolean + is_featured?: boolean + helpful_votes?: number + unhelpful_votes?: number + purchase_date?: string + images?: string + uuid?: string + created_at?: string + updated_at?: string +} + +// Create a persistent reviews array using VueUse's useStorage +const reviews = useStorage('reviews', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all reviews +async function fetchReviews() { + const { error, data } = useFetch(`${baseURL}/commerce/products/reviews`) + + if (error.value) { + console.error('Error fetching reviews:', error.value) + return [] + } + + if (Array.isArray(data.value)) { + reviews.value = data.value + return data.value + } + else { + console.error('Expected array of reviews but received:', typeof data.value) + return [] + } +} + +async function createReview(review: Reviews) { + const { error, data } = useFetch(`${baseURL}/commerce/products/reviews`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(review), + }) + + if (error.value) { + console.error('Error creating review:', error.value) + return null + } + + if (data.value) { + reviews.value.push(data.value) + return data.value + } + return null +} + +async function updateReview(review: Reviews) { + const { error, data } = useFetch(`${baseURL}/commerce/products/reviews/${review.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(review), + }) + + if (error.value) { + console.error('Error updating review:', error.value) + return null + } + + if (data.value) { + const index = reviews.value.findIndex(r => r.id === review.id) + if (index !== -1) { + reviews.value[index] = data.value + } + return data.value + } + return null +} + +async function deleteReview(id: number) { + const { error } = useFetch(`${baseURL}/commerce/products/reviews/${id}`, { + method: 'DELETE', + }) + + if (error.value) { + console.error('Error deleting review:', error.value) + return false + } + + const index = reviews.value.findIndex(r => r.id === id) + if (index !== -1) { + reviews.value.splice(index, 1) + } + + return true +} + +// Export the composable +export function useReviews() { + return { + reviews, + fetchReviews, + createReview, + updateReview, + deleteReview, + } +} diff --git a/storage/framework/defaults/functions/commerce/products/units.ts b/storage/framework/defaults/functions/commerce/products/units.ts index e69de29bb2..6ee825ddc9 100644 --- a/storage/framework/defaults/functions/commerce/products/units.ts +++ b/storage/framework/defaults/functions/commerce/products/units.ts @@ -0,0 +1,112 @@ +import { useFetch, useStorage } from '@vueuse/core' + +export interface Units { + id: number + product_id: number + name: string + abbreviation: string + type: string + description?: string + is_default?: boolean + uuid?: string + created_at?: string + updated_at?: string +} + +// Create a persistent units array using VueUse's useStorage +const units = useStorage('units', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all units +async function fetchUnits() { + const { error, data } = useFetch(`${baseURL}/commerce/products/units`) + + if (error.value) { + console.error('Error fetching units:', error.value) + return [] + } + + if (Array.isArray(data.value)) { + units.value = data.value + return data.value + } + else { + console.error('Expected array of units but received:', typeof data.value) + return [] + } +} + +async function createUnit(unit: Units) { + const { error, data } = useFetch(`${baseURL}/commerce/products/units`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(unit), + }) + + if (error.value) { + console.error('Error creating unit:', error.value) + return null + } + + if (data.value) { + units.value.push(data.value) + return data.value + } + return null +} + +async function updateUnit(unit: Units) { + const { error, data } = useFetch(`${baseURL}/commerce/products/units/${unit.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(unit), + }) + + if (error.value) { + console.error('Error updating unit:', error.value) + return null + } + + if (data.value) { + const index = units.value.findIndex(u => u.id === unit.id) + if (index !== -1) { + units.value[index] = data.value + } + return data.value + } + return null +} + +async function deleteUnit(id: number) { + const { error } = useFetch(`${baseURL}/commerce/products/units/${id}`, { + method: 'DELETE', + }) + + if (error.value) { + console.error('Error deleting unit:', error.value) + return false + } + + const index = units.value.findIndex(u => u.id === id) + if (index !== -1) { + units.value.splice(index, 1) + } + + return true +} + +// Export the composable +export function useUnits() { + return { + units, + fetchUnits, + createUnit, + updateUnit, + deleteUnit, + } +} diff --git a/storage/framework/defaults/functions/commerce/products/variants.ts b/storage/framework/defaults/functions/commerce/products/variants.ts index e69de29bb2..3697beab41 100644 --- a/storage/framework/defaults/functions/commerce/products/variants.ts +++ b/storage/framework/defaults/functions/commerce/products/variants.ts @@ -0,0 +1,112 @@ +import { useFetch, useStorage } from '@vueuse/core' + +export interface Variants { + id: number + product_id: number + variant: string + type: string + description?: string + options?: string + status: string | string[] + uuid?: string + created_at?: string + updated_at?: string +} + +// Create a persistent variants array using VueUse's useStorage +const variants = useStorage('variants', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all variants +async function fetchVariants() { + const { error, data } = useFetch(`${baseURL}/commerce/products/variants`) + + if (error.value) { + console.error('Error fetching variants:', error.value) + return [] + } + + if (Array.isArray(data.value)) { + variants.value = data.value + return data.value + } + else { + console.error('Expected array of variants but received:', typeof data.value) + return [] + } +} + +async function createVariant(variant: Variants) { + const { error, data } = useFetch(`${baseURL}/commerce/products/variants`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(variant), + }) + + if (error.value) { + console.error('Error creating variant:', error.value) + return null + } + + if (data.value) { + variants.value.push(data.value) + return data.value + } + return null +} + +async function updateVariant(variant: Variants) { + const { error, data } = useFetch(`${baseURL}/commerce/products/variants/${variant.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(variant), + }) + + if (error.value) { + console.error('Error updating variant:', error.value) + return null + } + + if (data.value) { + const index = variants.value.findIndex(v => v.id === variant.id) + if (index !== -1) { + variants.value[index] = data.value + } + return data.value + } + return null +} + +async function deleteVariant(id: number) { + const { error } = useFetch(`${baseURL}/commerce/products/variants/${id}`, { + method: 'DELETE', + }) + + if (error.value) { + console.error('Error deleting variant:', error.value) + return false + } + + const index = variants.value.findIndex(v => v.id === id) + if (index !== -1) { + variants.value.splice(index, 1) + } + + return true +} + +// Export the composable +export function useVariants() { + return { + variants, + fetchVariants, + createVariant, + updateVariant, + deleteVariant, + } +} diff --git a/storage/framework/defaults/types/coupon.ts b/storage/framework/defaults/types/coupon.ts deleted file mode 100644 index ea89f8e6f4..0000000000 --- a/storage/framework/defaults/types/coupon.ts +++ /dev/null @@ -1,21 +0,0 @@ -export interface Coupons { - id: number - product_id: number - code: string - description?: string - discount_type: string - discount_value: number - min_order_amount?: number - max_discount_amount?: number - free_product_id?: string - is_active?: boolean - usage_limit?: number - usage_count?: number - start_date: Date | string - end_date: Date | string - applicable_products?: string - applicable_categories?: string - uuid?: string - created_at?: string - updated_at?: string -} diff --git a/storage/framework/defaults/types/customer.ts b/storage/framework/defaults/types/customer.ts deleted file mode 100644 index 57eca38151..0000000000 --- a/storage/framework/defaults/types/customer.ts +++ /dev/null @@ -1,14 +0,0 @@ -export interface Customers { - id: number - user_id: number - name: string - email: string - phone: string - total_spent?: number - last_order?: string - status: string | string[] - avatar?: string - uuid?: string - created_at?: string - updated_at?: string -} \ No newline at end of file diff --git a/storage/framework/defaults/types/index.ts b/storage/framework/defaults/types/index.ts new file mode 100644 index 0000000000..aafd572360 --- /dev/null +++ b/storage/framework/defaults/types/index.ts @@ -0,0 +1,88 @@ +export interface Coupons { + id: number + product_id: number + code: string + description?: string + discount_type: string + discount_value: number + min_order_amount?: number + max_discount_amount?: number + free_product_id?: string + is_active?: boolean + usage_limit?: number + usage_count?: number + start_date: Date | string + end_date: Date | string + applicable_products?: string + applicable_categories?: string + uuid?: string + created_at?: string + updated_at?: string +} + +export interface Customers { + id: number + user_id: number + name: string + email: string + phone: string + total_spent?: number + last_order?: string + status: string | string[] + avatar?: string + uuid?: string + created_at?: string + updated_at?: string +} + +export interface Orders { + id: number + customer_id: number + coupon_id: number + status: string + total_amount: number + tax_amount?: number + discount_amount?: number + delivery_fee?: number + tip_amount?: number + order_type: string + delivery_address?: string + special_instructions?: string + estimated_delivery_time?: string + applied_coupon_id?: string + uuid?: string + created_at?: string + updated_at?: string +} + +export interface Categories { + id: number + name: string + description?: string + image_url?: string + is_active?: boolean + parent_category_id?: string + display_order: number + uuid?: string + created_at?: string + updated_at?: string +} + +export interface Items { + id: number + product_id: number + manufacturer_id: number + category_id: number + name: string + size?: string + color?: string + price: number + image_url?: string + is_available?: boolean + inventory_count?: number + sku: string + custom_options?: string + uuid?: string + created_at?: string + updated_at?: string +} \ No newline at end of file diff --git a/storage/framework/defaults/types/order.ts b/storage/framework/defaults/types/order.ts deleted file mode 100644 index 6f3a04860f..0000000000 --- a/storage/framework/defaults/types/order.ts +++ /dev/null @@ -1,19 +0,0 @@ -export interface Orders { - id: number - customer_id: number - coupon_id: number - status: string - total_amount: number - tax_amount?: number - discount_amount?: number - delivery_fee?: number - tip_amount?: number - order_type: string - delivery_address?: string - special_instructions?: string - estimated_delivery_time?: string - applied_coupon_id?: string - uuid?: string - created_at?: string - updated_at?: string -} \ No newline at end of file From 28e8ec9155b40ba1555d3413abe2c26c712752e6 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Thu, 3 Apr 2025 21:53:24 +0800 Subject: [PATCH 68/78] chore: wip --- .../functions/commerce/products/categories.ts | 9 ++--- .../functions/commerce/products/items.ts | 9 ++--- .../functions/commerce/products/reviews.ts | 27 +++------------ .../functions/commerce/products/units.ts | 8 ++--- .../functions/commerce/products/variants.ts | 13 +------- storage/framework/defaults/types/index.ts | 33 +++++++++++++++++++ 6 files changed, 53 insertions(+), 46 deletions(-) diff --git a/storage/framework/defaults/functions/commerce/products/categories.ts b/storage/framework/defaults/functions/commerce/products/categories.ts index a048239105..5433bc2b84 100644 --- a/storage/framework/defaults/functions/commerce/products/categories.ts +++ b/storage/framework/defaults/functions/commerce/products/categories.ts @@ -1,4 +1,5 @@ import { useFetch, useStorage } from '@vueuse/core' +import { Categories } from '../../../types' // Create a persistent categories array using VueUse's useStorage const categories = useStorage('categories', []) @@ -6,7 +7,7 @@ const categories = useStorage('categories', []) const baseURL = 'http://localhost:3008/api' // Basic fetch function to get all categories -async function fetchCategories() { +async function fetchCategories(): Promise { const { error, data } = useFetch(`${baseURL}/commerce/products/categories`) if (error.value) { @@ -24,7 +25,7 @@ async function fetchCategories() { } } -async function createCategory(category: Categories) { +async function createCategory(category: Categories): Promise { const { error, data } = useFetch(`${baseURL}/commerce/products/categories`, { method: 'POST', headers: { @@ -45,7 +46,7 @@ async function createCategory(category: Categories) { return null } -async function updateCategory(category: Categories) { +async function updateCategory(category: Categories): Promise { const { error, data } = useFetch(`${baseURL}/commerce/products/categories/${category.id}`, { method: 'PATCH', headers: { @@ -69,7 +70,7 @@ async function updateCategory(category: Categories) { return null } -async function deleteCategory(id: number) { +async function deleteCategory(id: number): Promise { const { error } = useFetch(`${baseURL}/commerce/products/categories/${id}`, { method: 'DELETE', }) diff --git a/storage/framework/defaults/functions/commerce/products/items.ts b/storage/framework/defaults/functions/commerce/products/items.ts index 5d66b8d888..7cf4a9be95 100644 --- a/storage/framework/defaults/functions/commerce/products/items.ts +++ b/storage/framework/defaults/functions/commerce/products/items.ts @@ -1,4 +1,5 @@ import { useFetch, useStorage } from '@vueuse/core' +import { Items } from '../../../types' // Create a persistent items array using VueUse's useStorage const items = useStorage('items', []) @@ -6,7 +7,7 @@ const items = useStorage('items', []) const baseURL = 'http://localhost:3008/api' // Basic fetch function to get all items -async function fetchItems() { +async function fetchItems(): Promise { const { error, data } = useFetch(`${baseURL}/commerce/products/items`) if (error.value) { @@ -24,7 +25,7 @@ async function fetchItems() { } } -async function createItem(item: Items) { +async function createItem(item: Items): Promise { const { error, data } = useFetch(`${baseURL}/commerce/products/items`, { method: 'POST', headers: { @@ -45,7 +46,7 @@ async function createItem(item: Items) { return null } -async function updateItem(item: Items) { +async function updateItem(item: Items): Promise { const { error, data } = useFetch(`${baseURL}/commerce/products/items/${item.id}`, { method: 'PATCH', headers: { @@ -69,7 +70,7 @@ async function updateItem(item: Items) { return null } -async function deleteItem(id: number) { +async function deleteItem(id: number): Promise { const { error } = useFetch(`${baseURL}/commerce/products/items/${id}`, { method: 'DELETE', }) diff --git a/storage/framework/defaults/functions/commerce/products/reviews.ts b/storage/framework/defaults/functions/commerce/products/reviews.ts index 7231033186..0459fe90f0 100644 --- a/storage/framework/defaults/functions/commerce/products/reviews.ts +++ b/storage/framework/defaults/functions/commerce/products/reviews.ts @@ -1,23 +1,6 @@ import { useFetch, useStorage } from '@vueuse/core' +import { Reviews } from '../../../types' -export interface Reviews { - id: number - product_id: number - customer_id: number - rating: number - title: string - content: string - is_verified_purchase?: boolean - is_approved?: boolean - is_featured?: boolean - helpful_votes?: number - unhelpful_votes?: number - purchase_date?: string - images?: string - uuid?: string - created_at?: string - updated_at?: string -} // Create a persistent reviews array using VueUse's useStorage const reviews = useStorage('reviews', []) @@ -25,7 +8,7 @@ const reviews = useStorage('reviews', []) const baseURL = 'http://localhost:3008/api' // Basic fetch function to get all reviews -async function fetchReviews() { +async function fetchReviews(): Promise { const { error, data } = useFetch(`${baseURL}/commerce/products/reviews`) if (error.value) { @@ -43,7 +26,7 @@ async function fetchReviews() { } } -async function createReview(review: Reviews) { +async function createReview(review: Reviews): Promise { const { error, data } = useFetch(`${baseURL}/commerce/products/reviews`, { method: 'POST', headers: { @@ -64,7 +47,7 @@ async function createReview(review: Reviews) { return null } -async function updateReview(review: Reviews) { +async function updateReview(review: Reviews): Promise { const { error, data } = useFetch(`${baseURL}/commerce/products/reviews/${review.id}`, { method: 'PATCH', headers: { @@ -88,7 +71,7 @@ async function updateReview(review: Reviews) { return null } -async function deleteReview(id: number) { +async function deleteReview(id: number): Promise { const { error } = useFetch(`${baseURL}/commerce/products/reviews/${id}`, { method: 'DELETE', }) diff --git a/storage/framework/defaults/functions/commerce/products/units.ts b/storage/framework/defaults/functions/commerce/products/units.ts index 6ee825ddc9..7c406404ca 100644 --- a/storage/framework/defaults/functions/commerce/products/units.ts +++ b/storage/framework/defaults/functions/commerce/products/units.ts @@ -19,7 +19,7 @@ const units = useStorage('units', []) const baseURL = 'http://localhost:3008/api' // Basic fetch function to get all units -async function fetchUnits() { +async function fetchUnits(): Promise { const { error, data } = useFetch(`${baseURL}/commerce/products/units`) if (error.value) { @@ -37,7 +37,7 @@ async function fetchUnits() { } } -async function createUnit(unit: Units) { +async function createUnit(unit: Units): Promise { const { error, data } = useFetch(`${baseURL}/commerce/products/units`, { method: 'POST', headers: { @@ -58,7 +58,7 @@ async function createUnit(unit: Units) { return null } -async function updateUnit(unit: Units) { +async function updateUnit(unit: Units): Promise { const { error, data } = useFetch(`${baseURL}/commerce/products/units/${unit.id}`, { method: 'PATCH', headers: { @@ -82,7 +82,7 @@ async function updateUnit(unit: Units) { return null } -async function deleteUnit(id: number) { +async function deleteUnit(id: number): Promise { const { error } = useFetch(`${baseURL}/commerce/products/units/${id}`, { method: 'DELETE', }) diff --git a/storage/framework/defaults/functions/commerce/products/variants.ts b/storage/framework/defaults/functions/commerce/products/variants.ts index 3697beab41..e4b8eb21aa 100644 --- a/storage/framework/defaults/functions/commerce/products/variants.ts +++ b/storage/framework/defaults/functions/commerce/products/variants.ts @@ -1,17 +1,6 @@ import { useFetch, useStorage } from '@vueuse/core' +import { Variants } from '../../../types' -export interface Variants { - id: number - product_id: number - variant: string - type: string - description?: string - options?: string - status: string | string[] - uuid?: string - created_at?: string - updated_at?: string -} // Create a persistent variants array using VueUse's useStorage const variants = useStorage('variants', []) diff --git a/storage/framework/defaults/types/index.ts b/storage/framework/defaults/types/index.ts index aafd572360..040fac3229 100644 --- a/storage/framework/defaults/types/index.ts +++ b/storage/framework/defaults/types/index.ts @@ -85,4 +85,37 @@ export interface Items { uuid?: string created_at?: string updated_at?: string +} + + +export interface Reviews { + id: number + product_id: number + customer_id: number + rating: number + title: string + content: string + is_verified_purchase?: boolean + is_approved?: boolean + is_featured?: boolean + helpful_votes?: number + unhelpful_votes?: number + purchase_date?: string + images?: string + uuid?: string + created_at?: string + updated_at?: string +} + +export interface Variants { + id: number + product_id: number + variant: string + type: string + description?: string + options?: string + status: string | string[] + uuid?: string + created_at?: string + updated_at?: string } \ No newline at end of file From da5126e74591232bda4e908d3cdd4f3e91fe6dec Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Thu, 3 Apr 2025 22:08:18 +0800 Subject: [PATCH 69/78] chore: wip --- .../defaults/functions/commerce/gift-cards.ts | 100 ++++++++++++++++++ .../defaults/functions/commerce/payments.ts | 100 ++++++++++++++++++ storage/framework/defaults/types/index.ts | 44 ++++++++ 3 files changed, 244 insertions(+) create mode 100644 storage/framework/defaults/functions/commerce/gift-cards.ts create mode 100644 storage/framework/defaults/functions/commerce/payments.ts diff --git a/storage/framework/defaults/functions/commerce/gift-cards.ts b/storage/framework/defaults/functions/commerce/gift-cards.ts new file mode 100644 index 0000000000..b57fe0a3be --- /dev/null +++ b/storage/framework/defaults/functions/commerce/gift-cards.ts @@ -0,0 +1,100 @@ +import { useFetch, useStorage } from '@vueuse/core' +import { GiftCard } from '../../../types' + +// Create a persistent gift cards array using VueUse's useStorage +const giftCards = useStorage('giftCards', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all gift cards +async function fetchGiftCards(): Promise { + const { error, data } = useFetch(`${baseURL}/commerce/gift-cards`) + + if (error.value) { + console.error('Error fetching gift cards:', error.value) + return [] + } + + if (Array.isArray(data.value)) { + giftCards.value = data.value + return data.value + } + else { + console.error('Expected array of gift cards but received:', typeof data.value) + return [] + } +} + +async function createGiftCard(giftCard: GiftCard): Promise { + const { error, data } = useFetch(`${baseURL}/commerce/gift-cards`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(giftCard), + }) + + if (error.value) { + console.error('Error creating gift card:', error.value) + return null + } + + if (data.value) { + giftCards.value.push(data.value) + return data.value + } + return null +} + +async function updateGiftCard(giftCard: GiftCard): Promise { + const { error, data } = useFetch(`${baseURL}/commerce/gift-cards/${giftCard.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(giftCard), + }) + + if (error.value) { + console.error('Error updating gift card:', error.value) + return null + } + + if (data.value) { + const index = giftCards.value.findIndex(g => g.id === giftCard.id) + if (index !== -1) { + giftCards.value[index] = data.value + } + return data.value + } + return null +} + +async function deleteGiftCard(id: number): Promise { + const { error } = useFetch(`${baseURL}/commerce/gift-cards/${id}`, { + method: 'DELETE', + }) + + if (error.value) { + console.error('Error deleting gift card:', error.value) + return false + } + + const index = giftCards.value.findIndex(g => g.id === id) + if (index !== -1) { + giftCards.value.splice(index, 1) + } + + return true +} + +// Export the composable +export function useGiftCards() { + return { + giftCards, + fetchGiftCards, + createGiftCard, + updateGiftCard, + deleteGiftCard, + } +} diff --git a/storage/framework/defaults/functions/commerce/payments.ts b/storage/framework/defaults/functions/commerce/payments.ts new file mode 100644 index 0000000000..b3a5e4d27b --- /dev/null +++ b/storage/framework/defaults/functions/commerce/payments.ts @@ -0,0 +1,100 @@ +import { useFetch, useStorage } from '@vueuse/core' +import { Payment } from '../../../types' + +// Create a persistent payments array using VueUse's useStorage +const payments = useStorage('payments', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all payments +async function fetchPayments(): Promise { + const { error, data } = useFetch(`${baseURL}/commerce/payments`) + + if (error.value) { + console.error('Error fetching payments:', error.value) + return [] + } + + if (Array.isArray(data.value)) { + payments.value = data.value + return data.value + } + else { + console.error('Expected array of payments but received:', typeof data.value) + return [] + } +} + +async function createPayment(payment: Payment): Promise { + const { error, data } = useFetch(`${baseURL}/commerce/payments`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(payment), + }) + + if (error.value) { + console.error('Error creating payment:', error.value) + return null + } + + if (data.value) { + payments.value.push(data.value) + return data.value + } + return null +} + +async function updatePayment(payment: Payment): Promise { + const { error, data } = useFetch(`${baseURL}/commerce/payments/${payment.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(payment), + }) + + if (error.value) { + console.error('Error updating payment:', error.value) + return null + } + + if (data.value) { + const index = payments.value.findIndex(p => p.id === payment.id) + if (index !== -1) { + payments.value[index] = data.value + } + return data.value + } + return null +} + +async function deletePayment(id: number): Promise { + const { error } = useFetch(`${baseURL}/commerce/payments/${id}`, { + method: 'DELETE', + }) + + if (error.value) { + console.error('Error deleting payment:', error.value) + return false + } + + const index = payments.value.findIndex(p => p.id === id) + if (index !== -1) { + payments.value.splice(index, 1) + } + + return true +} + +// Export the composable +export function usePayments() { + return { + payments, + fetchPayments, + createPayment, + updatePayment, + deletePayment, + } +} diff --git a/storage/framework/defaults/types/index.ts b/storage/framework/defaults/types/index.ts index 040fac3229..ab40aedaa5 100644 --- a/storage/framework/defaults/types/index.ts +++ b/storage/framework/defaults/types/index.ts @@ -118,4 +118,48 @@ export interface Variants { uuid?: string created_at?: string updated_at?: string +} + +export interface GiftCard { + id: number + customer_id: number + code: string + initial_balance: number + current_balance: number + currency?: string + status: string + purchaser_id?: string + recipient_email?: string + recipient_name?: string + personal_message?: string + is_digital?: boolean + is_reloadable?: boolean + is_active?: boolean + expiry_date?: Date | string + last_used_date?: Date | string + template_id?: string + uuid?: string + created_at?: string + updated_at?: string +} + +export interface Payment { + id: number + order_id: number + customer_id: number + amount: number + method: string + status: string + currency?: string + reference_number?: string + card_last_four?: string + card_brand?: string + billing_email?: string + transaction_id?: string + payment_provider?: string + refund_amount?: number + notes?: string + uuid?: string + created_at?: string + updated_at?: string } \ No newline at end of file From eabda906ec0681a7094600245559a4d94faee2d6 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Thu, 3 Apr 2025 23:01:23 +0800 Subject: [PATCH 70/78] chore: wip --- storage/framework/browser-auto-imports.json | 3 +- .../defaults/functions/commerce/taxes.ts | 101 ++++++++++++++++++ storage/framework/defaults/types/index.ts | 14 +++ .../framework/types/browser-auto-imports.d.ts | 4 +- 4 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 storage/framework/defaults/functions/commerce/taxes.ts diff --git a/storage/framework/browser-auto-imports.json b/storage/framework/browser-auto-imports.json index 7aeed1eaf7..6c526c6232 100644 --- a/storage/framework/browser-auto-imports.json +++ b/storage/framework/browser-auto-imports.json @@ -447,6 +447,7 @@ "format": true, "now": true, "parse": true, - "RetryOptions": true + "RetryOptions": true, + "Fetch": true } } diff --git a/storage/framework/defaults/functions/commerce/taxes.ts b/storage/framework/defaults/functions/commerce/taxes.ts new file mode 100644 index 0000000000..11e286a966 --- /dev/null +++ b/storage/framework/defaults/functions/commerce/taxes.ts @@ -0,0 +1,101 @@ +import type { TaxRates } from '../../types' +import { useFetch, useStorage } from '@vueuse/core' + +// Create a persistent tax rates array using VueUse's useStorage +const taxRates = useStorage('taxRates', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all tax rates +async function fetchTaxRates() { + const { error, data } = useFetch(`${baseURL}/commerce/tax-rates`) + + if (error.value) { + console.error('Error fetching tax rates:', error.value) + return [] + } + + // Ensure data is an array before assigning + if (Array.isArray(data.value)) { + taxRates.value = data.value + return data.value + } + else { + console.error('Expected array of tax rates but received:', typeof data.value) + return [] + } +} + +async function createTaxRate(taxRate: TaxRates) { + const { error, data } = useFetch(`${baseURL}/commerce/tax-rates`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(taxRate), + }) + + if (error.value) { + console.error('Error creating tax rate:', error.value) + return null + } + + if (data.value) { + taxRates.value.push(data.value) + return data.value + } + return null +} + +async function updateTaxRate(taxRate: TaxRates) { + const { error, data } = useFetch(`${baseURL}/commerce/tax-rates/${taxRate.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(taxRate), + }) + + if (error.value) { + console.error('Error updating tax rate:', error.value) + return null + } + + if (data.value) { + const index = taxRates.value.findIndex(t => t.id === taxRate.id) + if (index !== -1) { + taxRates.value[index] = data.value + } + return data.value + } + return null +} + +async function deleteTaxRate(id: number) { + const { error } = useFetch(`${baseURL}/commerce/tax-rates/${id}`, { + method: 'DELETE', + }) + + if (error.value) { + console.error('Error deleting tax rate:', error.value) + return false + } + + const index = taxRates.value.findIndex(t => t.id === id) + if (index !== -1) { + taxRates.value.splice(index, 1) + } + + return true +} + +// Export the composable +export function useTaxRates() { + return { + taxRates, + fetchTaxRates, + createTaxRate, + updateTaxRate, + deleteTaxRate, + } +} diff --git a/storage/framework/defaults/types/index.ts b/storage/framework/defaults/types/index.ts index ab40aedaa5..9f3488ea87 100644 --- a/storage/framework/defaults/types/index.ts +++ b/storage/framework/defaults/types/index.ts @@ -162,4 +162,18 @@ export interface Payment { uuid?: string created_at?: string updated_at?: string +} + +export interface TaxRates { + id: number + name: string + rate: number + type: string + country: string + region: string | string[] + status?: string | string[] + is_default?: boolean + uuid?: string + created_at?: string + updated_at?: string } \ No newline at end of file diff --git a/storage/framework/types/browser-auto-imports.d.ts b/storage/framework/types/browser-auto-imports.d.ts index 5d3f6d0a2e..7a41017638 100644 --- a/storage/framework/types/browser-auto-imports.d.ts +++ b/storage/framework/types/browser-auto-imports.d.ts @@ -7,6 +7,7 @@ export {} declare global { const EffectScope: typeof import('vue')['EffectScope'] + const Fetch: typeof import('../core/browser/src/utils/fetch')['Fetch'] const Head: typeof import('../core/browser/src/utils/vendors')['Head'] const HeadVuePlugin: typeof import('../core/browser/src/utils/vendors')['HeadVuePlugin'] const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate'] @@ -458,6 +459,7 @@ declare module 'vue' { interface GlobalComponents {} interface ComponentCustomProperties { readonly EffectScope: UnwrapRef + readonly Fetch: UnwrapRef readonly Head: UnwrapRef readonly HeadVuePlugin: UnwrapRef readonly acceptHMRUpdate: UnwrapRef @@ -465,7 +467,6 @@ declare module 'vue' { readonly anyOf: UnwrapRef readonly asyncComputed: UnwrapRef readonly autoResetRef: UnwrapRef - readonly batchInvoke: UnwrapRef readonly breakpointsAntDesign: UnwrapRef readonly breakpointsBootstrapV5: UnwrapRef readonly breakpointsMasterCss: UnwrapRef @@ -644,7 +645,6 @@ declare module 'vue' { readonly syncRef: UnwrapRef readonly syncRefs: UnwrapRef readonly tab: UnwrapRef - readonly tap: UnwrapRef readonly templateRef: UnwrapRef readonly throttle: UnwrapRef readonly throttledRef: UnwrapRef From b7f80992e8cab9b5bad22a6707c269d2870d1510 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Thu, 3 Apr 2025 23:05:28 +0800 Subject: [PATCH 71/78] chore: wip --- .../shippings/{routes => delivery-routes}/destroy.ts | 0 .../shippings/{routes => delivery-routes}/fetch.ts | 0 .../shippings/{routes => delivery-routes}/index.ts | 0 .../shippings/{routes => delivery-routes}/store.ts | 0 .../shippings/{routes => delivery-routes}/update.ts | 0 .../{digital => digital-deliveries}/destroy.ts | 0 .../{digital => digital-deliveries}/fetch.ts | 0 .../{digital => digital-deliveries}/index.ts | 0 .../{digital => digital-deliveries}/store.ts | 0 .../{digital => digital-deliveries}/update.ts | 0 .../framework/core/commerce/src/shippings/index.ts | 12 ++++++------ .../shippings/{licenses => license-keys}/destroy.ts | 0 .../shippings/{licenses => license-keys}/fetch.ts | 0 .../shippings/{licenses => license-keys}/index.ts | 0 .../shippings/{licenses => license-keys}/store.ts | 0 .../shippings/{licenses => license-keys}/update.ts | 0 .../{methods => shipping-methods}/destroy.ts | 0 .../shippings/{methods => shipping-methods}/fetch.ts | 0 .../shippings/{methods => shipping-methods}/index.ts | 0 .../shippings/{methods => shipping-methods}/store.ts | 0 .../{methods => shipping-methods}/update.ts | 0 .../shippings/{rates => shipping-rates}/destroy.ts | 0 .../src/shippings/{rates => shipping-rates}/fetch.ts | 0 .../src/shippings/{rates => shipping-rates}/index.ts | 0 .../src/shippings/{rates => shipping-rates}/store.ts | 0 .../shippings/{rates => shipping-rates}/update.ts | 0 .../shippings/{zones => shipping-zones}/destroy.ts | 0 .../src/shippings/{zones => shipping-zones}/fetch.ts | 0 .../src/shippings/{zones => shipping-zones}/index.ts | 0 .../src/shippings/{zones => shipping-zones}/store.ts | 0 .../shippings/{zones => shipping-zones}/update.ts | 0 .../core/commerce/src/tests/digitals.test.ts | 8 ++++---- .../core/commerce/src/tests/license.test.ts | 8 ++++---- .../framework/core/commerce/src/tests/rates.test.ts | 8 ++++---- .../framework/core/commerce/src/tests/routes.test.ts | 8 ++++---- .../core/commerce/src/tests/shipping.test.ts | 8 ++++---- .../functions/commerce/shippings/delivery-routes.ts | 0 .../commerce/shippings/digital-deliveries.ts | 0 .../defaults/functions/commerce/shippings/drivers.ts | 0 .../defaults/functions/commerce/shippings/methods.ts | 0 .../defaults/functions/commerce/shippings/rates.ts | 0 .../defaults/functions/commerce/shippings/zones.ts | 0 42 files changed, 26 insertions(+), 26 deletions(-) rename storage/framework/core/commerce/src/shippings/{routes => delivery-routes}/destroy.ts (100%) rename storage/framework/core/commerce/src/shippings/{routes => delivery-routes}/fetch.ts (100%) rename storage/framework/core/commerce/src/shippings/{routes => delivery-routes}/index.ts (100%) rename storage/framework/core/commerce/src/shippings/{routes => delivery-routes}/store.ts (100%) rename storage/framework/core/commerce/src/shippings/{routes => delivery-routes}/update.ts (100%) rename storage/framework/core/commerce/src/shippings/{digital => digital-deliveries}/destroy.ts (100%) rename storage/framework/core/commerce/src/shippings/{digital => digital-deliveries}/fetch.ts (100%) rename storage/framework/core/commerce/src/shippings/{digital => digital-deliveries}/index.ts (100%) rename storage/framework/core/commerce/src/shippings/{digital => digital-deliveries}/store.ts (100%) rename storage/framework/core/commerce/src/shippings/{digital => digital-deliveries}/update.ts (100%) rename storage/framework/core/commerce/src/shippings/{licenses => license-keys}/destroy.ts (100%) rename storage/framework/core/commerce/src/shippings/{licenses => license-keys}/fetch.ts (100%) rename storage/framework/core/commerce/src/shippings/{licenses => license-keys}/index.ts (100%) rename storage/framework/core/commerce/src/shippings/{licenses => license-keys}/store.ts (100%) rename storage/framework/core/commerce/src/shippings/{licenses => license-keys}/update.ts (100%) rename storage/framework/core/commerce/src/shippings/{methods => shipping-methods}/destroy.ts (100%) rename storage/framework/core/commerce/src/shippings/{methods => shipping-methods}/fetch.ts (100%) rename storage/framework/core/commerce/src/shippings/{methods => shipping-methods}/index.ts (100%) rename storage/framework/core/commerce/src/shippings/{methods => shipping-methods}/store.ts (100%) rename storage/framework/core/commerce/src/shippings/{methods => shipping-methods}/update.ts (100%) rename storage/framework/core/commerce/src/shippings/{rates => shipping-rates}/destroy.ts (100%) rename storage/framework/core/commerce/src/shippings/{rates => shipping-rates}/fetch.ts (100%) rename storage/framework/core/commerce/src/shippings/{rates => shipping-rates}/index.ts (100%) rename storage/framework/core/commerce/src/shippings/{rates => shipping-rates}/store.ts (100%) rename storage/framework/core/commerce/src/shippings/{rates => shipping-rates}/update.ts (100%) rename storage/framework/core/commerce/src/shippings/{zones => shipping-zones}/destroy.ts (100%) rename storage/framework/core/commerce/src/shippings/{zones => shipping-zones}/fetch.ts (100%) rename storage/framework/core/commerce/src/shippings/{zones => shipping-zones}/index.ts (100%) rename storage/framework/core/commerce/src/shippings/{zones => shipping-zones}/store.ts (100%) rename storage/framework/core/commerce/src/shippings/{zones => shipping-zones}/update.ts (100%) create mode 100644 storage/framework/defaults/functions/commerce/shippings/delivery-routes.ts create mode 100644 storage/framework/defaults/functions/commerce/shippings/digital-deliveries.ts create mode 100644 storage/framework/defaults/functions/commerce/shippings/drivers.ts create mode 100644 storage/framework/defaults/functions/commerce/shippings/methods.ts create mode 100644 storage/framework/defaults/functions/commerce/shippings/rates.ts create mode 100644 storage/framework/defaults/functions/commerce/shippings/zones.ts diff --git a/storage/framework/core/commerce/src/shippings/routes/destroy.ts b/storage/framework/core/commerce/src/shippings/delivery-routes/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/routes/destroy.ts rename to storage/framework/core/commerce/src/shippings/delivery-routes/destroy.ts diff --git a/storage/framework/core/commerce/src/shippings/routes/fetch.ts b/storage/framework/core/commerce/src/shippings/delivery-routes/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/routes/fetch.ts rename to storage/framework/core/commerce/src/shippings/delivery-routes/fetch.ts diff --git a/storage/framework/core/commerce/src/shippings/routes/index.ts b/storage/framework/core/commerce/src/shippings/delivery-routes/index.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/routes/index.ts rename to storage/framework/core/commerce/src/shippings/delivery-routes/index.ts diff --git a/storage/framework/core/commerce/src/shippings/routes/store.ts b/storage/framework/core/commerce/src/shippings/delivery-routes/store.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/routes/store.ts rename to storage/framework/core/commerce/src/shippings/delivery-routes/store.ts diff --git a/storage/framework/core/commerce/src/shippings/routes/update.ts b/storage/framework/core/commerce/src/shippings/delivery-routes/update.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/routes/update.ts rename to storage/framework/core/commerce/src/shippings/delivery-routes/update.ts diff --git a/storage/framework/core/commerce/src/shippings/digital/destroy.ts b/storage/framework/core/commerce/src/shippings/digital-deliveries/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/digital/destroy.ts rename to storage/framework/core/commerce/src/shippings/digital-deliveries/destroy.ts diff --git a/storage/framework/core/commerce/src/shippings/digital/fetch.ts b/storage/framework/core/commerce/src/shippings/digital-deliveries/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/digital/fetch.ts rename to storage/framework/core/commerce/src/shippings/digital-deliveries/fetch.ts diff --git a/storage/framework/core/commerce/src/shippings/digital/index.ts b/storage/framework/core/commerce/src/shippings/digital-deliveries/index.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/digital/index.ts rename to storage/framework/core/commerce/src/shippings/digital-deliveries/index.ts diff --git a/storage/framework/core/commerce/src/shippings/digital/store.ts b/storage/framework/core/commerce/src/shippings/digital-deliveries/store.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/digital/store.ts rename to storage/framework/core/commerce/src/shippings/digital-deliveries/store.ts diff --git a/storage/framework/core/commerce/src/shippings/digital/update.ts b/storage/framework/core/commerce/src/shippings/digital-deliveries/update.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/digital/update.ts rename to storage/framework/core/commerce/src/shippings/digital-deliveries/update.ts diff --git a/storage/framework/core/commerce/src/shippings/index.ts b/storage/framework/core/commerce/src/shippings/index.ts index ef7531c352..630e2a342a 100644 --- a/storage/framework/core/commerce/src/shippings/index.ts +++ b/storage/framework/core/commerce/src/shippings/index.ts @@ -1,10 +1,10 @@ -import * as digital from './digital' +import * as digital from './digital-deliveries' import * as drivers from './drivers' -import * as licenses from './licenses' -import * as methods from './methods' -import * as rates from './rates' -import * as routes from './routes' -import * as zones from './zones' +import * as licenses from './license-keys' +import * as methods from './shipping-methods' +import * as rates from './shipping-rates' +import * as routes from './delivery-routes' +import * as zones from './shipping-zones' export { digital, diff --git a/storage/framework/core/commerce/src/shippings/licenses/destroy.ts b/storage/framework/core/commerce/src/shippings/license-keys/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/licenses/destroy.ts rename to storage/framework/core/commerce/src/shippings/license-keys/destroy.ts diff --git a/storage/framework/core/commerce/src/shippings/licenses/fetch.ts b/storage/framework/core/commerce/src/shippings/license-keys/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/licenses/fetch.ts rename to storage/framework/core/commerce/src/shippings/license-keys/fetch.ts diff --git a/storage/framework/core/commerce/src/shippings/licenses/index.ts b/storage/framework/core/commerce/src/shippings/license-keys/index.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/licenses/index.ts rename to storage/framework/core/commerce/src/shippings/license-keys/index.ts diff --git a/storage/framework/core/commerce/src/shippings/licenses/store.ts b/storage/framework/core/commerce/src/shippings/license-keys/store.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/licenses/store.ts rename to storage/framework/core/commerce/src/shippings/license-keys/store.ts diff --git a/storage/framework/core/commerce/src/shippings/licenses/update.ts b/storage/framework/core/commerce/src/shippings/license-keys/update.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/licenses/update.ts rename to storage/framework/core/commerce/src/shippings/license-keys/update.ts diff --git a/storage/framework/core/commerce/src/shippings/methods/destroy.ts b/storage/framework/core/commerce/src/shippings/shipping-methods/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/methods/destroy.ts rename to storage/framework/core/commerce/src/shippings/shipping-methods/destroy.ts diff --git a/storage/framework/core/commerce/src/shippings/methods/fetch.ts b/storage/framework/core/commerce/src/shippings/shipping-methods/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/methods/fetch.ts rename to storage/framework/core/commerce/src/shippings/shipping-methods/fetch.ts diff --git a/storage/framework/core/commerce/src/shippings/methods/index.ts b/storage/framework/core/commerce/src/shippings/shipping-methods/index.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/methods/index.ts rename to storage/framework/core/commerce/src/shippings/shipping-methods/index.ts diff --git a/storage/framework/core/commerce/src/shippings/methods/store.ts b/storage/framework/core/commerce/src/shippings/shipping-methods/store.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/methods/store.ts rename to storage/framework/core/commerce/src/shippings/shipping-methods/store.ts diff --git a/storage/framework/core/commerce/src/shippings/methods/update.ts b/storage/framework/core/commerce/src/shippings/shipping-methods/update.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/methods/update.ts rename to storage/framework/core/commerce/src/shippings/shipping-methods/update.ts diff --git a/storage/framework/core/commerce/src/shippings/rates/destroy.ts b/storage/framework/core/commerce/src/shippings/shipping-rates/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/rates/destroy.ts rename to storage/framework/core/commerce/src/shippings/shipping-rates/destroy.ts diff --git a/storage/framework/core/commerce/src/shippings/rates/fetch.ts b/storage/framework/core/commerce/src/shippings/shipping-rates/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/rates/fetch.ts rename to storage/framework/core/commerce/src/shippings/shipping-rates/fetch.ts diff --git a/storage/framework/core/commerce/src/shippings/rates/index.ts b/storage/framework/core/commerce/src/shippings/shipping-rates/index.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/rates/index.ts rename to storage/framework/core/commerce/src/shippings/shipping-rates/index.ts diff --git a/storage/framework/core/commerce/src/shippings/rates/store.ts b/storage/framework/core/commerce/src/shippings/shipping-rates/store.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/rates/store.ts rename to storage/framework/core/commerce/src/shippings/shipping-rates/store.ts diff --git a/storage/framework/core/commerce/src/shippings/rates/update.ts b/storage/framework/core/commerce/src/shippings/shipping-rates/update.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/rates/update.ts rename to storage/framework/core/commerce/src/shippings/shipping-rates/update.ts diff --git a/storage/framework/core/commerce/src/shippings/zones/destroy.ts b/storage/framework/core/commerce/src/shippings/shipping-zones/destroy.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/zones/destroy.ts rename to storage/framework/core/commerce/src/shippings/shipping-zones/destroy.ts diff --git a/storage/framework/core/commerce/src/shippings/zones/fetch.ts b/storage/framework/core/commerce/src/shippings/shipping-zones/fetch.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/zones/fetch.ts rename to storage/framework/core/commerce/src/shippings/shipping-zones/fetch.ts diff --git a/storage/framework/core/commerce/src/shippings/zones/index.ts b/storage/framework/core/commerce/src/shippings/shipping-zones/index.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/zones/index.ts rename to storage/framework/core/commerce/src/shippings/shipping-zones/index.ts diff --git a/storage/framework/core/commerce/src/shippings/zones/store.ts b/storage/framework/core/commerce/src/shippings/shipping-zones/store.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/zones/store.ts rename to storage/framework/core/commerce/src/shippings/shipping-zones/store.ts diff --git a/storage/framework/core/commerce/src/shippings/zones/update.ts b/storage/framework/core/commerce/src/shippings/shipping-zones/update.ts similarity index 100% rename from storage/framework/core/commerce/src/shippings/zones/update.ts rename to storage/framework/core/commerce/src/shippings/shipping-zones/update.ts diff --git a/storage/framework/core/commerce/src/tests/digitals.test.ts b/storage/framework/core/commerce/src/tests/digitals.test.ts index 4fc06344c7..a28cd59c10 100644 --- a/storage/framework/core/commerce/src/tests/digitals.test.ts +++ b/storage/framework/core/commerce/src/tests/digitals.test.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, bulkSoftDelete, destroy, softDelete } from '../shippings/digital/destroy' -import { fetchAll, fetchById } from '../shippings/digital/fetch' -import { bulkStore, store } from '../shippings/digital/store' -import { update, updateDeliverySettings, updateStatus } from '../shippings/digital/update' +import { bulkDestroy, bulkSoftDelete, destroy, softDelete } from '../shippings/digital-deliveries/destroy' +import { fetchAll, fetchById } from '../shippings/digital-deliveries/fetch' +import { bulkStore, store } from '../shippings/digital-deliveries/store' +import { update, updateDeliverySettings, updateStatus } from '../shippings/digital-deliveries/update' // Create a request-like object for testing class TestRequest { diff --git a/storage/framework/core/commerce/src/tests/license.test.ts b/storage/framework/core/commerce/src/tests/license.test.ts index 425de8b9d2..5fb6706260 100644 --- a/storage/framework/core/commerce/src/tests/license.test.ts +++ b/storage/framework/core/commerce/src/tests/license.test.ts @@ -1,10 +1,10 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { formatDate } from '@stacksjs/orm' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, bulkSoftDelete, destroy, softDelete } from '../shippings/licenses/destroy' -import { fetchAll, fetchById } from '../shippings/licenses/fetch' -import { bulkStore, store } from '../shippings/licenses/store' -import { update, updateExpiration, updateStatus } from '../shippings/licenses/update' +import { bulkDestroy, bulkSoftDelete, destroy, softDelete } from '../shippings/license-keys/destroy' +import { fetchAll, fetchById } from '../shippings/license-keys/fetch' +import { bulkStore, store } from '../shippings/license-keys/store' +import { update, updateExpiration, updateStatus } from '../shippings/license-keys/update' // Create a request-like object for testing class TestRequest { diff --git a/storage/framework/core/commerce/src/tests/rates.test.ts b/storage/framework/core/commerce/src/tests/rates.test.ts index 481c8a77fc..8fb81bc7f6 100644 --- a/storage/framework/core/commerce/src/tests/rates.test.ts +++ b/storage/framework/core/commerce/src/tests/rates.test.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, destroy, destroyByMethod, destroyByZone } from '../shippings/rates/destroy' -import { fetchById, formatShippingRateOptions, getRateByWeightAndZone, getRatesByZone, getShippingRatesByMethod } from '../shippings/rates/fetch' -import { bulkStore, store } from '../shippings/rates/store' -import { update, updateByMethod, updateByZone } from '../shippings/rates/update' +import { bulkDestroy, destroy, destroyByMethod, destroyByZone } from '../shippings/shipping-rates/destroy' +import { fetchById, formatShippingRateOptions, getRateByWeightAndZone, getRatesByZone, getShippingRatesByMethod } from '../shippings/shipping-rates/fetch' +import { bulkStore, store } from '../shippings/shipping-rates/store' +import { update, updateByMethod, updateByZone } from '../shippings/shipping-rates/update' // Create a request-like object for testing class TestRequest { diff --git a/storage/framework/core/commerce/src/tests/routes.test.ts b/storage/framework/core/commerce/src/tests/routes.test.ts index 0ba8c25078..2f84499fcf 100644 --- a/storage/framework/core/commerce/src/tests/routes.test.ts +++ b/storage/framework/core/commerce/src/tests/routes.test.ts @@ -1,10 +1,10 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { formatDate } from '@stacksjs/orm' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, destroy } from '../shippings/routes/destroy' -import { fetchByDriver, fetchById } from '../shippings/routes/fetch' -import { store } from '../shippings/routes/store' -import { update, updateMetrics, updateStops } from '../shippings/routes/update' +import { bulkDestroy, destroy } from '../shippings/delivery-routes/destroy' +import { fetchByDriver, fetchById } from '../shippings/delivery-routes/fetch' +import { store } from '../shippings/delivery-routes/store' +import { update, updateMetrics, updateStops } from '../shippings/delivery-routes/update' // Create a request-like object for testing class TestRequest { diff --git a/storage/framework/core/commerce/src/tests/shipping.test.ts b/storage/framework/core/commerce/src/tests/shipping.test.ts index 070e74a6df..8bca7b1876 100644 --- a/storage/framework/core/commerce/src/tests/shipping.test.ts +++ b/storage/framework/core/commerce/src/tests/shipping.test.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it } from 'bun:test' import { refreshDatabase } from '@stacksjs/testing' -import { bulkDestroy, bulkSoftDelete, destroy, softDelete } from '../shippings/methods/destroy' -import { fetchById } from '../shippings/methods/fetch' -import { bulkStore, formatShippingOptions, getActiveShippingMethods, store } from '../shippings/methods/store' -import { update, updatePricing, updateStatus } from '../shippings/methods/update' +import { bulkDestroy, bulkSoftDelete, destroy, softDelete } from '../shippings/shipping-methods/destroy' +import { fetchById } from '../shippings/shipping-methods/fetch' +import { bulkStore, formatShippingOptions, getActiveShippingMethods, store } from '../shippings/shipping-methods/store' +import { update, updatePricing, updateStatus } from '../shippings/shipping-methods/update' // Create a request-like object for testing class TestRequest { diff --git a/storage/framework/defaults/functions/commerce/shippings/delivery-routes.ts b/storage/framework/defaults/functions/commerce/shippings/delivery-routes.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/storage/framework/defaults/functions/commerce/shippings/digital-deliveries.ts b/storage/framework/defaults/functions/commerce/shippings/digital-deliveries.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/storage/framework/defaults/functions/commerce/shippings/drivers.ts b/storage/framework/defaults/functions/commerce/shippings/drivers.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/storage/framework/defaults/functions/commerce/shippings/methods.ts b/storage/framework/defaults/functions/commerce/shippings/methods.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/storage/framework/defaults/functions/commerce/shippings/rates.ts b/storage/framework/defaults/functions/commerce/shippings/rates.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/storage/framework/defaults/functions/commerce/shippings/zones.ts b/storage/framework/defaults/functions/commerce/shippings/zones.ts new file mode 100644 index 0000000000..e69de29bb2 From 785c4b034326d4b608303a8b33e966dadf0b9f4d Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Thu, 3 Apr 2025 23:14:18 +0800 Subject: [PATCH 72/78] chore: wip --- .../core/commerce/src/shippings/index.ts | 2 +- .../defaults/functions/commerce/gift-cards.ts | 2 +- .../defaults/functions/commerce/payments.ts | 2 +- .../functions/commerce/products/categories.ts | 2 +- .../functions/commerce/products/items.ts | 2 +- .../functions/commerce/products/reviews.ts | 3 +- .../functions/commerce/products/units.ts | 2 +- .../functions/commerce/products/variants.ts | 3 +- .../commerce/shippings/delivery-routes.ts | 101 ++++++++++++++++++ .../commerce/shippings/digital-deliveries.ts | 101 ++++++++++++++++++ .../functions/commerce/shippings/drivers.ts | 101 ++++++++++++++++++ .../functions/commerce/shippings/methods.ts | 0 .../functions/commerce/shippings/rates.ts | 0 .../commerce/shippings/shipping-methods.ts | 101 ++++++++++++++++++ .../commerce/shippings/shipping-rates.ts | 101 ++++++++++++++++++ .../commerce/shippings/shipping-zones.ts | 101 ++++++++++++++++++ .../functions/commerce/shippings/zones.ts | 0 storage/framework/defaults/types/index.ts | 80 +++++++++++++- 18 files changed, 692 insertions(+), 12 deletions(-) delete mode 100644 storage/framework/defaults/functions/commerce/shippings/methods.ts delete mode 100644 storage/framework/defaults/functions/commerce/shippings/rates.ts create mode 100644 storage/framework/defaults/functions/commerce/shippings/shipping-methods.ts create mode 100644 storage/framework/defaults/functions/commerce/shippings/shipping-rates.ts create mode 100644 storage/framework/defaults/functions/commerce/shippings/shipping-zones.ts delete mode 100644 storage/framework/defaults/functions/commerce/shippings/zones.ts diff --git a/storage/framework/core/commerce/src/shippings/index.ts b/storage/framework/core/commerce/src/shippings/index.ts index 630e2a342a..5fcb7cee6f 100644 --- a/storage/framework/core/commerce/src/shippings/index.ts +++ b/storage/framework/core/commerce/src/shippings/index.ts @@ -1,9 +1,9 @@ +import * as routes from './delivery-routes' import * as digital from './digital-deliveries' import * as drivers from './drivers' import * as licenses from './license-keys' import * as methods from './shipping-methods' import * as rates from './shipping-rates' -import * as routes from './delivery-routes' import * as zones from './shipping-zones' export { diff --git a/storage/framework/defaults/functions/commerce/gift-cards.ts b/storage/framework/defaults/functions/commerce/gift-cards.ts index b57fe0a3be..cc84fbc473 100644 --- a/storage/framework/defaults/functions/commerce/gift-cards.ts +++ b/storage/framework/defaults/functions/commerce/gift-cards.ts @@ -1,5 +1,5 @@ +import type { GiftCard } from '../../../types' import { useFetch, useStorage } from '@vueuse/core' -import { GiftCard } from '../../../types' // Create a persistent gift cards array using VueUse's useStorage const giftCards = useStorage('giftCards', []) diff --git a/storage/framework/defaults/functions/commerce/payments.ts b/storage/framework/defaults/functions/commerce/payments.ts index b3a5e4d27b..e446100f89 100644 --- a/storage/framework/defaults/functions/commerce/payments.ts +++ b/storage/framework/defaults/functions/commerce/payments.ts @@ -1,5 +1,5 @@ +import type { Payment } from '../../../types' import { useFetch, useStorage } from '@vueuse/core' -import { Payment } from '../../../types' // Create a persistent payments array using VueUse's useStorage const payments = useStorage('payments', []) diff --git a/storage/framework/defaults/functions/commerce/products/categories.ts b/storage/framework/defaults/functions/commerce/products/categories.ts index 5433bc2b84..3fca7e961d 100644 --- a/storage/framework/defaults/functions/commerce/products/categories.ts +++ b/storage/framework/defaults/functions/commerce/products/categories.ts @@ -1,5 +1,5 @@ +import type { Categories } from '../../../types' import { useFetch, useStorage } from '@vueuse/core' -import { Categories } from '../../../types' // Create a persistent categories array using VueUse's useStorage const categories = useStorage('categories', []) diff --git a/storage/framework/defaults/functions/commerce/products/items.ts b/storage/framework/defaults/functions/commerce/products/items.ts index 7cf4a9be95..3cc7469325 100644 --- a/storage/framework/defaults/functions/commerce/products/items.ts +++ b/storage/framework/defaults/functions/commerce/products/items.ts @@ -1,5 +1,5 @@ +import type { Items } from '../../../types' import { useFetch, useStorage } from '@vueuse/core' -import { Items } from '../../../types' // Create a persistent items array using VueUse's useStorage const items = useStorage('items', []) diff --git a/storage/framework/defaults/functions/commerce/products/reviews.ts b/storage/framework/defaults/functions/commerce/products/reviews.ts index 0459fe90f0..445e3245f2 100644 --- a/storage/framework/defaults/functions/commerce/products/reviews.ts +++ b/storage/framework/defaults/functions/commerce/products/reviews.ts @@ -1,6 +1,5 @@ +import type { Reviews } from '../../../types' import { useFetch, useStorage } from '@vueuse/core' -import { Reviews } from '../../../types' - // Create a persistent reviews array using VueUse's useStorage const reviews = useStorage('reviews', []) diff --git a/storage/framework/defaults/functions/commerce/products/units.ts b/storage/framework/defaults/functions/commerce/products/units.ts index 7c406404ca..f7f142e201 100644 --- a/storage/framework/defaults/functions/commerce/products/units.ts +++ b/storage/framework/defaults/functions/commerce/products/units.ts @@ -96,7 +96,7 @@ async function deleteUnit(id: number): Promise { if (index !== -1) { units.value.splice(index, 1) } - + return true } diff --git a/storage/framework/defaults/functions/commerce/products/variants.ts b/storage/framework/defaults/functions/commerce/products/variants.ts index e4b8eb21aa..5b05ec2bb4 100644 --- a/storage/framework/defaults/functions/commerce/products/variants.ts +++ b/storage/framework/defaults/functions/commerce/products/variants.ts @@ -1,6 +1,5 @@ +import type { Variants } from '../../../types' import { useFetch, useStorage } from '@vueuse/core' -import { Variants } from '../../../types' - // Create a persistent variants array using VueUse's useStorage const variants = useStorage('variants', []) diff --git a/storage/framework/defaults/functions/commerce/shippings/delivery-routes.ts b/storage/framework/defaults/functions/commerce/shippings/delivery-routes.ts index e69de29bb2..892f3da3d8 100644 --- a/storage/framework/defaults/functions/commerce/shippings/delivery-routes.ts +++ b/storage/framework/defaults/functions/commerce/shippings/delivery-routes.ts @@ -0,0 +1,101 @@ +import type { DeliveryRoutes } from '../../../types' +import { useFetch, useStorage } from '@vueuse/core' + +// Create a persistent delivery routes array using VueUse's useStorage +const deliveryRoutes = useStorage('deliveryRoutes', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all delivery routes +async function fetchDeliveryRoutes() { + const { error, data } = useFetch(`${baseURL}/commerce/delivery-routes`) + + if (error.value) { + console.error('Error fetching delivery routes:', error.value) + return [] + } + + // Ensure data is an array before assigning + if (Array.isArray(data.value)) { + deliveryRoutes.value = data.value + return data.value + } + else { + console.error('Expected array of delivery routes but received:', typeof data.value) + return [] + } +} + +async function createDeliveryRoute(deliveryRoute: DeliveryRoutes) { + const { error, data } = useFetch(`${baseURL}/commerce/delivery-routes`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(deliveryRoute), + }) + + if (error.value) { + console.error('Error creating delivery route:', error.value) + return null + } + + if (data.value) { + deliveryRoutes.value.push(data.value) + return data.value + } + return null +} + +async function updateDeliveryRoute(deliveryRoute: DeliveryRoutes) { + const { error, data } = useFetch(`${baseURL}/commerce/delivery-routes/${deliveryRoute.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(deliveryRoute), + }) + + if (error.value) { + console.error('Error updating delivery route:', error.value) + return null + } + + if (data.value) { + const index = deliveryRoutes.value.findIndex(s => s.id === deliveryRoute.id) + if (index !== -1) { + deliveryRoutes.value[index] = data.value + } + return data.value + } + return null +} + +async function deleteDeliveryRoute(id: number) { + const { error } = useFetch(`${baseURL}/commerce/delivery-routes/${id}`, { + method: 'DELETE', + }) + + if (error.value) { + console.error('Error deleting delivery route:', error.value) + return false + } + + const index = deliveryRoutes.value.findIndex(s => s.id === id) + if (index !== -1) { + deliveryRoutes.value.splice(index, 1) + } + + return true +} + +// Export the composable +export function useDeliveryRoutes() { + return { + deliveryRoutes, + fetchDeliveryRoutes, + createDeliveryRoute, + updateDeliveryRoute, + deleteDeliveryRoute, + } +} diff --git a/storage/framework/defaults/functions/commerce/shippings/digital-deliveries.ts b/storage/framework/defaults/functions/commerce/shippings/digital-deliveries.ts index e69de29bb2..f4cc27f501 100644 --- a/storage/framework/defaults/functions/commerce/shippings/digital-deliveries.ts +++ b/storage/framework/defaults/functions/commerce/shippings/digital-deliveries.ts @@ -0,0 +1,101 @@ +import type { DigitalDeliveries } from '../../../types' +import { useFetch, useStorage } from '@vueuse/core' + +// Create a persistent digital deliveries array using VueUse's useStorage +const digitalDeliveries = useStorage('digitalDeliveries', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all digital deliveries +async function fetchDigitalDeliveries() { + const { error, data } = useFetch(`${baseURL}/commerce/digital-deliveries`) + + if (error.value) { + console.error('Error fetching digital deliveries:', error.value) + return [] + } + + // Ensure data is an array before assigning + if (Array.isArray(data.value)) { + digitalDeliveries.value = data.value + return data.value + } + else { + console.error('Expected array of digital deliveries but received:', typeof data.value) + return [] + } +} + +async function createDigitalDelivery(digitalDelivery: DigitalDeliveries) { + const { error, data } = useFetch(`${baseURL}/commerce/digital-deliveries`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(digitalDelivery), + }) + + if (error.value) { + console.error('Error creating digital delivery:', error.value) + return null + } + + if (data.value) { + digitalDeliveries.value.push(data.value) + return data.value + } + return null +} + +async function updateDigitalDelivery(digitalDelivery: DigitalDeliveries) { + const { error, data } = useFetch(`${baseURL}/commerce/digital-deliveries/${digitalDelivery.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(digitalDelivery), + }) + + if (error.value) { + console.error('Error updating digital delivery:', error.value) + return null + } + + if (data.value) { + const index = digitalDeliveries.value.findIndex(s => s.id === digitalDelivery.id) + if (index !== -1) { + digitalDeliveries.value[index] = data.value + } + return data.value + } + return null +} + +async function deleteDigitalDelivery(id: number) { + const { error } = useFetch(`${baseURL}/commerce/digital-deliveries/${id}`, { + method: 'DELETE', + }) + + if (error.value) { + console.error('Error deleting digital delivery:', error.value) + return false + } + + const index = digitalDeliveries.value.findIndex(s => s.id === id) + if (index !== -1) { + digitalDeliveries.value.splice(index, 1) + } + + return true +} + +// Export the composable +export function useDigitalDeliveries() { + return { + digitalDeliveries, + fetchDigitalDeliveries, + createDigitalDelivery, + updateDigitalDelivery, + deleteDigitalDelivery, + } +} diff --git a/storage/framework/defaults/functions/commerce/shippings/drivers.ts b/storage/framework/defaults/functions/commerce/shippings/drivers.ts index e69de29bb2..ae4f99b520 100644 --- a/storage/framework/defaults/functions/commerce/shippings/drivers.ts +++ b/storage/framework/defaults/functions/commerce/shippings/drivers.ts @@ -0,0 +1,101 @@ +import type { Drivers } from '../../../types' +import { useFetch, useStorage } from '@vueuse/core' + +// Create a persistent drivers array using VueUse's useStorage +const drivers = useStorage('drivers', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all drivers +async function fetchDrivers() { + const { error, data } = useFetch(`${baseURL}/commerce/drivers`) + + if (error.value) { + console.error('Error fetching drivers:', error.value) + return [] + } + + // Ensure data is an array before assigning + if (Array.isArray(data.value)) { + drivers.value = data.value + return data.value + } + else { + console.error('Expected array of drivers but received:', typeof data.value) + return [] + } +} + +async function createDriver(driver: Drivers) { + const { error, data } = useFetch(`${baseURL}/commerce/drivers`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(driver), + }) + + if (error.value) { + console.error('Error creating driver:', error.value) + return null + } + + if (data.value) { + drivers.value.push(data.value) + return data.value + } + return null +} + +async function updateDriver(driver: Drivers) { + const { error, data } = useFetch(`${baseURL}/commerce/drivers/${driver.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(driver), + }) + + if (error.value) { + console.error('Error updating driver:', error.value) + return null + } + + if (data.value) { + const index = drivers.value.findIndex(s => s.id === driver.id) + if (index !== -1) { + drivers.value[index] = data.value + } + return data.value + } + return null +} + +async function deleteDriver(id: number) { + const { error } = useFetch(`${baseURL}/commerce/drivers/${id}`, { + method: 'DELETE', + }) + + if (error.value) { + console.error('Error deleting driver:', error.value) + return false + } + + const index = drivers.value.findIndex(s => s.id === id) + if (index !== -1) { + drivers.value.splice(index, 1) + } + + return true +} + +// Export the composable +export function useDrivers() { + return { + drivers, + fetchDrivers, + createDriver, + updateDriver, + deleteDriver, + } +} diff --git a/storage/framework/defaults/functions/commerce/shippings/methods.ts b/storage/framework/defaults/functions/commerce/shippings/methods.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/storage/framework/defaults/functions/commerce/shippings/rates.ts b/storage/framework/defaults/functions/commerce/shippings/rates.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/storage/framework/defaults/functions/commerce/shippings/shipping-methods.ts b/storage/framework/defaults/functions/commerce/shippings/shipping-methods.ts new file mode 100644 index 0000000000..3f2a26b2e7 --- /dev/null +++ b/storage/framework/defaults/functions/commerce/shippings/shipping-methods.ts @@ -0,0 +1,101 @@ +import type { ShippingMethods } from '../../../types' +import { useFetch, useStorage } from '@vueuse/core' + +// Create a persistent shipping methods array using VueUse's useStorage +const shippingMethods = useStorage('shippingMethods', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all shipping methods +async function fetchShippingMethods() { + const { error, data } = useFetch(`${baseURL}/commerce/shipping-methods`) + + if (error.value) { + console.error('Error fetching shipping methods:', error.value) + return [] + } + + // Ensure data is an array before assigning + if (Array.isArray(data.value)) { + shippingMethods.value = data.value + return data.value + } + else { + console.error('Expected array of shipping methods but received:', typeof data.value) + return [] + } +} + +async function createShippingMethod(shippingMethod: ShippingMethods) { + const { error, data } = useFetch(`${baseURL}/commerce/shipping-methods`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(shippingMethod), + }) + + if (error.value) { + console.error('Error creating shipping method:', error.value) + return null + } + + if (data.value) { + shippingMethods.value.push(data.value) + return data.value + } + return null +} + +async function updateShippingMethod(shippingMethod: ShippingMethods) { + const { error, data } = useFetch(`${baseURL}/commerce/shipping-methods/${shippingMethod.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(shippingMethod), + }) + + if (error.value) { + console.error('Error updating shipping method:', error.value) + return null + } + + if (data.value) { + const index = shippingMethods.value.findIndex(s => s.id === shippingMethod.id) + if (index !== -1) { + shippingMethods.value[index] = data.value + } + return data.value + } + return null +} + +async function deleteShippingMethod(id: number) { + const { error } = useFetch(`${baseURL}/commerce/shipping-methods/${id}`, { + method: 'DELETE', + }) + + if (error.value) { + console.error('Error deleting shipping method:', error.value) + return false + } + + const index = shippingMethods.value.findIndex(s => s.id === id) + if (index !== -1) { + shippingMethods.value.splice(index, 1) + } + + return true +} + +// Export the composable +export function useShippingMethods() { + return { + shippingMethods, + fetchShippingMethods, + createShippingMethod, + updateShippingMethod, + deleteShippingMethod, + } +} diff --git a/storage/framework/defaults/functions/commerce/shippings/shipping-rates.ts b/storage/framework/defaults/functions/commerce/shippings/shipping-rates.ts new file mode 100644 index 0000000000..abe4a03699 --- /dev/null +++ b/storage/framework/defaults/functions/commerce/shippings/shipping-rates.ts @@ -0,0 +1,101 @@ +import type { ShippingRates } from '../../../types' +import { useFetch, useStorage } from '@vueuse/core' + +// Create a persistent shipping rates array using VueUse's useStorage +const shippingRates = useStorage('shippingRates', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all shipping rates +async function fetchShippingRates() { + const { error, data } = useFetch(`${baseURL}/commerce/shipping-rates`) + + if (error.value) { + console.error('Error fetching shipping rates:', error.value) + return [] + } + + // Ensure data is an array before assigning + if (Array.isArray(data.value)) { + shippingRates.value = data.value + return data.value + } + else { + console.error('Expected array of shipping rates but received:', typeof data.value) + return [] + } +} + +async function createShippingRate(shippingRate: ShippingRates) { + const { error, data } = useFetch(`${baseURL}/commerce/shipping-rates`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(shippingRate), + }) + + if (error.value) { + console.error('Error creating shipping rate:', error.value) + return null + } + + if (data.value) { + shippingRates.value.push(data.value) + return data.value + } + return null +} + +async function updateShippingRate(shippingRate: ShippingRates) { + const { error, data } = useFetch(`${baseURL}/commerce/shipping-rates/${shippingRate.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(shippingRate), + }) + + if (error.value) { + console.error('Error updating shipping rate:', error.value) + return null + } + + if (data.value) { + const index = shippingRates.value.findIndex(s => s.id === shippingRate.id) + if (index !== -1) { + shippingRates.value[index] = data.value + } + return data.value + } + return null +} + +async function deleteShippingRate(id: number) { + const { error } = useFetch(`${baseURL}/commerce/shipping-rates/${id}`, { + method: 'DELETE', + }) + + if (error.value) { + console.error('Error deleting shipping rate:', error.value) + return false + } + + const index = shippingRates.value.findIndex(s => s.id === id) + if (index !== -1) { + shippingRates.value.splice(index, 1) + } + + return true +} + +// Export the composable +export function useShippingRates() { + return { + shippingRates, + fetchShippingRates, + createShippingRate, + updateShippingRate, + deleteShippingRate, + } +} diff --git a/storage/framework/defaults/functions/commerce/shippings/shipping-zones.ts b/storage/framework/defaults/functions/commerce/shippings/shipping-zones.ts new file mode 100644 index 0000000000..a6071d0eff --- /dev/null +++ b/storage/framework/defaults/functions/commerce/shippings/shipping-zones.ts @@ -0,0 +1,101 @@ +import type { ShippingZones } from '../../../types' +import { useFetch, useStorage } from '@vueuse/core' + +// Create a persistent shipping zones array using VueUse's useStorage +const shippingZones = useStorage('shippingZones', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all shipping zones +async function fetchShippingZones() { + const { error, data } = useFetch(`${baseURL}/commerce/shipping-zones`) + + if (error.value) { + console.error('Error fetching shipping zones:', error.value) + return [] + } + + // Ensure data is an array before assigning + if (Array.isArray(data.value)) { + shippingZones.value = data.value + return data.value + } + else { + console.error('Expected array of shipping zones but received:', typeof data.value) + return [] + } +} + +async function createShippingZone(shippingZone: ShippingZones) { + const { error, data } = useFetch(`${baseURL}/commerce/shipping-zones`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(shippingZone), + }) + + if (error.value) { + console.error('Error creating shipping zone:', error.value) + return null + } + + if (data.value) { + shippingZones.value.push(data.value) + return data.value + } + return null +} + +async function updateShippingZone(shippingZone: ShippingZones) { + const { error, data } = useFetch(`${baseURL}/commerce/shipping-zones/${shippingZone.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(shippingZone), + }) + + if (error.value) { + console.error('Error updating shipping zone:', error.value) + return null + } + + if (data.value) { + const index = shippingZones.value.findIndex(s => s.id === shippingZone.id) + if (index !== -1) { + shippingZones.value[index] = data.value + } + return data.value + } + return null +} + +async function deleteShippingZone(id: number) { + const { error } = useFetch(`${baseURL}/commerce/shipping-zones/${id}`, { + method: 'DELETE', + }) + + if (error.value) { + console.error('Error deleting shipping zone:', error.value) + return false + } + + const index = shippingZones.value.findIndex(s => s.id === id) + if (index !== -1) { + shippingZones.value.splice(index, 1) + } + + return true +} + +// Export the composable +export function useShippingZones() { + return { + shippingZones, + fetchShippingZones, + createShippingZone, + updateShippingZone, + deleteShippingZone, + } +} diff --git a/storage/framework/defaults/functions/commerce/shippings/zones.ts b/storage/framework/defaults/functions/commerce/shippings/zones.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/storage/framework/defaults/types/index.ts b/storage/framework/defaults/types/index.ts index 9f3488ea87..7218c28f06 100644 --- a/storage/framework/defaults/types/index.ts +++ b/storage/framework/defaults/types/index.ts @@ -87,7 +87,6 @@ export interface Items { updated_at?: string } - export interface Reviews { id: number product_id: number @@ -176,4 +175,81 @@ export interface TaxRates { uuid?: string created_at?: string updated_at?: string -} \ No newline at end of file +} + +export interface ShippingMethods { + id: number + name: string + description?: string + base_rate: number + free_shipping?: number + status: string | string[] + uuid?: string + created_at?: string + updated_at?: string +} + +export interface ShippingZones { + id: number + shipping_method_id: number + name: string + countries?: string + regions?: string + postal_codes?: string + status: string | string[] + uuid?: string + created_at?: string + updated_at?: string +} + +export interface ShippingRates { + id: number + method: string + zone: string + weight_from: number + weight_to: number + rate: number + uuid?: string + created_at?: string + updated_at?: string +} + +export interface DigitalDeliveries { + id: number + name: string + description: string + download_limit?: number + expiry_days: number + requires_login?: boolean + automatic_delivery?: boolean + status?: string | string[] + uuid?: string + created_at?: string + updated_at?: string +} + +export interface DeliveryRoutes { + id: number + driver: string + vehicle: string + stops: number + delivery_time: number + total_distance: number + last_active?: Date | string + uuid?: string + created_at?: string + updated_at?: string +} + +export interface Drivers { + id: number + user_id: number + name: string + phone: string + vehicle_number: string + license: string + status?: string | string[] + uuid?: string + created_at?: string + updated_at?: string +} From 29a6b83bec3b04fe6deea17333f99c3029e0971b Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Thu, 3 Apr 2025 23:16:57 +0800 Subject: [PATCH 73/78] chore: wip --- storage/framework/core/commerce/src/products/units/store.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/storage/framework/core/commerce/src/products/units/store.ts b/storage/framework/core/commerce/src/products/units/store.ts index 0d319c2029..1c9b809296 100644 --- a/storage/framework/core/commerce/src/products/units/store.ts +++ b/storage/framework/core/commerce/src/products/units/store.ts @@ -1,6 +1,5 @@ // Import dependencies -import type { ProductUnitRequestType } from '@stacksjs/orm' -import type { NewProductUnit, ProductUnitJsonResponse } from '@stacksjs/orm' +import type { NewProductUnit, ProductUnitJsonResponse, ProductUnitRequestType } from '@stacksjs/orm' import { randomUUIDv7 } from 'bun' import { db } from '@stacksjs/database' From 0802c096a8f04414377b6d9025b125af7fa40998 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Thu, 3 Apr 2025 23:52:21 +0800 Subject: [PATCH 74/78] chore: wip --- .../actions/src/UserIndexOrmAction.ts | 3 ++- .../actions/src/UserShowOrmAction.ts | 19 +++++++++---------- storage/framework/core/orm/src/utils.ts | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/storage/framework/actions/src/UserIndexOrmAction.ts b/storage/framework/actions/src/UserIndexOrmAction.ts index 2494cd6bf2..148acade21 100644 --- a/storage/framework/actions/src/UserIndexOrmAction.ts +++ b/storage/framework/actions/src/UserIndexOrmAction.ts @@ -1,4 +1,5 @@ import { Action } from '@stacksjs/actions' +import { User } from '@stacksjs/orm' import { response } from '@stacksjs/router' export default new Action({ @@ -6,7 +7,7 @@ export default new Action({ description: 'User Index ORM Action', method: 'GET', async handle() { - const results = User.all() + const results = await User.all() return response.json(results) }, diff --git a/storage/framework/actions/src/UserShowOrmAction.ts b/storage/framework/actions/src/UserShowOrmAction.ts index b8ab98acd6..0f23c7d74b 100644 --- a/storage/framework/actions/src/UserShowOrmAction.ts +++ b/storage/framework/actions/src/UserShowOrmAction.ts @@ -1,20 +1,19 @@ import { Action } from '@stacksjs/actions' -import { mail } from '@stacksjs/email' export default new Action({ name: 'User Show', description: 'User Show ORM Action', method: 'GET', async handle() { - mail.send({ - from: { - address: 'gtorregosa@gmail.com', - name: 'Glenn', - }, - to: 'chrisbreuer93@gmail.com', - subject: 'Test Email', - template: 'WelcomeTest', - }) + // mail.send({ + // from: { + // address: 'gtorregosa@gmail.com', + // name: 'Glenn', + // }, + // to: 'chrisbreuer93@gmail.com', + // subject: 'Test Email', + // template: 'WelcomeTest', + // }) // async handle(request: UserRequestType) { // const id = request.getParam('id') diff --git a/storage/framework/core/orm/src/utils.ts b/storage/framework/core/orm/src/utils.ts index 48ac26dec6..7be8fd3b40 100644 --- a/storage/framework/core/orm/src/utils.ts +++ b/storage/framework/core/orm/src/utils.ts @@ -814,7 +814,7 @@ export async function writeOrmActions(apiRoute: string, modelName: string, actio if (apiRoute === 'index') { handleString += `async handle() { - const results = ${modelName}.all() + const results = await ${modelName}.all() return response.json(results) },` From 9cc8a3538d40dcfd956b1d5af0c636fa51be2058 Mon Sep 17 00:00:00 2001 From: glennmichael123 Date: Fri, 4 Apr 2025 00:06:54 +0800 Subject: [PATCH 75/78] chore: wip --- .../functions/commerce/waitlist/products.ts | 101 ++++++++++++++++++ .../commerce/waitlist/restaurants.ts | 101 ++++++++++++++++++ storage/framework/defaults/types/index.ts | 41 +++++++ 3 files changed, 243 insertions(+) create mode 100644 storage/framework/defaults/functions/commerce/waitlist/products.ts create mode 100644 storage/framework/defaults/functions/commerce/waitlist/restaurants.ts diff --git a/storage/framework/defaults/functions/commerce/waitlist/products.ts b/storage/framework/defaults/functions/commerce/waitlist/products.ts new file mode 100644 index 0000000000..7f9ae0c4b8 --- /dev/null +++ b/storage/framework/defaults/functions/commerce/waitlist/products.ts @@ -0,0 +1,101 @@ +import type { WaitlistProduct } from '../../../types' +import { useFetch, useStorage } from '@vueuse/core' + +// Create a persistent waitlist products array using VueUse's useStorage +const waitlistProducts = useStorage('waitlist_products', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all waitlist products +async function fetchWaitlistProducts() { + const { error, data } = useFetch(`${baseURL}/commerce/waitlist/products`) + + if (error.value) { + console.error('Error fetching waitlist products:', error.value) + return [] + } + + // Ensure data is an array before assigning + if (Array.isArray(data.value)) { + waitlistProducts.value = data.value + return data.value + } + else { + console.error('Expected array of waitlist products but received:', typeof data.value) + return [] + } +} + +async function createWaitlistProduct(waitlistProduct: WaitlistProduct) { + const { error, data } = useFetch(`${baseURL}/commerce/waitlist/products`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(waitlistProduct), + }) + + if (error.value) { + console.error('Error creating waitlist product:', error.value) + return null + } + + if (data.value) { + waitlistProducts.value.push(data.value) + return data.value + } + return null +} + +async function updateWaitlistProduct(waitlistProduct: WaitlistProduct) { + const { error, data } = useFetch(`${baseURL}/commerce/waitlist/products/${waitlistProduct.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(waitlistProduct), + }) + + if (error.value) { + console.error('Error updating waitlist product:', error.value) + return null + } + + if (data.value) { + const index = waitlistProducts.value.findIndex(wp => wp.id === waitlistProduct.id) + if (index !== -1) { + waitlistProducts.value[index] = data.value + } + return data.value + } + return null +} + +async function deleteWaitlistProduct(id: number) { + const { error } = useFetch(`${baseURL}/commerce/waitlist/products/${id}`, { + method: 'DELETE', + }) + + if (error.value) { + console.error('Error deleting waitlist product:', error.value) + return false + } + + const index = waitlistProducts.value.findIndex(wp => wp.id === id) + if (index !== -1) { + waitlistProducts.value.splice(index, 1) + } + + return true +} + +// Export the composable +export function useWaitlistProducts() { + return { + waitlistProducts, + fetchWaitlistProducts, + createWaitlistProduct, + updateWaitlistProduct, + deleteWaitlistProduct, + } +} diff --git a/storage/framework/defaults/functions/commerce/waitlist/restaurants.ts b/storage/framework/defaults/functions/commerce/waitlist/restaurants.ts new file mode 100644 index 0000000000..20691771e6 --- /dev/null +++ b/storage/framework/defaults/functions/commerce/waitlist/restaurants.ts @@ -0,0 +1,101 @@ +import type { WaitlistRestaurant } from '../../../types' +import { useFetch, useStorage } from '@vueuse/core' + +// Create a persistent waitlist restaurants array using VueUse's useStorage +const waitlistRestaurants = useStorage('waitlist_restaurants', []) + +const baseURL = 'http://localhost:3008/api' + +// Basic fetch function to get all waitlist restaurants +async function fetchWaitlistRestaurants() { + const { error, data } = useFetch(`${baseURL}/commerce/waitlist/restaurants`) + + if (error.value) { + console.error('Error fetching waitlist restaurants:', error.value) + return [] + } + + // Ensure data is an array before assigning + if (Array.isArray(data.value)) { + waitlistRestaurants.value = data.value + return data.value + } + else { + console.error('Expected array of waitlist restaurants but received:', typeof data.value) + return [] + } +} + +async function createWaitlistRestaurant(waitlistRestaurant: WaitlistRestaurant) { + const { error, data } = useFetch(`${baseURL}/commerce/waitlist/restaurants`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(waitlistRestaurant), + }) + + if (error.value) { + console.error('Error creating waitlist restaurant:', error.value) + return null + } + + if (data.value) { + waitlistRestaurants.value.push(data.value) + return data.value + } + return null +} + +async function updateWaitlistRestaurant(waitlistRestaurant: WaitlistRestaurant) { + const { error, data } = useFetch(`${baseURL}/commerce/waitlist/restaurants/${waitlistRestaurant.id}`, { + method: 'PATCH', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(waitlistRestaurant), + }) + + if (error.value) { + console.error('Error updating waitlist restaurant:', error.value) + return null + } + + if (data.value) { + const index = waitlistRestaurants.value.findIndex(wr => wr.id === waitlistRestaurant.id) + if (index !== -1) { + waitlistRestaurants.value[index] = data.value + } + return data.value + } + return null +} + +async function deleteWaitlistRestaurant(id: number) { + const { error } = useFetch(`${baseURL}/commerce/waitlist/restaurants/${id}`, { + method: 'DELETE', + }) + + if (error.value) { + console.error('Error deleting waitlist restaurant:', error.value) + return false + } + + const index = waitlistRestaurants.value.findIndex(wr => wr.id === id) + if (index !== -1) { + waitlistRestaurants.value.splice(index, 1) + } + + return true +} + +// Export the composable +export function useWaitlistRestaurants() { + return { + waitlistRestaurants, + fetchWaitlistRestaurants, + createWaitlistRestaurant, + updateWaitlistRestaurant, + deleteWaitlistRestaurant, + } +} diff --git a/storage/framework/defaults/types/index.ts b/storage/framework/defaults/types/index.ts index 7218c28f06..df5ac802e5 100644 --- a/storage/framework/defaults/types/index.ts +++ b/storage/framework/defaults/types/index.ts @@ -253,3 +253,44 @@ export interface Drivers { created_at?: string updated_at?: string } + +export interface WaitlistProduct { + id: number + product_id: number + customer_id: number + name: string + email: string + phone?: string + party_size: number + notification_preference: string | string[] + source: string + notes?: string + status: string | string[] + notified_at?: string + purchased_at?: string + cancelled_at?: string + uuid?: string + created_at?: string + updated_at?: string +} + +export interface WaitlistRestaurant { + id: number + customer_id: number + name: string + email: string + phone?: string + party_size: number + check_in_time: string + table_preference: string | string[] + status: string | string[] + quoted_wait_time: number + actual_wait_time?: number + queue_position?: number + seated_at?: Date | string + no_show_at?: Date | string + cancelled_at?: Date | string + uuid?: string + created_at?: string + updated_at?: string +} From b441e24378689a49d13faf050de97358ceaddf71 Mon Sep 17 00:00:00 2001 From: cab-mikee Date: Fri, 4 Apr 2025 03:37:34 +0800 Subject: [PATCH 76/78] chore: wip --- .../framework/core/logging/clarity.config.ts | 10 ++ storage/framework/core/logging/package.json | 2 +- storage/framework/core/logging/src/index.ts | 142 ++++++++---------- 3 files changed, 77 insertions(+), 77 deletions(-) create mode 100644 storage/framework/core/logging/clarity.config.ts diff --git a/storage/framework/core/logging/clarity.config.ts b/storage/framework/core/logging/clarity.config.ts new file mode 100644 index 0000000000..19db0beebf --- /dev/null +++ b/storage/framework/core/logging/clarity.config.ts @@ -0,0 +1,10 @@ +import type { ClarityOptions } from '@stacksjs/clarity' +import * as p from '@stacksjs/path' + +const config: ClarityOptions = { + verbose: false, + level: 'debug', + logDirectory: p.projectPath('storage/logs'), +} + +export default config diff --git a/storage/framework/core/logging/package.json b/storage/framework/core/logging/package.json index 1759b7e68d..896f5fee3d 100644 --- a/storage/framework/core/logging/package.json +++ b/storage/framework/core/logging/package.json @@ -35,7 +35,7 @@ "prepublishOnly": "bun run build" }, "devDependencies": { - "@stacksjs/clarity": "^0.3.2", + "@stacksjs/clarity": "^0.3.3", "@stacksjs/cli": "workspace:*", "@stacksjs/config": "workspace:*", "@stacksjs/error-handling": "workspace:*", diff --git a/storage/framework/core/logging/src/index.ts b/storage/framework/core/logging/src/index.ts index 19c136dcef..472058ea36 100644 --- a/storage/framework/core/logging/src/index.ts +++ b/storage/framework/core/logging/src/index.ts @@ -3,64 +3,38 @@ import process from 'node:process' import { Logger } from '@stacksjs/clarity' import { buddyOptions } from '@stacksjs/cli' import { handleError, writeToLogFile } from '@stacksjs/error-handling' -import * as p from '@stacksjs/path' import { ExitCode } from '@stacksjs/types' import { consola, createConsola } from 'consola' +// Initialize loggers const clarityLog = new Logger('stacks', { level: 'debug', - logDirectory: p.projectPath('storage/logs'), +}) +const consolaLogger = createConsola({ + level: determineLogLevel(), }) -// import type { Prompt } from '@stacksjs/cli' - -export function logLevel(): number { - /** - * This regex checks for: - * - --verbose true or --verbose=true exactly at the end of the string ($ denotes the end of the string). - * - --verbose - followed by optional spaces at the end. - * - --verbose followed by optional spaces at the end. - * - * .trim() is used on options to ensure any trailing spaces in the entire options string do not affect the regex match. - */ +// Helper function to determine log level based on verbose flag +function determineLogLevel(): number { const verboseRegex = /--verbose(?!\s*=\s*false|\s+false)(?:\s+|=true)?(?:$|\s)/ const opts = buddyOptions() - - if (verboseRegex.test(opts)) - return 4 - - // const config = await import('@stacksjs/config') - // console.log('config', config) - - // return config.logger.level - return 3 + return verboseRegex.test(opts) ? 4 : 3 } -export const logger: Log = { - ...createConsola({ - level: logLevel(), - // fancy: true, - }), - warning: (message: string) => console.warn(message), - dump: (...args: any[]) => console.log(...args), - dd: (...args: any[]) => { - console.log(...args) - process.exit(ExitCode.FatalError) - }, - echo: (message: string) => console.log(message), +// Helper function to format message for logging +function formatMessage(...args: any[]): string { + return args.map(arg => + typeof arg === 'object' ? JSON.stringify(arg, null, 2) : String(arg) + ).join(' ') } -export { consola, createConsola } - -type ErrorMessage = string -export type ErrorOptions = - | { - shouldExit: boolean - silent?: boolean - message?: ErrorMessage - } - | any - | Error +// Helper function to handle styled output +function handleStyledOutput(message: string, logger: any, method: string, options?: LogOptions) { + if (options?.styled === false) + console.log(message) + else + logger[method](message) +} export interface Log { info: (...args: any[]) => void @@ -69,11 +43,6 @@ export interface Log { warn: (arg: string) => void warning: (arg: string) => void debug: (...args: any[]) => void - // prompt: Prompt - // start: logger.Start - // box: logger.Box - // start: any - // box: any dump: (...args: any[]) => void dd: (...args: any[]) => void echo: (...args: any[]) => void @@ -83,70 +52,91 @@ export interface LogOptions { styled?: boolean } +export type ErrorMessage = string +export type ErrorOptions = { + shouldExit: boolean + silent?: boolean + message?: ErrorMessage +} | any | Error + export const log: Log = { info: async (message: string, options?: LogOptions) => { - if (options?.styled === false) - console.log(message) - // else clarityLog.info(message) - // await writeToLogFile(`INFO: ${stripAnsi(message)}`) + handleStyledOutput(message, consolaLogger, 'info', options) + clarityLog.info(message) }, success: async (message: string, options?: LogOptions) => { - if (options?.styled === false) - console.log(message) - else clarityLog.success(message) - // await writeToLogFile(`SUCCESS: ${stripAnsi(message)}`) + handleStyledOutput(message, consolaLogger, 'success', options) + clarityLog.info(`SUCCESS: ${message}`) }, warn: async (message: string, options?: LogOptions) => { - if (options?.styled === false) - console.log(message) - else clarityLog.warn(message) - // await writeToLogFile(`WARN: ${stripAnsi(message)}`) + handleStyledOutput(message, consolaLogger, 'warn', options) + clarityLog.warn(message) }, - /** alias for `log.warn()`. */ warning: async (message: string, options?: LogOptions) => { - if (options?.styled === false) - console.log(message) - else clarityLog.warn(message) - // await writeToLogFile(`WARN: ${stripAnsi(message)}`) + handleStyledOutput(message, consolaLogger, 'warn', options) + clarityLog.warn(message) }, error: async (err: string | Error | object | unknown, options?: ErrorOptions) => { + const errorMessage = typeof err === 'string' + ? err + : err instanceof Error + ? err.message + : JSON.stringify(err) + + handleStyledOutput(errorMessage, consolaLogger, 'error', options) + clarityLog.error(errorMessage) handleError(err, options) }, debug: async (...args: any[]) => { - const formattedArgs = args.map(arg => (typeof arg === 'object' ? JSON.stringify(arg, null, 2) : arg)) - const message = `DEBUG: ${formattedArgs.join(' ')}` + const message = `${formatMessage(...args)}` - if (process.env.APP_ENV === 'production' || process.env.APP_ENV === 'prod') + if (process.env.APP_ENV === 'production' || process.env.APP_ENV === 'prod') { + clarityLog.debug(message) return writeToLogFile(message) + } + consolaLogger.debug(`DEBUG: ${message}`) clarityLog.debug(message) - // await writeToLogFile(stripAnsi(message)) }, - dump: (...args: any[]) => args.forEach(arg => console.log(arg)), + dump: (...args: any[]) => { + const message = formatMessage(...args) + console.log(message) + clarityLog.debug(`DUMP: ${message}`) + }, + dd: (...args: any[]) => { - args.forEach(arg => console.log(arg)) + const message = formatMessage(...args) + console.log(message) + consolaLogger.error(message) + clarityLog.error(message) process.exit(ExitCode.FatalError) }, - echo: (...args: any[]) => console.log(...args), + + echo: (...args: any[]) => { + const message = formatMessage(...args) + console.log(message) + clarityLog.info(`ECHO: ${message}`) + }, } +// Export convenience functions export function dump(...args: any[]): void { args.forEach(arg => log.debug(arg)) } export function dd(...args: any[]): void { log.info(args) - // we need to return a non-zero exit code to indicate an error - // e.g. if used in a CDK script, we want it to fail the deployment process.exit(ExitCode.FatalError) } export function echo(...args: any[]): void { console.log(...args) } + +export { consola, createConsola } From 1da9b74a2c49ed93ef3ad5f2befd92c9c54437c8 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 3 Apr 2025 18:12:19 -0700 Subject: [PATCH 77/78] chore: wip --- bun.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bun.lock b/bun.lock index 3d882281a7..19c1c12d55 100644 --- a/bun.lock +++ b/bun.lock @@ -970,7 +970,7 @@ "name": "@stacksjs/logging", "version": "0.70.22", "devDependencies": { - "@stacksjs/clarity": "^0.3.2", + "@stacksjs/clarity": "^0.3.3", "@stacksjs/cli": "workspace:*", "@stacksjs/config": "workspace:*", "@stacksjs/error-handling": "workspace:*", @@ -2574,7 +2574,7 @@ "@stacksjs/chat": ["@stacksjs/chat@workspace:storage/framework/core/chat"], - "@stacksjs/clarity": ["@stacksjs/clarity@0.3.2", "", { "bin": { "clarity": "dist/bin/cli.js" } }, "sha512-7NlGpvoA2U5Nw8NJCjyJnFBgTHQ9vCOjLWCsyJiE6LzzKZdZAbp2IrHqbL2/aH27aXZa2p6fda7mg2CIfkk4xA=="], + "@stacksjs/clarity": ["@stacksjs/clarity@0.3.3", "", { "bin": { "clarity": "dist/bin/cli.js" } }, "sha512-ECtLvbHWzyyVlBjoVSoD5+m0I9gn/OtRzvzZGMVrVE9wFhOlaasqYjk7ZzlqMd2PhoP/lJV2SSUgKcMEl7/QKA=="], "@stacksjs/cli": ["@stacksjs/cli@workspace:storage/framework/core/cli"], From 350c45b08c4a3eed4668ae2f12d1b17e80677262 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 3 Apr 2025 18:12:52 -0700 Subject: [PATCH 78/78] chore: release v0.70.23 --- storage/framework/api/package.json | 2 +- storage/framework/cloud/package.json | 2 +- storage/framework/core/actions/package.json | 2 +- storage/framework/core/ai/package.json | 2 +- storage/framework/core/alias/package.json | 2 +- storage/framework/core/analytics/package.json | 2 +- storage/framework/core/api/package.json | 2 +- storage/framework/core/arrays/package.json | 2 +- storage/framework/core/auth/package.json | 2 +- storage/framework/core/browser/package.json | 2 +- storage/framework/core/buddy/package.json | 2 +- storage/framework/core/build/package.json | 2 +- storage/framework/core/bun-create/bud/package.json | 2 +- storage/framework/core/bun-create/buddy/package.json | 2 +- storage/framework/core/bun-create/stack/package.json | 2 +- storage/framework/core/bun-create/stacks/package.json | 2 +- storage/framework/core/bun-create/stx/package.json | 2 +- storage/framework/core/cache/package.json | 2 +- storage/framework/core/calendar/package.json | 2 +- storage/framework/core/chat/package.json | 2 +- storage/framework/core/cli/package.json | 2 +- storage/framework/core/cloud/package.json | 2 +- .../core/cloud/src/cloud/router-layer/nodejs/package.json | 2 +- storage/framework/core/collections/package.json | 2 +- storage/framework/core/commerce/package.json | 2 +- storage/framework/core/components/audio/package.json | 2 +- storage/framework/core/components/auth/package.json | 2 +- storage/framework/core/components/button/package.json | 2 +- storage/framework/core/components/calendar/package.json | 2 +- storage/framework/core/components/combobox/package.json | 2 +- storage/framework/core/components/command-palette/package.json | 2 +- storage/framework/core/components/dialog/package.json | 2 +- storage/framework/core/components/drawer/package.json | 2 +- storage/framework/core/components/dropdown/package.json | 2 +- storage/framework/core/components/image/package.json | 2 +- storage/framework/core/components/listbox/package.json | 2 +- storage/framework/core/components/navigator/package.json | 2 +- storage/framework/core/components/notification/package.json | 2 +- storage/framework/core/components/package.json | 2 +- storage/framework/core/components/payment/package.json | 2 +- storage/framework/core/components/popover/package.json | 2 +- storage/framework/core/components/radio-group/package.json | 2 +- storage/framework/core/components/select/package.json | 2 +- storage/framework/core/components/stepper/package.json | 2 +- storage/framework/core/components/switch/package.json | 2 +- storage/framework/core/components/table/package.json | 2 +- storage/framework/core/components/transition/package.json | 2 +- storage/framework/core/components/video/package.json | 2 +- storage/framework/core/config/package.json | 2 +- storage/framework/core/cron/package.json | 2 +- storage/framework/core/database/package.json | 2 +- storage/framework/core/datetime/package.json | 2 +- storage/framework/core/desktop/package.json | 2 +- storage/framework/core/development/package.json | 2 +- storage/framework/core/dns/package.json | 2 +- storage/framework/core/docs/package.json | 2 +- storage/framework/core/email/package.json | 2 +- storage/framework/core/enums/package.json | 2 +- storage/framework/core/env/package.json | 2 +- storage/framework/core/error-handling/package.json | 2 +- storage/framework/core/events/package.json | 2 +- storage/framework/core/faker/package.json | 2 +- storage/framework/core/git/package.json | 2 +- storage/framework/core/health/package.json | 2 +- storage/framework/core/http/package.json | 2 +- storage/framework/core/lint/package.json | 2 +- storage/framework/core/logging/package.json | 2 +- storage/framework/core/logging/src/index.ts | 2 +- storage/framework/core/notifications/package.json | 2 +- storage/framework/core/objects/package.json | 2 +- storage/framework/core/orm/package.json | 2 +- storage/framework/core/package.json | 2 +- storage/framework/core/path/package.json | 2 +- storage/framework/core/payments/package.json | 2 +- storage/framework/core/plugins/package.json | 2 +- storage/framework/core/push/package.json | 2 +- storage/framework/core/query-builder/package.json | 2 +- storage/framework/core/queue/package.json | 2 +- storage/framework/core/raycast/package.json | 2 +- storage/framework/core/realtime/package.json | 2 +- storage/framework/core/registry/package.json | 2 +- storage/framework/core/repl/package.json | 2 +- storage/framework/core/router/package.json | 2 +- storage/framework/core/scheduler/package.json | 2 +- storage/framework/core/search-engine/package.json | 2 +- storage/framework/core/security/package.json | 2 +- storage/framework/core/server/package.json | 2 +- storage/framework/core/shell/package.json | 2 +- storage/framework/core/slug/package.json | 2 +- storage/framework/core/sms/package.json | 2 +- storage/framework/core/storage/package.json | 2 +- storage/framework/core/strings/package.json | 2 +- storage/framework/core/testing/package.json | 2 +- storage/framework/core/tinker/package.json | 2 +- storage/framework/core/tunnel/package.json | 2 +- storage/framework/core/types/package.json | 2 +- storage/framework/core/ui/package.json | 2 +- storage/framework/core/utils/package.json | 2 +- storage/framework/core/validation/package.json | 2 +- storage/framework/core/vite-config/package.json | 2 +- storage/framework/core/vite-plugin/package.json | 2 +- storage/framework/core/whois/package.json | 2 +- storage/framework/core/x-ray/package.json | 2 +- storage/framework/defaults/ide/vscode/package.json | 2 +- storage/framework/docs/package.json | 2 +- storage/framework/email/package.json | 2 +- storage/framework/libs/components/vue/package.json | 2 +- storage/framework/libs/components/web/package.json | 2 +- storage/framework/libs/functions/package.json | 2 +- storage/framework/orm/package.json | 2 +- storage/framework/package.json | 2 +- storage/framework/server/package.json | 2 +- storage/framework/views/dashboard/package.json | 2 +- storage/framework/views/desktop/package.json | 2 +- storage/framework/views/system-tray/package.json | 2 +- storage/framework/views/web/package.json | 2 +- 116 files changed, 116 insertions(+), 116 deletions(-) diff --git a/storage/framework/api/package.json b/storage/framework/api/package.json index 825a3bc702..463ff6fefa 100644 --- a/storage/framework/api/package.json +++ b/storage/framework/api/package.json @@ -1,7 +1,7 @@ { "name": "stacks-api", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "scripts": { "build": "bun build.ts", "dev": "bun --hot run dev.ts", diff --git a/storage/framework/cloud/package.json b/storage/framework/cloud/package.json index 5db3a7f8e0..d712cf41a9 100644 --- a/storage/framework/cloud/package.json +++ b/storage/framework/cloud/package.json @@ -1,7 +1,7 @@ { "name": "stacks-cloud", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks cloud/serverless integration & implementation.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/actions/package.json b/storage/framework/core/actions/package.json index 89dc854802..f0f5ad0c27 100644 --- a/storage/framework/core/actions/package.json +++ b/storage/framework/core/actions/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/actions", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks actions.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/ai/package.json b/storage/framework/core/ai/package.json index 2c0e5bcd4b..d781cfd196 100644 --- a/storage/framework/core/ai/package.json +++ b/storage/framework/core/ai/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/ai", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Stacks Artificial Intelligence.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/alias/package.json b/storage/framework/core/alias/package.json index 395565017c..471ee7a2aa 100644 --- a/storage/framework/core/alias/package.json +++ b/storage/framework/core/alias/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/alias", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks aliases.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/analytics/package.json b/storage/framework/core/analytics/package.json index 2d87650506..79f5fe4b03 100644 --- a/storage/framework/core/analytics/package.json +++ b/storage/framework/core/analytics/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/analytics", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Stacks Analytics. Privacy-friendly.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/api/package.json b/storage/framework/core/api/package.json index dd772aa750..942c3686ab 100644 --- a/storage/framework/core/api/package.json +++ b/storage/framework/core/api/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/api", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks array utilities.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/arrays/package.json b/storage/framework/core/arrays/package.json index b47f952cb3..1c09ab9734 100644 --- a/storage/framework/core/arrays/package.json +++ b/storage/framework/core/arrays/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/arrays", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks array utilities.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/auth/package.json b/storage/framework/core/auth/package.json index 6065c2e407..36829a965a 100644 --- a/storage/framework/core/auth/package.json +++ b/storage/framework/core/auth/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/auth", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "A more simplistic way to authenticate.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/browser/package.json b/storage/framework/core/browser/package.json index 44b2608d8d..8d2f14d6a8 100644 --- a/storage/framework/core/browser/package.json +++ b/storage/framework/core/browser/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/browser", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Stacks core frontend/browser functionalities.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/buddy/package.json b/storage/framework/core/buddy/package.json index d97f546ad2..7db0552ba9 100644 --- a/storage/framework/core/buddy/package.json +++ b/storage/framework/core/buddy/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/buddy", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Meet Buddy. The Stacks runtime.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/build/package.json b/storage/framework/core/build/package.json index ba0d01a825..41aded84be 100644 --- a/storage/framework/core/build/package.json +++ b/storage/framework/core/build/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/build", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks framework build tools and configurations.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/bun-create/bud/package.json b/storage/framework/core/bun-create/bud/package.json index 04d2c1d711..7a444e37e4 100644 --- a/storage/framework/core/bun-create/bud/package.json +++ b/storage/framework/core/bun-create/bud/package.json @@ -1,7 +1,7 @@ { "name": "@bun-examples/bud", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Your project description.", "author": "your-name ", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/bun-create/buddy/package.json b/storage/framework/core/bun-create/buddy/package.json index ec7af8f6c8..a13befc58a 100644 --- a/storage/framework/core/bun-create/buddy/package.json +++ b/storage/framework/core/bun-create/buddy/package.json @@ -1,7 +1,7 @@ { "name": "@bun-examples/buddy", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Your project description.", "author": "your-name ", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/bun-create/stack/package.json b/storage/framework/core/bun-create/stack/package.json index 35b9988251..81003735b5 100644 --- a/storage/framework/core/bun-create/stack/package.json +++ b/storage/framework/core/bun-create/stack/package.json @@ -1,7 +1,7 @@ { "name": "@bun-examples/stack", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Your project description.", "author": "your-name ", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/bun-create/stacks/package.json b/storage/framework/core/bun-create/stacks/package.json index 55b2888eb1..4083222945 100644 --- a/storage/framework/core/bun-create/stacks/package.json +++ b/storage/framework/core/bun-create/stacks/package.json @@ -1,7 +1,7 @@ { "name": "@bun-examples/stacks", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Your project description.", "author": "your-name ", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/bun-create/stx/package.json b/storage/framework/core/bun-create/stx/package.json index 777831d233..c0d97da978 100644 --- a/storage/framework/core/bun-create/stx/package.json +++ b/storage/framework/core/bun-create/stx/package.json @@ -1,7 +1,7 @@ { "name": "@bun-examples/stx", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Your project description.", "author": "your-name ", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/cache/package.json b/storage/framework/core/cache/package.json index 36971c6efd..99c6c4a59c 100644 --- a/storage/framework/core/cache/package.json +++ b/storage/framework/core/cache/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/cache", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Caching the Stacks way.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/calendar/package.json b/storage/framework/core/calendar/package.json index 2887dc2b67..32080d9161 100644 --- a/storage/framework/core/calendar/package.json +++ b/storage/framework/core/calendar/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/calendar-api", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Easily interact with calendar APIs.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/chat/package.json b/storage/framework/core/chat/package.json index f10649adf6..9a5f169e2b 100644 --- a/storage/framework/core/chat/package.json +++ b/storage/framework/core/chat/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/chat", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Easily interact with chat APIs.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/cli/package.json b/storage/framework/core/cli/package.json index 8f88d1cd61..02d87bfe55 100644 --- a/storage/framework/core/cli/package.json +++ b/storage/framework/core/cli/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/cli", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "TypeScript framework for CLI artisans. Build beautiful console apps with ease.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/cloud/package.json b/storage/framework/core/cloud/package.json index 39834f1804..e9d43347b6 100644 --- a/storage/framework/core/cloud/package.json +++ b/storage/framework/core/cloud/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/cloud", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks cloud/serverless integration & implementation.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/cloud/src/cloud/router-layer/nodejs/package.json b/storage/framework/core/cloud/src/cloud/router-layer/nodejs/package.json index 308b1989c3..7ac253a124 100644 --- a/storage/framework/core/cloud/src/cloud/router-layer/nodejs/package.json +++ b/storage/framework/core/cloud/src/cloud/router-layer/nodejs/package.json @@ -1,6 +1,6 @@ { "name": "stacks-router-layer", - "version": "0.70.22", + "version": "0.70.23", "description": "", "author": "", "license": "MIT", diff --git a/storage/framework/core/collections/package.json b/storage/framework/core/collections/package.json index 21eb954841..3012dd8b15 100644 --- a/storage/framework/core/collections/package.json +++ b/storage/framework/core/collections/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/collections", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks collections.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/commerce/package.json b/storage/framework/core/commerce/package.json index 04705a071d..51294f0789 100644 --- a/storage/framework/core/commerce/package.json +++ b/storage/framework/core/commerce/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/commerce", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Stacks ecommerce utilities.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/components/audio/package.json b/storage/framework/core/components/audio/package.json index c4f23851cd..1c1fe204d9 100644 --- a/storage/framework/core/components/audio/package.json +++ b/storage/framework/core/components/audio/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/audio", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Opinionated audio components for Stacks.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/components/auth/package.json b/storage/framework/core/components/auth/package.json index f6117a69c1..32a63b5f2b 100644 --- a/storage/framework/core/components/auth/package.json +++ b/storage/framework/core/components/auth/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/auths", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Opinionated auth components for Stacks.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/components/button/package.json b/storage/framework/core/components/button/package.json index bd40e061d7..1c82232253 100644 --- a/storage/framework/core/components/button/package.json +++ b/storage/framework/core/components/button/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/button", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Opinionated button components for Stacks.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/components/calendar/package.json b/storage/framework/core/components/calendar/package.json index ed98838a66..c45530424d 100644 --- a/storage/framework/core/components/calendar/package.json +++ b/storage/framework/core/components/calendar/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/calendar", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Calendar components for all.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/components/combobox/package.json b/storage/framework/core/components/combobox/package.json index b1f00c737e..c6a1ec89ea 100644 --- a/storage/framework/core/components/combobox/package.json +++ b/storage/framework/core/components/combobox/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/combobox", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "A modern combobox component.", "author": "Chris Breuer", "contributors": [ diff --git a/storage/framework/core/components/command-palette/package.json b/storage/framework/core/components/command-palette/package.json index 8b1e03edcf..08c923a814 100644 --- a/storage/framework/core/components/command-palette/package.json +++ b/storage/framework/core/components/command-palette/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/command-palette", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "An opinionated command palette component for Stacks.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/components/dialog/package.json b/storage/framework/core/components/dialog/package.json index b19eacd097..7d7477b5a5 100644 --- a/storage/framework/core/components/dialog/package.json +++ b/storage/framework/core/components/dialog/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/dialog", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "A modern dialog component.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/components/drawer/package.json b/storage/framework/core/components/drawer/package.json index 2f31b33aff..c96cbdfd91 100644 --- a/storage/framework/core/components/drawer/package.json +++ b/storage/framework/core/components/drawer/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/drawer", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "A modern dropdown component.", "author": "Chris Breuer", "contributors": [ diff --git a/storage/framework/core/components/dropdown/package.json b/storage/framework/core/components/dropdown/package.json index 6ebf040e0f..6a8887b687 100644 --- a/storage/framework/core/components/dropdown/package.json +++ b/storage/framework/core/components/dropdown/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/dropdown", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "A modern dropdown component.", "author": "Chris Breuer", "contributors": [ diff --git a/storage/framework/core/components/image/package.json b/storage/framework/core/components/image/package.json index 69f005b36d..a2e7197d09 100644 --- a/storage/framework/core/components/image/package.json +++ b/storage/framework/core/components/image/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/image", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Opinionated image components for Stacks.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/components/listbox/package.json b/storage/framework/core/components/listbox/package.json index fe71cdbab1..09fa68248e 100644 --- a/storage/framework/core/components/listbox/package.json +++ b/storage/framework/core/components/listbox/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/listbox", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "A modern listbox component.", "author": "Chris Breuer", "contributors": [ diff --git a/storage/framework/core/components/navigator/package.json b/storage/framework/core/components/navigator/package.json index 60b0749053..99624e3e1a 100644 --- a/storage/framework/core/components/navigator/package.json +++ b/storage/framework/core/components/navigator/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/navigator", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "An opinionated navigator component.", "author": "Zoltan", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/components/notification/package.json b/storage/framework/core/components/notification/package.json index 6b6f26484b..c57a2eadbb 100644 --- a/storage/framework/core/components/notification/package.json +++ b/storage/framework/core/components/notification/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/notification", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "An opinionated notification component for Stacks.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/components/package.json b/storage/framework/core/components/package.json index 39b501006b..d216dab97a 100644 --- a/storage/framework/core/components/package.json +++ b/storage/framework/core/components/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/components", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks component libraries.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/components/payment/package.json b/storage/framework/core/components/payment/package.json index d9299f9b39..9b4fe07b31 100644 --- a/storage/framework/core/components/payment/package.json +++ b/storage/framework/core/components/payment/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/payment", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "An opinionated payment component for Stacks.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/components/popover/package.json b/storage/framework/core/components/popover/package.json index de57efb2d1..07c77615a5 100644 --- a/storage/framework/core/components/popover/package.json +++ b/storage/framework/core/components/popover/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/popover", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "A modern popover component.", "author": "Chris Breuer", "contributors": [ diff --git a/storage/framework/core/components/radio-group/package.json b/storage/framework/core/components/radio-group/package.json index bb8fb2e5ec..46f1af04cb 100644 --- a/storage/framework/core/components/radio-group/package.json +++ b/storage/framework/core/components/radio-group/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/radio-group", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "A modern radio group component.", "author": "Chris Breuer", "contributors": [ diff --git a/storage/framework/core/components/select/package.json b/storage/framework/core/components/select/package.json index e7506fcdc0..85be7f1d57 100644 --- a/storage/framework/core/components/select/package.json +++ b/storage/framework/core/components/select/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/select", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Opinionated select components for Stacks.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/components/stepper/package.json b/storage/framework/core/components/stepper/package.json index 99323541e2..50ccb4e51a 100644 --- a/storage/framework/core/components/stepper/package.json +++ b/storage/framework/core/components/stepper/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/stepper", "type": "module", - "version": "0.69.5", + "version": "0.70.23", "description": "A modern stepper component.", "author": "Chris Breuer", "contributors": [ diff --git a/storage/framework/core/components/switch/package.json b/storage/framework/core/components/switch/package.json index 8a310871e3..ff7749a624 100644 --- a/storage/framework/core/components/switch/package.json +++ b/storage/framework/core/components/switch/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/switch", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "A modern switch component.", "author": "Chris Breuer", "contributors": [ diff --git a/storage/framework/core/components/table/package.json b/storage/framework/core/components/table/package.json index 8c658a5d54..3017fc3249 100644 --- a/storage/framework/core/components/table/package.json +++ b/storage/framework/core/components/table/package.json @@ -1,6 +1,6 @@ { "name": "@stacksjs/table", - "version": "0.70.22", + "version": "0.70.23", "description": "The easy & modern way to work with tables. Facet filtering, searching, pagination, and more.", "author": "Stacks.js", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/components/transition/package.json b/storage/framework/core/components/transition/package.json index 536601535d..1c14d2150d 100644 --- a/storage/framework/core/components/transition/package.json +++ b/storage/framework/core/components/transition/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/transition", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "A modern transition component.", "author": "Chris Breuer", "contributors": [ diff --git a/storage/framework/core/components/video/package.json b/storage/framework/core/components/video/package.json index abc3064340..508e3b7d20 100644 --- a/storage/framework/core/components/video/package.json +++ b/storage/framework/core/components/video/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/video", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Opinionated video components for Stacks.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/config/package.json b/storage/framework/core/config/package.json index 24a1505363..7ba5a40d4c 100644 --- a/storage/framework/core/config/package.json +++ b/storage/framework/core/config/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/config", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks config helper methods.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/cron/package.json b/storage/framework/core/cron/package.json index 921229609a..501579c818 100644 --- a/storage/framework/core/cron/package.json +++ b/storage/framework/core/cron/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/cron", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks cron.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/database/package.json b/storage/framework/core/database/package.json index 7513c4df67..6aea6e4f9f 100644 --- a/storage/framework/core/database/package.json +++ b/storage/framework/core/database/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/database", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks database integration.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/datetime/package.json b/storage/framework/core/datetime/package.json index 562e6ad42a..2e234b9188 100644 --- a/storage/framework/core/datetime/package.json +++ b/storage/framework/core/datetime/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/datetime", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks datetime helpers.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/desktop/package.json b/storage/framework/core/desktop/package.json index 2b4622d8b6..091c1a85c8 100644 --- a/storage/framework/core/desktop/package.json +++ b/storage/framework/core/desktop/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/desktop", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks Desktop engine.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/development/package.json b/storage/framework/core/development/package.json index f7af76d160..b762cd8ef0 100644 --- a/storage/framework/core/development/package.json +++ b/storage/framework/core/development/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/development", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks development dependencies.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/dns/package.json b/storage/framework/core/dns/package.json index bf565376fa..0c37c2896c 100644 --- a/storage/framework/core/dns/package.json +++ b/storage/framework/core/dns/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/dns", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Easily manage your DNS.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/docs/package.json b/storage/framework/core/docs/package.json index ef55a9306f..20b37d8fb6 100644 --- a/storage/framework/core/docs/package.json +++ b/storage/framework/core/docs/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/docs", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks way to document.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/email/package.json b/storage/framework/core/email/package.json index 33fcf93160..1a3c7ca768 100644 --- a/storage/framework/core/email/package.json +++ b/storage/framework/core/email/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/email", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks Email integration. Painlessly create & manage your inboxes, templates, and send emails.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/enums/package.json b/storage/framework/core/enums/package.json index 6da7241ab2..f528274134 100644 --- a/storage/framework/core/enums/package.json +++ b/storage/framework/core/enums/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/enums", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Stacks enums.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/env/package.json b/storage/framework/core/env/package.json index 52a06c39c7..b164e107ab 100644 --- a/storage/framework/core/env/package.json +++ b/storage/framework/core/env/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/env", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Stacks env helper methods.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/error-handling/package.json b/storage/framework/core/error-handling/package.json index 4888650c4b..f5bc37a29d 100644 --- a/storage/framework/core/error-handling/package.json +++ b/storage/framework/core/error-handling/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/error-handling", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Type safe error handling.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/events/package.json b/storage/framework/core/events/package.json index c65b809487..46ae5d0593 100644 --- a/storage/framework/core/events/package.json +++ b/storage/framework/core/events/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/events", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Functional event emitting.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/faker/package.json b/storage/framework/core/faker/package.json index 1fffd7dd45..6bdab061de 100644 --- a/storage/framework/core/faker/package.json +++ b/storage/framework/core/faker/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/faker", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Faker functions.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/git/package.json b/storage/framework/core/git/package.json index da596b6616..1432b8c6fb 100644 --- a/storage/framework/core/git/package.json +++ b/storage/framework/core/git/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/git", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks git utilities & conventions.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/health/package.json b/storage/framework/core/health/package.json index f41a0cc4d5..38e801b644 100644 --- a/storage/framework/core/health/package.json +++ b/storage/framework/core/health/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/health", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks Health services.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/http/package.json b/storage/framework/core/http/package.json index 3f0ee1e0fe..23214256af 100644 --- a/storage/framework/core/http/package.json +++ b/storage/framework/core/http/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/http", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Stacks HTTP methods.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/lint/package.json b/storage/framework/core/lint/package.json index 3ea1f4924b..c40ce8a103 100644 --- a/storage/framework/core/lint/package.json +++ b/storage/framework/core/lint/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/lint", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks way to lint.", "author": "Chris Breuer", "contributors": [ diff --git a/storage/framework/core/logging/package.json b/storage/framework/core/logging/package.json index 896f5fee3d..de98ddcd2a 100644 --- a/storage/framework/core/logging/package.json +++ b/storage/framework/core/logging/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/logging", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks logging system.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/logging/src/index.ts b/storage/framework/core/logging/src/index.ts index 472058ea36..726ec6ce26 100644 --- a/storage/framework/core/logging/src/index.ts +++ b/storage/framework/core/logging/src/index.ts @@ -24,7 +24,7 @@ function determineLogLevel(): number { // Helper function to format message for logging function formatMessage(...args: any[]): string { return args.map(arg => - typeof arg === 'object' ? JSON.stringify(arg, null, 2) : String(arg) + typeof arg === 'object' ? JSON.stringify(arg, null, 2) : String(arg), ).join(' ') } diff --git a/storage/framework/core/notifications/package.json b/storage/framework/core/notifications/package.json index 38f8b8c5a7..9bd090083e 100644 --- a/storage/framework/core/notifications/package.json +++ b/storage/framework/core/notifications/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/notifications", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks notifications integration.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/objects/package.json b/storage/framework/core/objects/package.json index 58f9d24e76..de9c49dde9 100644 --- a/storage/framework/core/objects/package.json +++ b/storage/framework/core/objects/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/objects", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks objects.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/orm/package.json b/storage/framework/core/orm/package.json index 53f446a79d..689910fdbe 100644 --- a/storage/framework/core/orm/package.json +++ b/storage/framework/core/orm/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/orm", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks ORM integration", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/package.json b/storage/framework/core/package.json index 9ebafe2a03..9d49b92a3f 100644 --- a/storage/framework/core/package.json +++ b/storage/framework/core/package.json @@ -1,7 +1,7 @@ { "name": "stacks", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks framework.", "author": "Chris Breuer", "contributors": [ diff --git a/storage/framework/core/path/package.json b/storage/framework/core/path/package.json index 276ffeecea..6200ca1c66 100644 --- a/storage/framework/core/path/package.json +++ b/storage/framework/core/path/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/path", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks path.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/payments/package.json b/storage/framework/core/payments/package.json index 6a9a90cd4a..5be5446f10 100644 --- a/storage/framework/core/payments/package.json +++ b/storage/framework/core/payments/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/payments", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks payments package. Currently supporting Stripe.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/plugins/package.json b/storage/framework/core/plugins/package.json index f40e2ce098..b345e0b2b7 100644 --- a/storage/framework/core/plugins/package.json +++ b/storage/framework/core/plugins/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/slugs", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The core of what powers Stacks Plugins.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/push/package.json b/storage/framework/core/push/package.json index 99873302dc..e1b8893ad4 100644 --- a/storage/framework/core/push/package.json +++ b/storage/framework/core/push/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/push", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks Push integration", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/query-builder/package.json b/storage/framework/core/query-builder/package.json index 1182a7a61c..f9d21b9dfa 100644 --- a/storage/framework/core/query-builder/package.json +++ b/storage/framework/core/query-builder/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/query-builder", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks Query Builder integration", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/queue/package.json b/storage/framework/core/queue/package.json index a8fec9f084..d9cb657079 100644 --- a/storage/framework/core/queue/package.json +++ b/storage/framework/core/queue/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/queue", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks Queue system.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/raycast/package.json b/storage/framework/core/raycast/package.json index 8c1d29b7db..15b6221902 100644 --- a/storage/framework/core/raycast/package.json +++ b/storage/framework/core/raycast/package.json @@ -2,7 +2,7 @@ "$schema": "https://www.raycast.com/schemas/extension.json", "name": "buddy", "title": "Stacks Buddy", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks Raycast extension.", "author": "Stacks.js", "license": "MIT", diff --git a/storage/framework/core/realtime/package.json b/storage/framework/core/realtime/package.json index cf7e630ded..9ecf611376 100644 --- a/storage/framework/core/realtime/package.json +++ b/storage/framework/core/realtime/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/realtime", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks realtime integration.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/registry/package.json b/storage/framework/core/registry/package.json index f52f7fe47c..ee12a0a51d 100644 --- a/storage/framework/core/registry/package.json +++ b/storage/framework/core/registry/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/registry", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks Registry.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/repl/package.json b/storage/framework/core/repl/package.json index b1b0dee8fe..4548e64fb1 100644 --- a/storage/framework/core/repl/package.json +++ b/storage/framework/core/repl/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/repl", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "A Stacks optimized TS & Vue REPL.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/router/package.json b/storage/framework/core/router/package.json index 2792d66f48..08fc73724e 100644 --- a/storage/framework/core/router/package.json +++ b/storage/framework/core/router/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/router", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks framework router.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/scheduler/package.json b/storage/framework/core/scheduler/package.json index 5f7728110b..f5a0cc0b0b 100644 --- a/storage/framework/core/scheduler/package.json +++ b/storage/framework/core/scheduler/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/scheduler", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks scheduler.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/search-engine/package.json b/storage/framework/core/search-engine/package.json index 49c2870c03..4f8bfdd59a 100644 --- a/storage/framework/core/search-engine/package.json +++ b/storage/framework/core/search-engine/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/search-engine", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks search engine integrations.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/security/package.json b/storage/framework/core/security/package.json index a691a2b51a..770df7f7d4 100644 --- a/storage/framework/core/security/package.json +++ b/storage/framework/core/security/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/security", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks framework security.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/server/package.json b/storage/framework/core/server/package.json index 951f3a2eeb..c455efe13f 100644 --- a/storage/framework/core/server/package.json +++ b/storage/framework/core/server/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/server", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Local development and production-ready.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/shell/package.json b/storage/framework/core/shell/package.json index 7c718fdc49..61f17b0427 100644 --- a/storage/framework/core/shell/package.json +++ b/storage/framework/core/shell/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/shell", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "A better Stacks shell experience. Currently only fully supporting Oh My Zsh. Stay tuned for more. Or request one!", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/slug/package.json b/storage/framework/core/slug/package.json index 02482a1aff..2023be955d 100644 --- a/storage/framework/core/slug/package.json +++ b/storage/framework/core/slug/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/slug", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks slug functionality.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/sms/package.json b/storage/framework/core/sms/package.json index c91a052440..776f35d64d 100644 --- a/storage/framework/core/sms/package.json +++ b/storage/framework/core/sms/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/sms", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks SMS integration. Painlessly create & manage your inboxes, templates, and send sms.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/storage/package.json b/storage/framework/core/storage/package.json index c3780ce7b6..cb9837dfe6 100644 --- a/storage/framework/core/storage/package.json +++ b/storage/framework/core/storage/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/storage", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks file system.", "author": "Chris Breuer", "contributors": [ diff --git a/storage/framework/core/strings/package.json b/storage/framework/core/strings/package.json index 54f3fbad96..bc9a4c4a15 100644 --- a/storage/framework/core/strings/package.json +++ b/storage/framework/core/strings/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/strings", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks string utilities.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/testing/package.json b/storage/framework/core/testing/package.json index 5b1bc928e4..5c238fc321 100644 --- a/storage/framework/core/testing/package.json +++ b/storage/framework/core/testing/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/testing", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks way of testing.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/tinker/package.json b/storage/framework/core/tinker/package.json index 6499b4eecc..dc173bf202 100644 --- a/storage/framework/core/tinker/package.json +++ b/storage/framework/core/tinker/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/tinker", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "All you need to tinker.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/tunnel/package.json b/storage/framework/core/tunnel/package.json index d2c24000cb..2f185bc2dd 100644 --- a/storage/framework/core/tunnel/package.json +++ b/storage/framework/core/tunnel/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/tunnel", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Local development tunnel.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/types/package.json b/storage/framework/core/types/package.json index 1a5fcde60f..7ed290f7f7 100644 --- a/storage/framework/core/types/package.json +++ b/storage/framework/core/types/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/types", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks framework types.", "author": "Chris Breuer", "contributors": [ diff --git a/storage/framework/core/ui/package.json b/storage/framework/core/ui/package.json index 270abdc697..8d1cb90480 100644 --- a/storage/framework/core/ui/package.json +++ b/storage/framework/core/ui/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/ui", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks UI engine.", "author": "Chris Breuer", "contributors": [ diff --git a/storage/framework/core/utils/package.json b/storage/framework/core/utils/package.json index 6334b5ae30..7859343f83 100644 --- a/storage/framework/core/utils/package.json +++ b/storage/framework/core/utils/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/utils", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks helper functions.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/validation/package.json b/storage/framework/core/validation/package.json index edb77aa144..d22dc3225d 100644 --- a/storage/framework/core/validation/package.json +++ b/storage/framework/core/validation/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/validation", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks Validation ways.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/vite-config/package.json b/storage/framework/core/vite-config/package.json index 98700f0dd9..ad80421736 100644 --- a/storage/framework/core/vite-config/package.json +++ b/storage/framework/core/vite-config/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/vite-config", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks Vite configurations.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/vite-plugin/package.json b/storage/framework/core/vite-plugin/package.json index a72c842cf4..809c72557e 100644 --- a/storage/framework/core/vite-plugin/package.json +++ b/storage/framework/core/vite-plugin/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/vite-plugin", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks Vite plugins.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/whois/package.json b/storage/framework/core/whois/package.json index 24e004ad29..6e1e9aa3f5 100644 --- a/storage/framework/core/whois/package.json +++ b/storage/framework/core/whois/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/whois", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Easily get whois info.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/core/x-ray/package.json b/storage/framework/core/x-ray/package.json index 1bd0ee98b8..3346ada4ba 100644 --- a/storage/framework/core/x-ray/package.json +++ b/storage/framework/core/x-ray/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/x-ray", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "All you need to debug, log & analyze.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/defaults/ide/vscode/package.json b/storage/framework/defaults/ide/vscode/package.json index dabaed5c24..c7d521cd97 100644 --- a/storage/framework/defaults/ide/vscode/package.json +++ b/storage/framework/defaults/ide/vscode/package.json @@ -2,7 +2,7 @@ "publisher": "Stacks", "name": "vscode-stacks", "displayName": "Stacks", - "version": "0.70.22", + "version": "0.70.23", "description": "A modern Stacks development environment.", "license": "MIT", "funding": "https://github.com/sponsors/chrisbbreuer", diff --git a/storage/framework/docs/package.json b/storage/framework/docs/package.json index 6f58ce5dbf..3a94b6a49e 100644 --- a/storage/framework/docs/package.json +++ b/storage/framework/docs/package.json @@ -1,7 +1,7 @@ { "name": "stacks-docs", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "scripts": { "dev": "bun --bun vitepress dev", "build": "bun --bun vitepress build", diff --git a/storage/framework/email/package.json b/storage/framework/email/package.json index 7e7eebdf06..2a9e311b43 100644 --- a/storage/framework/email/package.json +++ b/storage/framework/email/package.json @@ -1,7 +1,7 @@ { "name": "stacks-email", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "private": true, "scripts": { "build": "wip", diff --git a/storage/framework/libs/components/vue/package.json b/storage/framework/libs/components/vue/package.json index cdd4dad021..cb481aea0f 100644 --- a/storage/framework/libs/components/vue/package.json +++ b/storage/framework/libs/components/vue/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/hello-world-vue", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Your Vue component library description", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/libs/components/web/package.json b/storage/framework/libs/components/web/package.json index c4583b5603..886bb7d312 100644 --- a/storage/framework/libs/components/web/package.json +++ b/storage/framework/libs/components/web/package.json @@ -1,7 +1,7 @@ { "name": "@stacksjs/hello-world-elements", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Your framework agnostic web component library description.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/libs/functions/package.json b/storage/framework/libs/functions/package.json index 1f62f83ce7..d5d24e087d 100644 --- a/storage/framework/libs/functions/package.json +++ b/storage/framework/libs/functions/package.json @@ -1,7 +1,7 @@ { "name": "hello-world-fx", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Your function library description.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/orm/package.json b/storage/framework/orm/package.json index cd1adeb5e2..ec6353804f 100644 --- a/storage/framework/orm/package.json +++ b/storage/framework/orm/package.json @@ -1,7 +1,7 @@ { "name": "stacks-orm", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "Your custom ORM.", "author": "Chris Breuer", "contributors": ["Chris Breuer "], diff --git a/storage/framework/package.json b/storage/framework/package.json index ae373d6c24..d38c62bcec 100644 --- a/storage/framework/package.json +++ b/storage/framework/package.json @@ -1,7 +1,7 @@ { "name": "stacks-framework", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "private": true, "description": "The Stacks framework.", "author": "Chris Breuer", diff --git a/storage/framework/server/package.json b/storage/framework/server/package.json index af2c59d76f..4d19f89161 100644 --- a/storage/framework/server/package.json +++ b/storage/framework/server/package.json @@ -1,7 +1,7 @@ { "name": "stacks-server", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks server.", "author": "Chris Breuer", "license": "MIT", diff --git a/storage/framework/views/dashboard/package.json b/storage/framework/views/dashboard/package.json index c91531e9d6..e086907765 100644 --- a/storage/framework/views/dashboard/package.json +++ b/storage/framework/views/dashboard/package.json @@ -1,7 +1,7 @@ { "name": "stacks-dashboard", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "private": "true", "description": "The Stacks Dashboard.", "author": "Chris Breuer", diff --git a/storage/framework/views/desktop/package.json b/storage/framework/views/desktop/package.json index 1049c28648..ec135e1f8e 100644 --- a/storage/framework/views/desktop/package.json +++ b/storage/framework/views/desktop/package.json @@ -1,7 +1,7 @@ { "name": "stacks-desktop", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "private": "true", "description": "The Stacks Dashboard.", "author": "Chris Breuer", diff --git a/storage/framework/views/system-tray/package.json b/storage/framework/views/system-tray/package.json index 0c9b495b02..0220371643 100644 --- a/storage/framework/views/system-tray/package.json +++ b/storage/framework/views/system-tray/package.json @@ -1,7 +1,7 @@ { "name": "stacks-system-tray", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "description": "The Stacks System Tray app.", "author": "Chris Breuer", "license": "MIT", diff --git a/storage/framework/views/web/package.json b/storage/framework/views/web/package.json index e276a6e05f..1cda06e7bf 100644 --- a/storage/framework/views/web/package.json +++ b/storage/framework/views/web/package.json @@ -1,7 +1,7 @@ { "name": "stacks-web", "type": "module", - "version": "0.70.22", + "version": "0.70.23", "private": true, "scripts": { "build": "bun --bun vite-ssg build -c ../../core/vite-config/src/views.ts",