Backend (Convex)
API — orderHistory
Generated catalog of Convex functions in convex/orderHistory/. Regenerated by `bun run docs:api`.
Auto-generated from source. Do not edit by hand — run
bun run docs:api.
query (11)
| Function | Description | Args |
|---|---|---|
dashboardGetCustomerOrders | Get orders for a specific customer (admin) | { userId: v.string(), limit: v.optional(v.number()), offset: v.optional(v.number()), } |
dashboardGetOrderById | — | { // v.string, not v.id: the users page links here with Shopify order ids and // the stamp history with whatever stampHistory.orderId holds. A validator // t… |
dashboardGetOrderFacets | Counts for the Orders page header and its channel tabs. Reads no orders at all. The counts come from the ordersByChannel aggregate, which is O(log n) per channel and is maintained on every order write. Splitting this off the list query is what let the list paginate: these counters were the only reason the list query had to see every order. | { dateFrom: v.optional(v.number()), dateTo: v.optional(v.number()), salesChannel: v.optional(v.string()), } |
dashboardGetOrdersWithGamification | Get all orders with gamification processing data (dashboard) Returns orders enriched with stamp awards for monitoring | { paginationOpts: paginationOptsValidator, processingStatus: processingStatusValidator, // Why orders did or did not earn stamps, e.g. below_min_spend. Fil… |
dashboardSearchLinkableUsers | Accounts an admin may link an order to, for the order page's link action. Runs the dashboard user search, then keeps only accounts that verified an email or phone, the rule dashboardLinkOrderToUser enforces. Each result carries the contacts the account proved (not the free-text profile fields) and whether one of them is this order's buyer contact. | { orderId: v.id("orders"), query: v.string(), } |
dashboardSearchOrdersWithGamification | The Orders page search: every match in one list, with the loyalty join. A plain query rather than a search branch of the paginated one, because usePaginatedQuery keeps only page and would drop capped. Its hits come from a search index ranked by relevance and from the orders of the users the term names, and neither has a cursor that walks processedAt, so there is no next page to load. capped is how the page knows the list may be missing matches; the row count cannot tell it. | { search: v.string(), processingStatus: processingStatusValidator, // Why orders did or did not earn stamps, e.g. below_min_spend. Filters // the loaded pa… |
mobileGetOrderById | Get order by ID for current user Returns order with line items | { // v.string (not v.id) — malformed ids arrive via deep links; a validator // throw here crashes the client render. normalizeId + null keeps it a // structu… |
mobileGetOrderByShopifyId | Get order by Shopify order ID | { shopifyOrderId: v.string(), } |
mobileGetOrderStats | Get order statistics for current user | {} |
mobileGetRecentOrders | Get recent orders for current user | { limit: v.optional(v.number()), } |
mobileGetUserOrders | Get current user's order history with pagination Supports filtering by status, date range, and amount Supports sorting by date or amount | { limit: v.optional(v.number()), offset: v.optional(v.number()), sortBy: v.optional(v.union( v.literal("CREATED_AT_DESC"), v.literal("CREATED_AT_ASC"), v.lit… |
mutation (4)
| Function | Description | Args |
|---|---|---|
dashboardLinkOrderToUser | Link an order to a customer by hand (admin). The automatic paths link only the account that verified the buyer's email or phone. This one exists for the cases they cannot see (the customer checked out with another email), so it does not require that match, but the target must have verified at least one contact. An account with no verified contact proves nothing about who owns it. The audit row records whether the order's buyer contact matched. | { orderId: v.id("orders"), userId: v.string(), } |
dashboardUpdateOrderStatus | Manually update order status (admin) | { orderId: v.id("orders"), financialStatus: v.optional(v.string()), fulfillmentStatus: v.optional(v.string()), } |
mobileMarkOrderReceived | Mark a shipped order as received (buyer-confirmed delivery). The app has no automatic delivery signal (merchant ships DHL eCommerce with a manually-entered tracking number), so the buyer taps "Mark as received" once the parcel arrives. This sets receivedAt, which getOrderStatus reads to show an HONEST "Delivered". Idempotent; only valid once the order has shipped. | { orderId: v.id("orders") } |
reorderFromOrder | Reorder items from a previous order Adds available items to the user's cart Returns list of unavailable items | { orderId: v.id("orders"), } |
internalQuery (1)
| Function | Description | Args |
|---|---|---|
diagnoseOrderLinkingInternal | Diagnose order-user linking issues Shows orders with non-Better Auth userIds (orphaned orders) | { limit: v.optional(v.number()), } |