From d6e2523adc449c6bad9bcd6eac8bd88b419cfdfb Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 21 Jan 2025 22:15:27 -0500 Subject: [PATCH] Remove unused files --- inventory-server/db/procedures.sql | 127 --------------------------- inventory-server/scripts/setup-db.js | 41 --------- inventory/public/vite.svg | 1 - inventory/src/assets/react.svg | 1 - inventory/src/routes/Forecasting.tsx | 92 ------------------- src/lib/utils.ts | 1 - 6 files changed, 263 deletions(-) delete mode 100644 inventory-server/db/procedures.sql delete mode 100644 inventory-server/scripts/setup-db.js delete mode 100644 inventory/public/vite.svg delete mode 100644 inventory/src/assets/react.svg delete mode 100644 inventory/src/routes/Forecasting.tsx delete mode 100644 src/lib/utils.ts diff --git a/inventory-server/db/procedures.sql b/inventory-server/db/procedures.sql deleted file mode 100644 index 75e95af..0000000 --- a/inventory-server/db/procedures.sql +++ /dev/null @@ -1,127 +0,0 @@ -CREATE PROCEDURE import_product( - IN p_product_id BIGINT, - IN p_title VARCHAR(255), - IN p_SKU VARCHAR(50), - IN p_created_at TIMESTAMP, - IN p_stock_quantity INT, - IN p_price DECIMAL(10, 3), - IN p_regular_price DECIMAL(10, 3), - IN p_cost_price DECIMAL(10, 3), - IN p_landing_cost_price DECIMAL(10, 3), - IN p_barcode VARCHAR(50), - IN p_updated_at TIMESTAMP, - IN p_visible BOOLEAN, - IN p_managing_stock BOOLEAN, - IN p_replenishable BOOLEAN, - IN p_vendor VARCHAR(100), - IN p_vendor_reference VARCHAR(100), - IN p_permalink VARCHAR(255), - IN p_categories TEXT, - IN p_image VARCHAR(255), - IN p_brand VARCHAR(100), - IN p_options TEXT, - IN p_tags TEXT, - IN p_moq INT, - IN p_uom INT -) -BEGIN - INSERT INTO products - VALUES ( - p_product_id, p_title, p_SKU, p_created_at, p_stock_quantity, - p_price, p_regular_price, p_cost_price, p_landing_cost_price, - p_barcode, p_updated_at, p_visible, p_managing_stock, - p_replenishable, p_vendor, p_vendor_reference, p_permalink, - p_categories, p_image, p_brand, p_options, p_tags, p_moq, p_uom - ) - ON DUPLICATE KEY UPDATE - title = p_title, - stock_quantity = p_stock_quantity, - price = p_price, - regular_price = p_regular_price, - cost_price = p_cost_price, - landing_cost_price = p_landing_cost_price, - barcode = p_barcode, - updated_at = p_updated_at, - visible = p_visible, - managing_stock = p_managing_stock, - replenishable = p_replenishable, - vendor = p_vendor, - vendor_reference = p_vendor_reference, - permalink = p_permalink, - categories = p_categories, - image = p_image, - brand = p_brand, - options = p_options, - tags = p_tags, - moq = p_moq, - uom = p_uom; -END; - -CREATE PROCEDURE import_order( - IN p_order_number VARCHAR(50), - IN p_product_id BIGINT, - IN p_SKU VARCHAR(50), - IN p_date DATE, - IN p_price DECIMAL(10, 3), - IN p_quantity INT, - IN p_discount DECIMAL(10, 3), - IN p_tax DECIMAL(10, 3), - IN p_tax_included BOOLEAN, - IN p_shipping DECIMAL(10, 3), - IN p_customer VARCHAR(50), - IN p_canceled BOOLEAN -) -BEGIN - INSERT INTO orders ( - order_number, product_id, SKU, date, price, quantity, - discount, tax, tax_included, shipping, customer, canceled - ) - VALUES ( - p_order_number, p_product_id, p_SKU, p_date, p_price, - p_quantity, p_discount, p_tax, p_tax_included, p_shipping, - p_customer, p_canceled - ) - ON DUPLICATE KEY UPDATE - price = p_price, - quantity = p_quantity, - discount = p_discount, - tax = p_tax, - tax_included = p_tax_included, - shipping = p_shipping, - canceled = p_canceled; -END; - -CREATE PROCEDURE import_purchase_order( - IN p_po_id VARCHAR(50), - IN p_vendor VARCHAR(100), - IN p_date DATE, - IN p_expected_date DATE, - IN p_product_id BIGINT, - IN p_sku VARCHAR(50), - IN p_cost_price DECIMAL(10, 3), - IN p_status VARCHAR(20), - IN p_notes TEXT, - IN p_ordered INT, - IN p_received INT, - IN p_received_date DATE -) -BEGIN - INSERT INTO purchase_orders ( - po_id, vendor, date, expected_date, product_id, sku, - cost_price, status, notes, ordered, received, received_date - ) - VALUES ( - p_po_id, p_vendor, p_date, p_expected_date, p_product_id, - p_sku, p_cost_price, p_status, p_notes, p_ordered, - p_received, p_received_date - ) - ON DUPLICATE KEY UPDATE - vendor = p_vendor, - expected_date = p_expected_date, - cost_price = p_cost_price, - status = p_status, - notes = p_notes, - ordered = p_ordered, - received = p_received, - received_date = p_received_date; -END; \ No newline at end of file diff --git a/inventory-server/scripts/setup-db.js b/inventory-server/scripts/setup-db.js deleted file mode 100644 index 6b1c980..0000000 --- a/inventory-server/scripts/setup-db.js +++ /dev/null @@ -1,41 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -const mysql = require('mysql2/promise'); -const dotenv = require('dotenv'); - -dotenv.config({ path: path.join(__dirname, '../.env') }); - -const dbConfig = { - host: process.env.DB_HOST, - user: process.env.DB_USER, - password: process.env.DB_PASSWORD, - database: process.env.DB_NAME, - multipleStatements: true -}; - -async function setupDatabase() { - const connection = await mysql.createConnection(dbConfig); - - try { - // Create tables - console.log('Setting up database schema...'); - const schemaSQL = fs.readFileSync(path.join(__dirname, '../db/schema.sql'), 'utf8'); - await connection.query(schemaSQL); - console.log('Schema created successfully'); - - // Create stored procedures - // console.log('Setting up stored procedures...'); - // const proceduresSQL = fs.readFileSync(path.join(__dirname, '../db/procedures.sql'), 'utf8'); - // await connection.query(proceduresSQL); - // console.log('Stored procedures created successfully'); - - console.log('Database setup completed successfully'); - } catch (error) { - console.error('Error setting up database:', error); - process.exit(1); - } finally { - await connection.end(); - } -} - -setupDatabase(); \ No newline at end of file diff --git a/inventory/public/vite.svg b/inventory/public/vite.svg deleted file mode 100644 index e7b8dfb..0000000 --- a/inventory/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/inventory/src/assets/react.svg b/inventory/src/assets/react.svg deleted file mode 100644 index 6c87de9..0000000 --- a/inventory/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/inventory/src/routes/Forecasting.tsx b/inventory/src/routes/Forecasting.tsx deleted file mode 100644 index 969fca5..0000000 --- a/inventory/src/routes/Forecasting.tsx +++ /dev/null @@ -1,92 +0,0 @@ -import { ScrollArea } from "@/components/ui/scroll-area"; -import { - Accordion, - AccordionContent, - AccordionItem, - AccordionTrigger, -} from "@/components/ui/accordion"; -import { useQuery } from "@tanstack/react-query"; -import config from "@/config"; - -interface Product { - product_id: string; - name: string; - sku: string; - stock_quantity: number; - total_sold: number; - avg_price: number; -} - -interface CategoryMetrics { - category_id: string; - category_name: string; - brand: string; - num_products: number; - avg_daily_sales: number; - total_sold: number; - avgTotalSold: number; - avg_price: number; - products: string; // This is a JSON string that will be parsed -} - -export default function Forecasting() { - const { data, isLoading } = useQuery({ - queryKey: ["forecasting"], - queryFn: async () => { - const response = await fetch(`${config.apiUrl}/analytics/forecasting`, { - credentials: 'include' - }); - if (!response.ok) throw new Error("Failed to fetch forecasting data"); - return response.json(); - }, - }); - - if (isLoading) { - return
Loading forecasting data...
; - } - - return ( -
- {data && ( - - - {data.map((category: CategoryMetrics) => ( - - -
-
{category.category_name}
-
{category.num_products}
-
{category.avg_daily_sales.toFixed(2)}
-
{category.total_sold}
-
${category.avg_price.toFixed(2)}
-
{category.avgTotalSold.toFixed(2)}
-
-
- -
-
-
Product
-
SKU
-
Stock
-
Total Sold
-
Avg Price
-
- {JSON.parse(category.products).map((product: Product) => ( -
-
{product.name}
-
{product.sku}
-
{product.stock_quantity}
-
{product.total_sold}
-
${product.avg_price.toFixed(2)}
-
- ))} -
-
-
- ))} -
-
- )} -
- ); -} \ No newline at end of file diff --git a/src/lib/utils.ts b/src/lib/utils.ts deleted file mode 100644 index 0519ecb..0000000 --- a/src/lib/utils.ts +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file