Open
Conversation
This is to estimate prices for warehouse. Adds POST /api/shipping-rates endpoint that allows ambassadors to get Canada Post shipping rate quotes by providing destination address, package type (envelope/box), dimensions (inches), and weight (grams).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ctions CI pipeline
…ubble packet with 0.5in thickness
- Warehouse: stripped admin controls from items/orders pages, now read-only for ambassadors and admins - Warehouse-Backend: new admin-only route with full CRUD for items, orders, categories, and tags
'Chit Chats U.S. Select' and similar service names were falling through to DOM.RP (domestic), causing Canada Post to reject US shipments. Now catches 'u.s.' and 'usa' → USA.TP, and 'international' → INT.TP before the domestic default.
…Post) at fulfillment time Save estimatedServiceCode from the rate selection during order creation. The get-label auto logic now detects CHITCHATS.* service codes and routes to Chit Chats instead of always falling through to Canada Post.
Add stock validation before decrementing inventory in manual order creation and batch processing. Returns a 400 error with a descriptive message if insufficient quantity is available.
- Create /server/hcb.ts with OAuth token refresh and transfer API - Charge ambassador's pathway org on order placement via HCB v4 transfers - Map pathway enums to HCB org IDs (Python, General Coding, Game Dev, etc.) - Auto-refresh access token every 30 min using OAuth refresh_token grant - Add HCB_CLIENT_ID, HCB_CLIENT_SECRET, HCB_ACCESS_TOKEN, HCB_REFRESH_TOKEN env vars
- Strip non-digit chars from hsCode for Canada Post XML (9505.10.2500 -> 9505102500) - Pass province/stateProvince through to fetchChitChatsRates to fix invalid province_code errors
9505.10.2500 -> 9505.10.25.00 (proper dotted format per Canada Post schema)
- address-line-1/2: 44 chars, with overflow from line-1 into line-2 - name: 44 chars, city: 40 chars, prov-state: 20 chars, phone: 25 chars - sku: 15 chars, customs-description: 45 chars
…e versa) INT.TP (Tracked Packet) isn't available for all countries (e.g. CZ). Now automatically retries with Xpresspost International as fallback.
Adds resolveStateCode() for US states and CA provinces (e.g. California -> CA). Applied when creating orders from CSV batches and calculating shipping rates.
- Resolve full state names (e.g. California -> CA) in createShipment XML so existing orders with full names in DB are handled - Only fall back to INT.XP when CP_CONTRACT_ID is set (it requires a contract) - Include error details in 502 response
…shipments Countries like CZ and EG aren't supported by INT.TP. When Canada Post fails for non-CA destinations, automatically try Chit Chats if configured.
- Add INT.SP.AIR, INT.IP, INT.IP.SURF as fallbacks for international shipments - Stop forcing INT.SP.AIR/INT.SP.SURF to INT.TP when no contract - Add International Parcel Air/Surface service code mappings
…hipping rates, add items to rate schema
Collaborator
Author
|
P.S. DO NOT MERGE YET, I NEED TO ADD ENV VARS. |
# Conflicts: # .github/workflows/ci.yml # resolution-frontend/Dockerfile # resolution-frontend/drizzle/meta/0002_snapshot.json # resolution-frontend/drizzle/meta/_journal.json # resolution-frontend/package-lock.json # resolution-frontend/package.json # resolution-frontend/src/lib/server/db/schema.ts # resolution-frontend/src/lib/server/validation/schemas.test.ts # resolution-frontend/src/lib/server/validation/schemas.ts # resolution-frontend/src/routes/app/+page.svelte # resolution-frontend/src/routes/app/admin/+page.svelte
- Add requireAuth() to /api/qz/sign and /api/qz/cert so only authenticated users can sign data or fetch the certificate. - Add admin/ambassador role check to /api/fulfillment/get-label so arbitrary authenticated users cannot create shipments or generate shipping labels.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a complete warehouse management system to Resolution, allowing ambassadors to place orders for physical inventory and admins to fulfill them with integrated multi-carrier shipping label generation.
Features
Warehouse Storefront (Ambassadors - /app/warehouse)
Browse inventory items grouped by category
Multi-step order wizard with address entry, item selection, and real-time shipping rate comparison
Order templates for quick reordering
Batch ordering via CSV upload with auto-field-mapping and a linked Google Sheets template
Tag input with chips and autocomplete for order filtering
Orders and batches scoped to the logged-in user
Warehouse Backend (Admins - /app/warehouse-backend)
Full CRUD for inventory categories and items (photo uploads via Hack Club CDN, dimensions, HS codes, sizing options)
Inventory tracking with automatic quantity subtraction on order placement (prevents negative stock)
Fulfillment panel with label generation, printing, and reprint support
Shipping Integration
Canada Post — contract and non-contract shipment support, state/province → 2-letter code resolution, country name → ISO code mapping, 8.5×11 → 4×6 label cropping
Chit Chats — rate quoting and shipment creation with HTS codes and manufacturer details; automatic fallback when Canada Post fails internationally
Theseus — lettermail label support
Zonos — landed cost integration for US-bound shipments
Cheapest-rate auto-selection across all carriers for batch shipping
Flat package type with envelope size snapping (4×6 / 6×9)
Printing
QZ Tray integration for direct thermal label printing (4×6)
Combined label + packing slip print button
Reprint support for previously generated labels
Billing
HCB (Hack Club Bank) billing integration for warehouse orders
Infrastructure
4 new Drizzle migrations (orders, templates/batches, label tracking, HS codes)
drizzle-kit push at container startup for auto-migrations
entrypoint.sh for container orchestration
removeAdmin.mjs CLI script
Staging mode to bypass OAuth for local/staging testing
Body size limit increased to 10MB for image uploads
UI
Phantom Sans font and clean white UI on warehouse, admin, and ambassador pages
Shipping cost estimate disclaimers on order and batch pages
Modified
Extended DB schema with warehouse orders, templates, batches, label/tracking fields
Updated admin page with warehouse backend link and inventory management
Updated validation schemas and tests for new order/item types
CI triggers on warehouse-dev branch
P.S. DO NOT MERGE YET, I NEED TO ADD ENV VARS.