Demo: a static copy of one review, without the review service. Reviewed marks apply in this tab until it reloads, and view settings stay in this browser. Comments, decisions, and publication need an installed mcp-review. About mcp-review · Get early access
Change request saved in this viewer
This review has no pull request, so the decision stays in this viewer.
An agent sees the decision only while it watches this review. If the agent is not answering in chat, ask it there: Continue the mcp-review at /demo-xxl
This review is archived. It stays readable at this address, and its discussions and pending work continue.
Move the storefront API to typed handlers
Every endpoint of the storefront API moves from an Express callback to a typed handler, so validation, access checks, errors and logging happen in one pipeline instead of in 224 copies.
What changes
A new pipeline in src/http/ matches the route, checks access, validates the path, query and body against a schema, runs the handler, and writes one JSON answer.
Each of the 32 resources gets its schemas in src/schemas/, and its 7 handlers move to the new form.
The handler tests move from Mocha and supertest to node:test against the handlers themselves.
The tax rate table moves into the repository, so checkout no longer calls the finance service for each order.
The scheduled jobs import the shared @storefront/logger package. That change is mechanical.
Read Typed request pipeline first: every other section depends on it. The handler sections repeat one pattern per resource, so a few files of each show it; the tests and the API reference follow the handlers.
Coverage
Presentation
All 1051 selected changes are placed.1050 in groups · 0 unbucketed · 1 generated · 0 without a text diff
Explanations
8 of 8 groups have an explanation.
Agent analysis
Reading the analysis status…
Human review
0 of 1051 hunks are marked reviewed.
Outdated discussions 0
These discussions have no verified location in the displayed changes. Each keeps its original code and stays open to replies and resolution.
Typed request pipeline
The pipeline is the reason for this change. A handler now declares its method, path, access and schemas, and runHandler does the rest in a fixed order.
Order of the checks
Access: a user or admin endpoint without a session answers 401, and a non-admin on an admin endpoint 403.
Validation: the path, the query and the body each pass their schema, or the answer is 422 with the problems.
The handler runs. An HttpError becomes its status and code; any other error becomes a 500 that quotes the request ID.
What to check
readJson caps the body at 1 MiB and answers 413 above it.
A 204 answer writes no body.
app.ts keeps listen, so the deployment does not change.
src/handlers/index.ts replaces the Express route table and lists each literal path before the path with a parameter.
docs/handlers.md
+23-0
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
After, lines 1–23.
Typed handlers
Every endpoint of the storefront API is a typed handler. A handler names its method, its path, who may call it, and the schemas of its path, query and body. The pipeline does everything else.
After: the complete diagram, lines 5–15. Changed lines 5–15. The diagram marks no changed element, because the other version has no file; the source diff shows the exact lines.
Add the schemas of the request to src/schemas/<resource>.ts.
Export the handler from src/handlers/<resource>/<action>.ts with handler({ ... }).
Add it to src/handlers/index.ts.
Throw an HttpError for an answer that the caller can act on, such as a 404 or a 409. Any other error becomes a 500 with the request ID, and the log keeps the details.
Placing the discussions of this file for the layout of this page…
# Typed handlers
Every endpoint of the storefront API is a typed handler. A handler names its method, its path, who may call it, and the schemas of its path, query and body. The pipeline does everything else.
```mermaid
flowchart LR
Request[request] --> Router[router]
Router --> Access{access}
Access -- denied --> Error[JSON error]
Access -- allowed --> Validate{schemas}
Validate -- invalid --> Error
Validate -- valid --> Run[handler.run]
Run --> Answer[JSON answer]
Run -- HttpError --> Error
```
## Write a handler
1. Add the schemas of the request to `src/schemas/<resource>.ts`.
2. Export the handler from `src/handlers/<resource>/<action>.ts` with `handler({ ... })`.
3. Add it to `src/handlers/index.ts`.
Throw an `HttpError` for an answer that the caller can act on, such as a 404 or a 409. Any other error becomes a 500 with the request ID, and the log keeps the details.
src/app.ts
+16-11
Difftastic 0.69.0 · TypeScript: changed syntax is marked
Placing the discussions of this file for the layout of this page…
/** A typed handler: the pipeline validates the path, query and body against its schemas, checks its access, and turns a thrown HttpError into a JSON error. */
The handlers of products, categories, brands, prices, stock levels, reviews, collections and media move to the typed form.
Each file keeps its toResponse shape, so the JSON of every answer stays the same. The behaviour changes in three ways:
A create with an existing key, such as a product SKU or a category slug, answers 409 instead of a database error.
Delete needs an admin. Before, any signed-in user could delete.
List and search take their limits from the schema, so a limit over 100 is a 422 instead of being cut silently.
src/catalog/categoryMappings.ts keys every category by the external ID of the new catalog import instead of its legacy code. Each entry changes only that field.
src/catalog/categoryMappings.ts
+240-240
Line diff: Difftastic could not parse this file and compared it as text. Word comparison marks the changed words of replaced lines.
Placing the discussions of this file for the layout of this page…
if (req.body.sku!==undefined) changes.sku=req.body.sku;constupdated=awaitdb.inventory.update(params.id, { ...body, updated_by: user.id });
if (req.body.warehouseId!==undefined) changes.warehouseId=req.body.warehouseId;if (!updated) thrownewHttpError(404, 'not_found', 'StockLevel not found');
if (req.body.onHand!==undefined) changes.onHand=req.body.onHand;log.info('StockLevel updated', { id: updated.id, fields: Object.keys(body) });
if (req.body.reserved!==undefined) changes.reserved=req.body.reserved;return { status: 200, body: toResponse(updated) };
db.inventory.update(row.id,changes, function (err, updated) { },
The handlers of carts, orders, payments, refunds, shipments, invoices, coupons and returns move to the typed form, with the same three behaviour changes as the catalog.
src/tax/rates.ts holds the tax rate of each region and category for each financial year. Checkout read it from the finance service for every order; now the table ships with the API and finance updates it once a year. Its rows are data: check the shape and taxRate, not each rate.
src/handlers/carts/create.ts
+15-29
Difftastic 0.69.0 · TypeScript: changed syntax is marked
Placing the discussions of this file for the layout of this page…
// Carts: create one record.// Carts: create one record.
'use strict';import { db } from'../../db';
import { HttpError } from'../../http/errors';
const { db } =require('../../db');import { handler } from'../../http/handler';
if (req.body.code!==undefined) changes.code=req.body.code;constupdated=awaitdb.giftCards.update(params.id, { ...body, updated_by: user.id });
if (req.body.balanceCents!==undefined) changes.balanceCents=req.body.balanceCents;if (!updated) thrownewHttpError(404, 'not_found', 'GiftCard not found');
if (req.body.currency!==undefined) changes.currency=req.body.currency;log.info('GiftCard updated', { id: updated.id, fields: Object.keys(body) });
Each reference page gets a table of its endpoints with their access and validation, and the new error shape.
docs/api/addresses.md
+18-16
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Address API
The addresses routes live in src/handlers/addresses/. Each file exports an Express callback.
GET /addresses
GET /addresses/:id
POST /addresses
PATCH /addresses/:id
DELETE /addresses/:id
GET /addresses/search
GET /addresses/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Address API
The addresses endpoints live in src/handlers/addresses/. Each file exports one typed handler, and src/schemas/addresses.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/addresses
public
List query: limit (1–100, default 20), cursor
GET
/addresses/:id
public
Path: id (UUID)
POST
/addresses
user
Body: customerId, line1, city, postcode, country
PATCH
/addresses/:id
user
Body: any of the create fields, at least one
DELETE
/addresses/:id
admin
Path: id (UUID)
GET
/addresses/search
public
Query: q (2–100 characters), limit (1–50)
GET
/addresses/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–24.
Fields
customerId
line1
city
postcode
country
Changes
After, lines 17–26.
Fields
customerId: z.string().uuid()
line1: z.string().min(1).max(200)
city: z.string().min(1).max(120)
postcode: z.string().max(16)
country: z.string().length(2)
Changes
Placing the discussions of this file for the layout of this page…
# Address API# Address API
The addresses routes live in `src/handlers/addresses/`. Each file exports an Express callback.The addresses endpoints live in `src/handlers/addresses/`. Each file exports one typed handler, and `src/schemas/addresses.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /addresses/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /addresses/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The addresses routes live in `src/handlers/addresses/`. Each file exports an Express callback.
- `GET /addresses`
- `GET /addresses/:id`
- `POST /addresses`
- `PATCH /addresses/:id`
- `DELETE /addresses/:id`
- `GET /addresses/search`
- `GET /addresses/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The addresses endpoints live in `src/handlers/addresses/`. Each file exports one typed handler, and `src/schemas/addresses.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /addresses | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /addresses/:id | public | Path: `id` (UUID) |
| POST | /addresses | user | Body: `customerId`, `line1`, `city`, `postcode`, `country` |
| PATCH | /addresses/:id | user | Body: any of the create fields, at least one |
| GET | /addresses/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
| GET | /addresses/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
## Fields## Fields
- `customerId`- `customerId`: `z.string().uuid()`
- `line1`- `line1`: `z.string().min(1).max(200)`
- `city`- `city`: `z.string().min(1).max(120)`
- `postcode`- `postcode`: `z.string().max(16)`
- `country`- `country`: `z.string().length(2)`
- `customerId`
- `line1`
- `city`
- `postcode`
- `country`
- `customerId`: `z.string().uuid()`
- `line1`: `z.string().min(1).max(200)`
- `city`: `z.string().min(1).max(120)`
- `postcode`: `z.string().max(16)`
- `country`: `z.string().length(2)`
## Changes## Changes
docs/api/apiKeys.md
+16-14
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
ApiKey API
The apiKeys routes live in src/handlers/apiKeys/. Each file exports an Express callback.
GET /apiKeys
GET /apiKeys/:id
POST /apiKeys
PATCH /apiKeys/:id
DELETE /apiKeys/:id
GET /apiKeys/search
GET /apiKeys/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
ApiKey API
The apiKeys endpoints live in src/handlers/apiKeys/. Each file exports one typed handler, and src/schemas/apiKeys.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/apiKeys
public
List query: limit (1–100, default 20), cursor
GET
/apiKeys/:id
public
Path: id (UUID)
POST
/apiKeys
user
Body: teamId, label, scopes
PATCH
/apiKeys/:id
user
Body: any of the create fields, at least one
DELETE
/apiKeys/:id
admin
Path: id (UUID)
GET
/apiKeys/search
public
Query: q (2–100 characters), limit (1–50)
GET
/apiKeys/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
teamId
label
scopes
Changes
After, lines 17–24.
Fields
teamId: z.string().uuid()
label: z.string().min(1).max(80)
scopes: z.array(z.enum(['read', 'write'])).min(1)
Changes
Placing the discussions of this file for the layout of this page…
# ApiKey API# ApiKey API
The apiKeys routes live in `src/handlers/apiKeys/`. Each file exports an Express callback.The apiKeys endpoints live in `src/handlers/apiKeys/`. Each file exports one typed handler, and `src/schemas/apiKeys.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /apiKeys/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /apiKeys/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The apiKeys routes live in `src/handlers/apiKeys/`. Each file exports an Express callback.
- `GET /apiKeys`
- `GET /apiKeys/:id`
- `POST /apiKeys`
- `PATCH /apiKeys/:id`
- `DELETE /apiKeys/:id`
- `GET /apiKeys/search`
- `GET /apiKeys/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The apiKeys endpoints live in `src/handlers/apiKeys/`. Each file exports one typed handler, and `src/schemas/apiKeys.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /apiKeys | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /apiKeys/:id | public | Path: `id` (UUID) |
| POST | /apiKeys | user | Body: `teamId`, `label`, `scopes` |
| PATCH | /apiKeys/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Attribute API
The attributes routes live in src/handlers/attributes/. Each file exports an Express callback.
GET /attributes
GET /attributes/:id
POST /attributes
PATCH /attributes/:id
DELETE /attributes/:id
GET /attributes/search
GET /attributes/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Attribute API
The attributes endpoints live in src/handlers/attributes/. Each file exports one typed handler, and src/schemas/attributes.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/attributes
public
List query: limit (1–100, default 20), cursor
GET
/attributes/:id
public
Path: id (UUID)
POST
/attributes
user
Body: code, label, kind
PATCH
/attributes/:id
user
Body: any of the create fields, at least one
DELETE
/attributes/:id
admin
Path: id (UUID)
GET
/attributes/search
public
Query: q (2–100 characters), limit (1–50)
GET
/attributes/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
code
label
kind
Changes
After, lines 17–24.
Fields
code: z.string().regex(/^[a-z_]+$/)
label: z.string().min(1).max(80)
kind: z.enum(['text', 'number', 'colour'])
Changes
Placing the discussions of this file for the layout of this page…
# Attribute API# Attribute API
The attributes routes live in `src/handlers/attributes/`. Each file exports an Express callback.The attributes endpoints live in `src/handlers/attributes/`. Each file exports one typed handler, and `src/schemas/attributes.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /attributes/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /attributes/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The attributes routes live in `src/handlers/attributes/`. Each file exports an Express callback.
- `GET /attributes`
- `GET /attributes/:id`
- `POST /attributes`
- `PATCH /attributes/:id`
- `DELETE /attributes/:id`
- `GET /attributes/search`
- `GET /attributes/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The attributes endpoints live in `src/handlers/attributes/`. Each file exports one typed handler, and `src/schemas/attributes.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /attributes | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /attributes/:id | public | Path: `id` (UUID) |
| POST | /attributes | user | Body: `code`, `label`, `kind` |
| PATCH | /attributes/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Brand API
The brands routes live in src/handlers/brands/. Each file exports an Express callback.
GET /brands
GET /brands/:id
POST /brands
PATCH /brands/:id
DELETE /brands/:id
GET /brands/search
GET /brands/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Brand API
The brands endpoints live in src/handlers/brands/. Each file exports one typed handler, and src/schemas/brands.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/brands
public
List query: limit (1–100, default 20), cursor
GET
/brands/:id
public
Path: id (UUID)
POST
/brands
user
Body: slug, name, website
PATCH
/brands/:id
user
Body: any of the create fields, at least one
DELETE
/brands/:id
admin
Path: id (UUID)
GET
/brands/search
public
Query: q (2–100 characters), limit (1–50)
GET
/brands/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
slug
name
website
Changes
After, lines 17–24.
Fields
slug: z.string().regex(/^[a-z0-9-]+$/)
name: z.string().min(1).max(120)
website: z.string().url().nullable()
Changes
Placing the discussions of this file for the layout of this page…
# Brand API# Brand API
The brands routes live in `src/handlers/brands/`. Each file exports an Express callback.The brands endpoints live in `src/handlers/brands/`. Each file exports one typed handler, and `src/schemas/brands.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /brands/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /brands/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The brands routes live in `src/handlers/brands/`. Each file exports an Express callback.
- `GET /brands`
- `GET /brands/:id`
- `POST /brands`
- `PATCH /brands/:id`
- `DELETE /brands/:id`
- `GET /brands/search`
- `GET /brands/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The brands endpoints live in `src/handlers/brands/`. Each file exports one typed handler, and `src/schemas/brands.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /brands | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /brands/:id | public | Path: `id` (UUID) |
| POST | /brands | user | Body: `slug`, `name`, `website` |
| PATCH | /brands/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Bundle API
The bundles routes live in src/handlers/bundles/. Each file exports an Express callback.
GET /bundles
GET /bundles/:id
POST /bundles
PATCH /bundles/:id
DELETE /bundles/:id
GET /bundles/search
GET /bundles/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Bundle API
The bundles endpoints live in src/handlers/bundles/. Each file exports one typed handler, and src/schemas/bundles.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/bundles
public
List query: limit (1–100, default 20), cursor
GET
/bundles/:id
public
Path: id (UUID)
POST
/bundles
user
Body: sku, productIds, discountPercent
PATCH
/bundles/:id
user
Body: any of the create fields, at least one
DELETE
/bundles/:id
admin
Path: id (UUID)
GET
/bundles/search
public
Query: q (2–100 characters), limit (1–50)
GET
/bundles/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Placing the discussions of this file for the layout of this page…
# Bundle API# Bundle API
The bundles routes live in `src/handlers/bundles/`. Each file exports an Express callback.The bundles endpoints live in `src/handlers/bundles/`. Each file exports one typed handler, and `src/schemas/bundles.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /bundles/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /bundles/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The bundles routes live in `src/handlers/bundles/`. Each file exports an Express callback.
- `GET /bundles`
- `GET /bundles/:id`
- `POST /bundles`
- `PATCH /bundles/:id`
- `DELETE /bundles/:id`
- `GET /bundles/search`
- `GET /bundles/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The bundles endpoints live in `src/handlers/bundles/`. Each file exports one typed handler, and `src/schemas/bundles.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /bundles | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /bundles/:id | public | Path: `id` (UUID) |
| POST | /bundles | user | Body: `sku`, `productIds`, `discountPercent` |
| PATCH | /bundles/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Cart API
The carts routes live in src/handlers/carts/. Each file exports an Express callback.
GET /carts
GET /carts/:id
POST /carts
PATCH /carts/:id
DELETE /carts/:id
GET /carts/search
GET /carts/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Cart API
The carts endpoints live in src/handlers/carts/. Each file exports one typed handler, and src/schemas/carts.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/carts
public
List query: limit (1–100, default 20), cursor
GET
/carts/:id
public
Path: id (UUID)
POST
/carts
user
Body: customerId, currency, lines
PATCH
/carts/:id
user
Body: any of the create fields, at least one
DELETE
/carts/:id
admin
Path: id (UUID)
GET
/carts/search
public
Query: q (2–100 characters), limit (1–50)
GET
/carts/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
customerId
currency
lines
Changes
After, lines 17–24.
Fields
customerId: z.string().uuid().nullable()
currency: z.string().length(3)
lines: z.array(CartLine).max(100)
Changes
Placing the discussions of this file for the layout of this page…
# Cart API# Cart API
The carts routes live in `src/handlers/carts/`. Each file exports an Express callback.The carts endpoints live in `src/handlers/carts/`. Each file exports one typed handler, and `src/schemas/carts.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /carts/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /carts/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The carts routes live in `src/handlers/carts/`. Each file exports an Express callback.
- `GET /carts`
- `GET /carts/:id`
- `POST /carts`
- `PATCH /carts/:id`
- `DELETE /carts/:id`
- `GET /carts/search`
- `GET /carts/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The carts endpoints live in `src/handlers/carts/`. Each file exports one typed handler, and `src/schemas/carts.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /carts | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /carts/:id | public | Path: `id` (UUID) |
| POST | /carts | user | Body: `customerId`, `currency`, `lines` |
| PATCH | /carts/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Category API
The categories routes live in src/handlers/categories/. Each file exports an Express callback.
GET /categories
GET /categories/:id
POST /categories
PATCH /categories/:id
DELETE /categories/:id
GET /categories/search
GET /categories/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Category API
The categories endpoints live in src/handlers/categories/. Each file exports one typed handler, and src/schemas/categories.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/categories
public
List query: limit (1–100, default 20), cursor
GET
/categories/:id
public
Path: id (UUID)
POST
/categories
user
Body: slug, name, parentId, position
PATCH
/categories/:id
user
Body: any of the create fields, at least one
DELETE
/categories/:id
admin
Path: id (UUID)
GET
/categories/search
public
Query: q (2–100 characters), limit (1–50)
GET
/categories/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–23.
Fields
slug
name
parentId
position
Changes
After, lines 17–25.
Fields
slug: z.string().regex(/^[a-z0-9-]+$/)
name: z.string().min(1).max(120)
parentId: z.string().uuid().nullable()
position: z.number().int().min(0)
Changes
Placing the discussions of this file for the layout of this page…
# Category API# Category API
The categories routes live in `src/handlers/categories/`. Each file exports an Express callback.The categories endpoints live in `src/handlers/categories/`. Each file exports one typed handler, and `src/schemas/categories.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /categories/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /categories/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The categories routes live in `src/handlers/categories/`. Each file exports an Express callback.
- `GET /categories`
- `GET /categories/:id`
- `POST /categories`
- `PATCH /categories/:id`
- `DELETE /categories/:id`
- `GET /categories/search`
- `GET /categories/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The categories endpoints live in `src/handlers/categories/`. Each file exports one typed handler, and `src/schemas/categories.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /categories | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /categories/:id | public | Path: `id` (UUID) |
| POST | /categories | user | Body: `slug`, `name`, `parentId`, `position` |
| PATCH | /categories/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Collection API
The collections routes live in src/handlers/collections/. Each file exports an Express callback.
GET /collections
GET /collections/:id
POST /collections
PATCH /collections/:id
DELETE /collections/:id
GET /collections/search
GET /collections/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Collection API
The collections endpoints live in src/handlers/collections/. Each file exports one typed handler, and src/schemas/collections.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/collections
public
List query: limit (1–100, default 20), cursor
GET
/collections/:id
public
Path: id (UUID)
POST
/collections
user
Body: slug, title, productIds
PATCH
/collections/:id
user
Body: any of the create fields, at least one
DELETE
/collections/:id
admin
Path: id (UUID)
GET
/collections/search
public
Query: q (2–100 characters), limit (1–50)
GET
/collections/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
slug
title
productIds
Changes
After, lines 17–24.
Fields
slug: z.string().regex(/^[a-z0-9-]+$/)
title: z.string().min(1).max(160)
productIds: z.array(z.string().uuid()).max(500)
Changes
Placing the discussions of this file for the layout of this page…
# Collection API# Collection API
The collections routes live in `src/handlers/collections/`. Each file exports an Express callback.The collections endpoints live in `src/handlers/collections/`. Each file exports one typed handler, and `src/schemas/collections.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /collections/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /collections/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The collections routes live in `src/handlers/collections/`. Each file exports an Express callback.
- `GET /collections`
- `GET /collections/:id`
- `POST /collections`
- `PATCH /collections/:id`
- `DELETE /collections/:id`
- `GET /collections/search`
- `GET /collections/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The collections endpoints live in `src/handlers/collections/`. Each file exports one typed handler, and `src/schemas/collections.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /collections | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /collections/:id | public | Path: `id` (UUID) |
| POST | /collections | user | Body: `slug`, `title`, `productIds` |
| PATCH | /collections/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Consent API
The consents routes live in src/handlers/consents/. Each file exports an Express callback.
GET /consents
GET /consents/:id
POST /consents
PATCH /consents/:id
DELETE /consents/:id
GET /consents/search
GET /consents/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Consent API
The consents endpoints live in src/handlers/consents/. Each file exports one typed handler, and src/schemas/consents.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/consents
public
List query: limit (1–100, default 20), cursor
GET
/consents/:id
public
Path: id (UUID)
POST
/consents
user
Body: customerId, purpose, granted
PATCH
/consents/:id
user
Body: any of the create fields, at least one
DELETE
/consents/:id
admin
Path: id (UUID)
GET
/consents/search
public
Query: q (2–100 characters), limit (1–50)
GET
/consents/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Placing the discussions of this file for the layout of this page…
# Consent API# Consent API
The consents routes live in `src/handlers/consents/`. Each file exports an Express callback.The consents endpoints live in `src/handlers/consents/`. Each file exports one typed handler, and `src/schemas/consents.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /consents/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /consents/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The consents routes live in `src/handlers/consents/`. Each file exports an Express callback.
- `GET /consents`
- `GET /consents/:id`
- `POST /consents`
- `PATCH /consents/:id`
- `DELETE /consents/:id`
- `GET /consents/search`
- `GET /consents/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The consents endpoints live in `src/handlers/consents/`. Each file exports one typed handler, and `src/schemas/consents.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /consents | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /consents/:id | public | Path: `id` (UUID) |
| POST | /consents | user | Body: `customerId`, `purpose`, `granted` |
| PATCH | /consents/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Coupon API
The coupons routes live in src/handlers/coupons/. Each file exports an Express callback.
GET /coupons
GET /coupons/:id
POST /coupons
PATCH /coupons/:id
DELETE /coupons/:id
GET /coupons/search
GET /coupons/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Coupon API
The coupons endpoints live in src/handlers/coupons/. Each file exports one typed handler, and src/schemas/coupons.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/coupons
public
List query: limit (1–100, default 20), cursor
GET
/coupons/:id
public
Path: id (UUID)
POST
/coupons
user
Body: code, percentOff, expiresAt
PATCH
/coupons/:id
user
Body: any of the create fields, at least one
DELETE
/coupons/:id
admin
Path: id (UUID)
GET
/coupons/search
public
Query: q (2–100 characters), limit (1–50)
GET
/coupons/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
code
percentOff
expiresAt
Changes
After, lines 17–24.
Fields
code: z.string().regex(/^[A-Z0-9]{4,16}$/)
percentOff: z.number().int().min(1).max(90)
expiresAt: z.string().datetime().nullable()
Changes
Placing the discussions of this file for the layout of this page…
# Coupon API# Coupon API
The coupons routes live in `src/handlers/coupons/`. Each file exports an Express callback.The coupons endpoints live in `src/handlers/coupons/`. Each file exports one typed handler, and `src/schemas/coupons.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /coupons/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /coupons/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The coupons routes live in `src/handlers/coupons/`. Each file exports an Express callback.
- `GET /coupons`
- `GET /coupons/:id`
- `POST /coupons`
- `PATCH /coupons/:id`
- `DELETE /coupons/:id`
- `GET /coupons/search`
- `GET /coupons/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The coupons endpoints live in `src/handlers/coupons/`. Each file exports one typed handler, and `src/schemas/coupons.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /coupons | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /coupons/:id | public | Path: `id` (UUID) |
| POST | /coupons | user | Body: `code`, `percentOff`, `expiresAt` |
| PATCH | /coupons/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Customer API
The customers routes live in src/handlers/customers/. Each file exports an Express callback.
GET /customers
GET /customers/:id
POST /customers
PATCH /customers/:id
DELETE /customers/:id
GET /customers/search
GET /customers/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Customer API
The customers endpoints live in src/handlers/customers/. Each file exports one typed handler, and src/schemas/customers.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/customers
public
List query: limit (1–100, default 20), cursor
GET
/customers/:id
public
Path: id (UUID)
POST
/customers
user
Body: email, name, marketingOptIn
PATCH
/customers/:id
user
Body: any of the create fields, at least one
DELETE
/customers/:id
admin
Path: id (UUID)
GET
/customers/search
public
Query: q (2–100 characters), limit (1–50)
GET
/customers/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
email
name
marketingOptIn
Changes
After, lines 17–24.
Fields
email: z.string().email()
name: z.string().min(1).max(160)
marketingOptIn: z.boolean()
Changes
Placing the discussions of this file for the layout of this page…
# Customer API# Customer API
The customers routes live in `src/handlers/customers/`. Each file exports an Express callback.The customers endpoints live in `src/handlers/customers/`. Each file exports one typed handler, and `src/schemas/customers.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /customers/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /customers/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The customers routes live in `src/handlers/customers/`. Each file exports an Express callback.
- `GET /customers`
- `GET /customers/:id`
- `POST /customers`
- `PATCH /customers/:id`
- `DELETE /customers/:id`
- `GET /customers/search`
- `GET /customers/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The customers endpoints live in `src/handlers/customers/`. Each file exports one typed handler, and `src/schemas/customers.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /customers | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /customers/:id | public | Path: `id` (UUID) |
| POST | /customers | user | Body: `email`, `name`, `marketingOptIn` |
| PATCH | /customers/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
GiftCard API
The giftCards routes live in src/handlers/giftCards/. Each file exports an Express callback.
GET /giftCards
GET /giftCards/:id
POST /giftCards
PATCH /giftCards/:id
DELETE /giftCards/:id
GET /giftCards/search
GET /giftCards/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
GiftCard API
The giftCards endpoints live in src/handlers/giftCards/. Each file exports one typed handler, and src/schemas/giftCards.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/giftCards
public
List query: limit (1–100, default 20), cursor
GET
/giftCards/:id
public
Path: id (UUID)
POST
/giftCards
user
Body: code, balanceCents, currency
PATCH
/giftCards/:id
user
Body: any of the create fields, at least one
DELETE
/giftCards/:id
admin
Path: id (UUID)
GET
/giftCards/search
public
Query: q (2–100 characters), limit (1–50)
GET
/giftCards/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
code
balanceCents
currency
Changes
After, lines 17–24.
Fields
code: z.string().regex(/^[A-Z0-9]{16}$/)
balanceCents: z.number().int().nonnegative()
currency: z.string().length(3)
Changes
Placing the discussions of this file for the layout of this page…
# GiftCard API# GiftCard API
The giftCards routes live in `src/handlers/giftCards/`. Each file exports an Express callback.The giftCards endpoints live in `src/handlers/giftCards/`. Each file exports one typed handler, and `src/schemas/giftCards.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /giftCards/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /giftCards/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The giftCards routes live in `src/handlers/giftCards/`. Each file exports an Express callback.
- `GET /giftCards`
- `GET /giftCards/:id`
- `POST /giftCards`
- `PATCH /giftCards/:id`
- `DELETE /giftCards/:id`
- `GET /giftCards/search`
- `GET /giftCards/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The giftCards endpoints live in `src/handlers/giftCards/`. Each file exports one typed handler, and `src/schemas/giftCards.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /giftCards | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /giftCards/:id | public | Path: `id` (UUID) |
| POST | /giftCards | user | Body: `code`, `balanceCents`, `currency` |
| PATCH | /giftCards/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
StockLevel API
The inventory routes live in src/handlers/inventory/. Each file exports an Express callback.
GET /inventory
GET /inventory/:id
POST /inventory
PATCH /inventory/:id
DELETE /inventory/:id
GET /inventory/search
GET /inventory/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
StockLevel API
The inventory endpoints live in src/handlers/inventory/. Each file exports one typed handler, and src/schemas/inventory.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/inventory
public
List query: limit (1–100, default 20), cursor
GET
/inventory/:id
public
Path: id (UUID)
POST
/inventory
user
Body: sku, warehouseId, onHand, reserved
PATCH
/inventory/:id
user
Body: any of the create fields, at least one
DELETE
/inventory/:id
admin
Path: id (UUID)
GET
/inventory/search
public
Query: q (2–100 characters), limit (1–50)
GET
/inventory/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–23.
Fields
sku
warehouseId
onHand
reserved
Changes
After, lines 17–25.
Fields
sku: z.string().min(3).max(32)
warehouseId: z.string().uuid()
onHand: z.number().int()
reserved: z.number().int().nonnegative()
Changes
Placing the discussions of this file for the layout of this page…
# StockLevel API# StockLevel API
The inventory routes live in `src/handlers/inventory/`. Each file exports an Express callback.The inventory endpoints live in `src/handlers/inventory/`. Each file exports one typed handler, and `src/schemas/inventory.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /inventory/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /inventory/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The inventory routes live in `src/handlers/inventory/`. Each file exports an Express callback.
- `GET /inventory`
- `GET /inventory/:id`
- `POST /inventory`
- `PATCH /inventory/:id`
- `DELETE /inventory/:id`
- `GET /inventory/search`
- `GET /inventory/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The inventory endpoints live in `src/handlers/inventory/`. Each file exports one typed handler, and `src/schemas/inventory.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /inventory | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /inventory/:id | public | Path: `id` (UUID) |
| POST | /inventory | user | Body: `sku`, `warehouseId`, `onHand`, `reserved` |
| PATCH | /inventory/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Invoice API
The invoices routes live in src/handlers/invoices/. Each file exports an Express callback.
GET /invoices
GET /invoices/:id
POST /invoices
PATCH /invoices/:id
DELETE /invoices/:id
GET /invoices/search
GET /invoices/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Invoice API
The invoices endpoints live in src/handlers/invoices/. Each file exports one typed handler, and src/schemas/invoices.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/invoices
public
List query: limit (1–100, default 20), cursor
GET
/invoices/:id
public
Path: id (UUID)
POST
/invoices
user
Body: number, orderId, dueAt, totalCents
PATCH
/invoices/:id
user
Body: any of the create fields, at least one
DELETE
/invoices/:id
admin
Path: id (UUID)
GET
/invoices/search
public
Query: q (2–100 characters), limit (1–50)
GET
/invoices/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–23.
Fields
number
orderId
dueAt
totalCents
Changes
After, lines 17–25.
Fields
number: z.string().regex(/^INV-\d{8}$/)
orderId: z.string().uuid()
dueAt: z.string().datetime()
totalCents: z.number().int().nonnegative()
Changes
Placing the discussions of this file for the layout of this page…
# Invoice API# Invoice API
The invoices routes live in `src/handlers/invoices/`. Each file exports an Express callback.The invoices endpoints live in `src/handlers/invoices/`. Each file exports one typed handler, and `src/schemas/invoices.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /invoices/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /invoices/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The invoices routes live in `src/handlers/invoices/`. Each file exports an Express callback.
- `GET /invoices`
- `GET /invoices/:id`
- `POST /invoices`
- `PATCH /invoices/:id`
- `DELETE /invoices/:id`
- `GET /invoices/search`
- `GET /invoices/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The invoices endpoints live in `src/handlers/invoices/`. Each file exports one typed handler, and `src/schemas/invoices.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /invoices | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /invoices/:id | public | Path: `id` (UUID) |
| POST | /invoices | user | Body: `number`, `orderId`, `dueAt`, `totalCents` |
| PATCH | /invoices/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
LoyaltyAccount API
The loyalty routes live in src/handlers/loyalty/. Each file exports an Express callback.
GET /loyalty
GET /loyalty/:id
POST /loyalty
PATCH /loyalty/:id
DELETE /loyalty/:id
GET /loyalty/search
GET /loyalty/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
LoyaltyAccount API
The loyalty endpoints live in src/handlers/loyalty/. Each file exports one typed handler, and src/schemas/loyalty.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/loyalty
public
List query: limit (1–100, default 20), cursor
GET
/loyalty/:id
public
Path: id (UUID)
POST
/loyalty
user
Body: customerId, points, tier
PATCH
/loyalty/:id
user
Body: any of the create fields, at least one
DELETE
/loyalty/:id
admin
Path: id (UUID)
GET
/loyalty/search
public
Query: q (2–100 characters), limit (1–50)
GET
/loyalty/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
customerId
points
tier
Changes
After, lines 17–24.
Fields
customerId: z.string().uuid()
points: z.number().int().nonnegative()
tier: z.enum(['bronze', 'silver', 'gold'])
Changes
Placing the discussions of this file for the layout of this page…
# LoyaltyAccount API# LoyaltyAccount API
The loyalty routes live in `src/handlers/loyalty/`. Each file exports an Express callback.The loyalty endpoints live in `src/handlers/loyalty/`. Each file exports one typed handler, and `src/schemas/loyalty.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /loyalty/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /loyalty/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The loyalty routes live in `src/handlers/loyalty/`. Each file exports an Express callback.
- `GET /loyalty`
- `GET /loyalty/:id`
- `POST /loyalty`
- `PATCH /loyalty/:id`
- `DELETE /loyalty/:id`
- `GET /loyalty/search`
- `GET /loyalty/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The loyalty endpoints live in `src/handlers/loyalty/`. Each file exports one typed handler, and `src/schemas/loyalty.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /loyalty | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /loyalty/:id | public | Path: `id` (UUID) |
| POST | /loyalty | user | Body: `customerId`, `points`, `tier` |
| PATCH | /loyalty/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
MediaAsset API
The media routes live in src/handlers/media/. Each file exports an Express callback.
GET /media
GET /media/:id
POST /media
PATCH /media/:id
DELETE /media/:id
GET /media/search
GET /media/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
MediaAsset API
The media endpoints live in src/handlers/media/. Each file exports one typed handler, and src/schemas/media.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/media
public
List query: limit (1–100, default 20), cursor
GET
/media/:id
public
Path: id (UUID)
POST
/media
user
Body: productId, url, altText, position
PATCH
/media/:id
user
Body: any of the create fields, at least one
DELETE
/media/:id
admin
Path: id (UUID)
GET
/media/search
public
Query: q (2–100 characters), limit (1–50)
GET
/media/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–23.
Fields
productId
url
altText
position
Changes
After, lines 17–25.
Fields
productId: z.string().uuid()
url: z.string().url()
altText: z.string().max(300)
position: z.number().int().min(0)
Changes
Placing the discussions of this file for the layout of this page…
# MediaAsset API# MediaAsset API
The media routes live in `src/handlers/media/`. Each file exports an Express callback.The media endpoints live in `src/handlers/media/`. Each file exports one typed handler, and `src/schemas/media.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /media/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /media/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The media routes live in `src/handlers/media/`. Each file exports an Express callback.
- `GET /media`
- `GET /media/:id`
- `POST /media`
- `PATCH /media/:id`
- `DELETE /media/:id`
- `GET /media/search`
- `GET /media/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The media endpoints live in `src/handlers/media/`. Each file exports one typed handler, and `src/schemas/media.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /media | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /media/:id | public | Path: `id` (UUID) |
| POST | /media | user | Body: `productId`, `url`, `altText`, `position` |
| PATCH | /media/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Notification API
The notifications routes live in src/handlers/notifications/. Each file exports an Express callback.
GET /notifications
GET /notifications/:id
POST /notifications
PATCH /notifications/:id
DELETE /notifications/:id
GET /notifications/search
GET /notifications/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Notification API
The notifications endpoints live in src/handlers/notifications/. Each file exports one typed handler, and src/schemas/notifications.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/notifications
public
List query: limit (1–100, default 20), cursor
GET
/notifications/:id
public
Path: id (UUID)
POST
/notifications
user
Body: customerId, channel, template
PATCH
/notifications/:id
user
Body: any of the create fields, at least one
DELETE
/notifications/:id
admin
Path: id (UUID)
GET
/notifications/search
public
Query: q (2–100 characters), limit (1–50)
GET
/notifications/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
customerId
channel
template
Changes
After, lines 17–24.
Fields
customerId: z.string().uuid()
channel: z.enum(['email', 'sms', 'push'])
template: z.string().max(80)
Changes
Placing the discussions of this file for the layout of this page…
# Notification API# Notification API
The notifications routes live in `src/handlers/notifications/`. Each file exports an Express callback.The notifications endpoints live in `src/handlers/notifications/`. Each file exports one typed handler, and `src/schemas/notifications.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /notifications/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /notifications/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The notifications routes live in `src/handlers/notifications/`. Each file exports an Express callback.
- `GET /notifications`
- `GET /notifications/:id`
- `POST /notifications`
- `PATCH /notifications/:id`
- `DELETE /notifications/:id`
- `GET /notifications/search`
- `GET /notifications/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The notifications endpoints live in `src/handlers/notifications/`. Each file exports one typed handler, and `src/schemas/notifications.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /notifications | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /notifications/:id | public | Path: `id` (UUID) |
| POST | /notifications | user | Body: `customerId`, `channel`, `template` |
| PATCH | /notifications/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Order API
The orders routes live in src/handlers/orders/. Each file exports an Express callback.
GET /orders
GET /orders/:id
POST /orders
PATCH /orders/:id
DELETE /orders/:id
GET /orders/search
GET /orders/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Order API
The orders endpoints live in src/handlers/orders/. Each file exports one typed handler, and src/schemas/orders.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/orders
public
List query: limit (1–100, default 20), cursor
GET
/orders/:id
public
Path: id (UUID)
POST
/orders
user
Body: number, customerId, totalCents, status
PATCH
/orders/:id
user
Body: any of the create fields, at least one
DELETE
/orders/:id
admin
Path: id (UUID)
GET
/orders/search
public
Query: q (2–100 characters), limit (1–50)
GET
/orders/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Placing the discussions of this file for the layout of this page…
# Order API# Order API
The orders routes live in `src/handlers/orders/`. Each file exports an Express callback.The orders endpoints live in `src/handlers/orders/`. Each file exports one typed handler, and `src/schemas/orders.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /orders/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /orders/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The orders routes live in `src/handlers/orders/`. Each file exports an Express callback.
- `GET /orders`
- `GET /orders/:id`
- `POST /orders`
- `PATCH /orders/:id`
- `DELETE /orders/:id`
- `GET /orders/search`
- `GET /orders/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The orders endpoints live in `src/handlers/orders/`. Each file exports one typed handler, and `src/schemas/orders.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /orders | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /orders/:id | public | Path: `id` (UUID) |
| POST | /orders | user | Body: `number`, `customerId`, `totalCents`, `status` |
| PATCH | /orders/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Payment API
The payments routes live in src/handlers/payments/. Each file exports an Express callback.
GET /payments
GET /payments/:id
POST /payments
PATCH /payments/:id
DELETE /payments/:id
GET /payments/search
GET /payments/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Payment API
The payments endpoints live in src/handlers/payments/. Each file exports one typed handler, and src/schemas/payments.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/payments
public
List query: limit (1–100, default 20), cursor
GET
/payments/:id
public
Path: id (UUID)
POST
/payments
user
Body: orderId, provider, amountCents, reference
PATCH
/payments/:id
user
Body: any of the create fields, at least one
DELETE
/payments/:id
admin
Path: id (UUID)
GET
/payments/search
public
Query: q (2–100 characters), limit (1–50)
GET
/payments/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–23.
Fields
orderId
provider
amountCents
reference
Changes
After, lines 17–25.
Fields
orderId: z.string().uuid()
provider: z.enum(['card', 'paypal', 'invoice'])
amountCents: z.number().int().positive()
reference: z.string().max(64)
Changes
Placing the discussions of this file for the layout of this page…
# Payment API# Payment API
The payments routes live in `src/handlers/payments/`. Each file exports an Express callback.The payments endpoints live in `src/handlers/payments/`. Each file exports one typed handler, and `src/schemas/payments.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /payments/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /payments/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The payments routes live in `src/handlers/payments/`. Each file exports an Express callback.
- `GET /payments`
- `GET /payments/:id`
- `POST /payments`
- `PATCH /payments/:id`
- `DELETE /payments/:id`
- `GET /payments/search`
- `GET /payments/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The payments endpoints live in `src/handlers/payments/`. Each file exports one typed handler, and `src/schemas/payments.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /payments | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /payments/:id | public | Path: `id` (UUID) |
| POST | /payments | user | Body: `orderId`, `provider`, `amountCents`, `reference` |
| PATCH | /payments/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Preference API
The preferences routes live in src/handlers/preferences/. Each file exports an Express callback.
GET /preferences
GET /preferences/:id
POST /preferences
PATCH /preferences/:id
DELETE /preferences/:id
GET /preferences/search
GET /preferences/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Preference API
The preferences endpoints live in src/handlers/preferences/. Each file exports one typed handler, and src/schemas/preferences.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/preferences
public
List query: limit (1–100, default 20), cursor
GET
/preferences/:id
public
Path: id (UUID)
POST
/preferences
user
Body: customerId, locale, currency
PATCH
/preferences/:id
user
Body: any of the create fields, at least one
DELETE
/preferences/:id
admin
Path: id (UUID)
GET
/preferences/search
public
Query: q (2–100 characters), limit (1–50)
GET
/preferences/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
customerId
locale
currency
Changes
After, lines 17–24.
Fields
customerId: z.string().uuid()
locale: z.string().max(10)
currency: z.string().length(3)
Changes
Placing the discussions of this file for the layout of this page…
# Preference API# Preference API
The preferences routes live in `src/handlers/preferences/`. Each file exports an Express callback.The preferences endpoints live in `src/handlers/preferences/`. Each file exports one typed handler, and `src/schemas/preferences.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /preferences/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /preferences/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The preferences routes live in `src/handlers/preferences/`. Each file exports an Express callback.
- `GET /preferences`
- `GET /preferences/:id`
- `POST /preferences`
- `PATCH /preferences/:id`
- `DELETE /preferences/:id`
- `GET /preferences/search`
- `GET /preferences/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The preferences endpoints live in `src/handlers/preferences/`. Each file exports one typed handler, and `src/schemas/preferences.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /preferences | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /preferences/:id | public | Path: `id` (UUID) |
| POST | /preferences | user | Body: `customerId`, `locale`, `currency` |
| PATCH | /preferences/:id | user | Body: any of the create fields, at least one |
| GET | /preferences/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
| GET | /preferences/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
## Fields## Fields
- `customerId`- `customerId`: `z.string().uuid()`
- `locale`- `locale`: `z.string().max(10)`
- `currency`- `currency`: `z.string().length(3)`
- `customerId`
- `locale`
- `currency`
- `customerId`: `z.string().uuid()`
- `locale`: `z.string().max(10)`
- `currency`: `z.string().length(3)`
## Changes## Changes
docs/api/prices.md
+17-15
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Price API
The prices routes live in src/handlers/prices/. Each file exports an Express callback.
GET /prices
GET /prices/:id
POST /prices
PATCH /prices/:id
DELETE /prices/:id
GET /prices/search
GET /prices/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Price API
The prices endpoints live in src/handlers/prices/. Each file exports one typed handler, and src/schemas/prices.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/prices
public
List query: limit (1–100, default 20), cursor
GET
/prices/:id
public
Path: id (UUID)
POST
/prices
user
Body: productId, currency, amountCents, validFrom
PATCH
/prices/:id
user
Body: any of the create fields, at least one
DELETE
/prices/:id
admin
Path: id (UUID)
GET
/prices/search
public
Query: q (2–100 characters), limit (1–50)
GET
/prices/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–23.
Fields
productId
currency
amountCents
validFrom
Changes
After, lines 17–25.
Fields
productId: z.string().uuid()
currency: z.string().length(3)
amountCents: z.number().int().nonnegative()
validFrom: z.string().datetime()
Changes
Placing the discussions of this file for the layout of this page…
# Price API# Price API
The prices routes live in `src/handlers/prices/`. Each file exports an Express callback.The prices endpoints live in `src/handlers/prices/`. Each file exports one typed handler, and `src/schemas/prices.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /prices/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /prices/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The prices routes live in `src/handlers/prices/`. Each file exports an Express callback.
- `GET /prices`
- `GET /prices/:id`
- `POST /prices`
- `PATCH /prices/:id`
- `DELETE /prices/:id`
- `GET /prices/search`
- `GET /prices/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The prices endpoints live in `src/handlers/prices/`. Each file exports one typed handler, and `src/schemas/prices.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /prices | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /prices/:id | public | Path: `id` (UUID) |
| POST | /prices | user | Body: `productId`, `currency`, `amountCents`, `validFrom` |
| PATCH | /prices/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Product API
The products routes live in src/handlers/products/. Each file exports an Express callback.
GET /products
GET /products/:id
POST /products
PATCH /products/:id
DELETE /products/:id
GET /products/search
GET /products/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Product API
The products endpoints live in src/handlers/products/. Each file exports one typed handler, and src/schemas/products.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/products
public
List query: limit (1–100, default 20), cursor
GET
/products/:id
public
Path: id (UUID)
POST
/products
user
Body: sku, name, priceCents, status
PATCH
/products/:id
user
Body: any of the create fields, at least one
DELETE
/products/:id
admin
Path: id (UUID)
GET
/products/search
public
Query: q (2–100 characters), limit (1–50)
GET
/products/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–23.
Fields
sku
name
priceCents
status
Changes
After, lines 17–25.
Fields
sku: z.string().min(3).max(32)
name: z.string().min(1).max(200)
priceCents: z.number().int().nonnegative()
status: z.enum(['draft', 'active', 'archived'])
Changes
Placing the discussions of this file for the layout of this page…
# Product API# Product API
The products routes live in `src/handlers/products/`. Each file exports an Express callback.The products endpoints live in `src/handlers/products/`. Each file exports one typed handler, and `src/schemas/products.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /products/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /products/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The products routes live in `src/handlers/products/`. Each file exports an Express callback.
- `GET /products`
- `GET /products/:id`
- `POST /products`
- `PATCH /products/:id`
- `DELETE /products/:id`
- `GET /products/search`
- `GET /products/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The products endpoints live in `src/handlers/products/`. Each file exports one typed handler, and `src/schemas/products.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /products | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /products/:id | public | Path: `id` (UUID) |
| POST | /products | user | Body: `sku`, `name`, `priceCents`, `status` |
| PATCH | /products/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Quote API
The quotes routes live in src/handlers/quotes/. Each file exports an Express callback.
GET /quotes
GET /quotes/:id
POST /quotes
PATCH /quotes/:id
DELETE /quotes/:id
GET /quotes/search
GET /quotes/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Quote API
The quotes endpoints live in src/handlers/quotes/. Each file exports one typed handler, and src/schemas/quotes.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/quotes
public
List query: limit (1–100, default 20), cursor
GET
/quotes/:id
public
Path: id (UUID)
POST
/quotes
user
Body: number, customerId, validUntil
PATCH
/quotes/:id
user
Body: any of the create fields, at least one
DELETE
/quotes/:id
admin
Path: id (UUID)
GET
/quotes/search
public
Query: q (2–100 characters), limit (1–50)
GET
/quotes/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
number
customerId
validUntil
Changes
After, lines 17–24.
Fields
number: z.string().regex(/^QT-\d{8}$/)
customerId: z.string().uuid()
validUntil: z.string().datetime()
Changes
Placing the discussions of this file for the layout of this page…
# Quote API# Quote API
The quotes routes live in `src/handlers/quotes/`. Each file exports an Express callback.The quotes endpoints live in `src/handlers/quotes/`. Each file exports one typed handler, and `src/schemas/quotes.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /quotes/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /quotes/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The quotes routes live in `src/handlers/quotes/`. Each file exports an Express callback.
- `GET /quotes`
- `GET /quotes/:id`
- `POST /quotes`
- `PATCH /quotes/:id`
- `DELETE /quotes/:id`
- `GET /quotes/search`
- `GET /quotes/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The quotes endpoints live in `src/handlers/quotes/`. Each file exports one typed handler, and `src/schemas/quotes.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /quotes | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /quotes/:id | public | Path: `id` (UUID) |
| POST | /quotes | user | Body: `number`, `customerId`, `validUntil` |
| PATCH | /quotes/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Refund API
The refunds routes live in src/handlers/refunds/. Each file exports an Express callback.
GET /refunds
GET /refunds/:id
POST /refunds
PATCH /refunds/:id
DELETE /refunds/:id
GET /refunds/search
GET /refunds/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Refund API
The refunds endpoints live in src/handlers/refunds/. Each file exports one typed handler, and src/schemas/refunds.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/refunds
public
List query: limit (1–100, default 20), cursor
GET
/refunds/:id
public
Path: id (UUID)
POST
/refunds
user
Body: paymentId, amountCents, reason
PATCH
/refunds/:id
user
Body: any of the create fields, at least one
DELETE
/refunds/:id
admin
Path: id (UUID)
GET
/refunds/search
public
Query: q (2–100 characters), limit (1–50)
GET
/refunds/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
paymentId
amountCents
reason
Changes
After, lines 17–24.
Fields
paymentId: z.string().uuid()
amountCents: z.number().int().positive()
reason: z.enum(['damaged', 'late', 'other'])
Changes
Placing the discussions of this file for the layout of this page…
# Refund API# Refund API
The refunds routes live in `src/handlers/refunds/`. Each file exports an Express callback.The refunds endpoints live in `src/handlers/refunds/`. Each file exports one typed handler, and `src/schemas/refunds.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /refunds/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /refunds/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The refunds routes live in `src/handlers/refunds/`. Each file exports an Express callback.
- `GET /refunds`
- `GET /refunds/:id`
- `POST /refunds`
- `PATCH /refunds/:id`
- `DELETE /refunds/:id`
- `GET /refunds/search`
- `GET /refunds/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The refunds endpoints live in `src/handlers/refunds/`. Each file exports one typed handler, and `src/schemas/refunds.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /refunds | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /refunds/:id | public | Path: `id` (UUID) |
| POST | /refunds | user | Body: `paymentId`, `amountCents`, `reason` |
| PATCH | /refunds/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
ReturnRequest API
The returns routes live in src/handlers/returns/. Each file exports an Express callback.
GET /returns
GET /returns/:id
POST /returns
PATCH /returns/:id
DELETE /returns/:id
GET /returns/search
GET /returns/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
ReturnRequest API
The returns endpoints live in src/handlers/returns/. Each file exports one typed handler, and src/schemas/returns.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/returns
public
List query: limit (1–100, default 20), cursor
GET
/returns/:id
public
Path: id (UUID)
POST
/returns
user
Body: orderId, lineIds, reason
PATCH
/returns/:id
user
Body: any of the create fields, at least one
DELETE
/returns/:id
admin
Path: id (UUID)
GET
/returns/search
public
Query: q (2–100 characters), limit (1–50)
GET
/returns/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
orderId
lineIds
reason
Changes
After, lines 17–24.
Fields
orderId: z.string().uuid()
lineIds: z.array(z.string().uuid()).min(1)
reason: z.string().max(500)
Changes
Placing the discussions of this file for the layout of this page…
# ReturnRequest API# ReturnRequest API
The returns routes live in `src/handlers/returns/`. Each file exports an Express callback.The returns endpoints live in `src/handlers/returns/`. Each file exports one typed handler, and `src/schemas/returns.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /returns/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /returns/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The returns routes live in `src/handlers/returns/`. Each file exports an Express callback.
- `GET /returns`
- `GET /returns/:id`
- `POST /returns`
- `PATCH /returns/:id`
- `DELETE /returns/:id`
- `GET /returns/search`
- `GET /returns/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The returns endpoints live in `src/handlers/returns/`. Each file exports one typed handler, and `src/schemas/returns.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /returns | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /returns/:id | public | Path: `id` (UUID) |
| POST | /returns | user | Body: `orderId`, `lineIds`, `reason` |
| PATCH | /returns/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
ProductReview API
The reviews routes live in src/handlers/reviews/. Each file exports an Express callback.
GET /reviews
GET /reviews/:id
POST /reviews
PATCH /reviews/:id
DELETE /reviews/:id
GET /reviews/search
GET /reviews/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
ProductReview API
The reviews endpoints live in src/handlers/reviews/. Each file exports one typed handler, and src/schemas/reviews.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/reviews
public
List query: limit (1–100, default 20), cursor
GET
/reviews/:id
public
Path: id (UUID)
POST
/reviews
user
Body: productId, rating, title, body
PATCH
/reviews/:id
user
Body: any of the create fields, at least one
DELETE
/reviews/:id
admin
Path: id (UUID)
GET
/reviews/search
public
Query: q (2–100 characters), limit (1–50)
GET
/reviews/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–23.
Fields
productId
rating
title
body
Changes
After, lines 17–25.
Fields
productId: z.string().uuid()
rating: z.number().int().min(1).max(5)
title: z.string().max(120)
body: z.string().max(5000)
Changes
Placing the discussions of this file for the layout of this page…
# ProductReview API# ProductReview API
The reviews routes live in `src/handlers/reviews/`. Each file exports an Express callback.The reviews endpoints live in `src/handlers/reviews/`. Each file exports one typed handler, and `src/schemas/reviews.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /reviews/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /reviews/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The reviews routes live in `src/handlers/reviews/`. Each file exports an Express callback.
- `GET /reviews`
- `GET /reviews/:id`
- `POST /reviews`
- `PATCH /reviews/:id`
- `DELETE /reviews/:id`
- `GET /reviews/search`
- `GET /reviews/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The reviews endpoints live in `src/handlers/reviews/`. Each file exports one typed handler, and `src/schemas/reviews.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /reviews | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /reviews/:id | public | Path: `id` (UUID) |
| POST | /reviews | user | Body: `productId`, `rating`, `title`, `body` |
| PATCH | /reviews/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Session API
The sessions routes live in src/handlers/sessions/. Each file exports an Express callback.
GET /sessions
GET /sessions/:id
POST /sessions
PATCH /sessions/:id
DELETE /sessions/:id
GET /sessions/search
GET /sessions/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Session API
The sessions endpoints live in src/handlers/sessions/. Each file exports one typed handler, and src/schemas/sessions.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/sessions
public
List query: limit (1–100, default 20), cursor
GET
/sessions/:id
public
Path: id (UUID)
POST
/sessions
user
Body: customerId, userAgent, expiresAt
PATCH
/sessions/:id
user
Body: any of the create fields, at least one
DELETE
/sessions/:id
admin
Path: id (UUID)
GET
/sessions/search
public
Query: q (2–100 characters), limit (1–50)
GET
/sessions/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
customerId
userAgent
expiresAt
Changes
After, lines 17–24.
Fields
customerId: z.string().uuid()
userAgent: z.string().max(400)
expiresAt: z.string().datetime()
Changes
Placing the discussions of this file for the layout of this page…
# Session API# Session API
The sessions routes live in `src/handlers/sessions/`. Each file exports an Express callback.The sessions endpoints live in `src/handlers/sessions/`. Each file exports one typed handler, and `src/schemas/sessions.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /sessions/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /sessions/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The sessions routes live in `src/handlers/sessions/`. Each file exports an Express callback.
- `GET /sessions`
- `GET /sessions/:id`
- `POST /sessions`
- `PATCH /sessions/:id`
- `DELETE /sessions/:id`
- `GET /sessions/search`
- `GET /sessions/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The sessions endpoints live in `src/handlers/sessions/`. Each file exports one typed handler, and `src/schemas/sessions.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /sessions | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /sessions/:id | public | Path: `id` (UUID) |
| POST | /sessions | user | Body: `customerId`, `userAgent`, `expiresAt` |
| PATCH | /sessions/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Shipment API
The shipments routes live in src/handlers/shipments/. Each file exports an Express callback.
GET /shipments
GET /shipments/:id
POST /shipments
PATCH /shipments/:id
DELETE /shipments/:id
GET /shipments/search
GET /shipments/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Shipment API
The shipments endpoints live in src/handlers/shipments/. Each file exports one typed handler, and src/schemas/shipments.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/shipments
public
List query: limit (1–100, default 20), cursor
GET
/shipments/:id
public
Path: id (UUID)
POST
/shipments
user
Body: orderId, carrier, trackingNumber, shippedAt
PATCH
/shipments/:id
user
Body: any of the create fields, at least one
DELETE
/shipments/:id
admin
Path: id (UUID)
GET
/shipments/search
public
Query: q (2–100 characters), limit (1–50)
GET
/shipments/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–23.
Fields
orderId
carrier
trackingNumber
shippedAt
Changes
After, lines 17–25.
Fields
orderId: z.string().uuid()
carrier: z.string().max(40)
trackingNumber: z.string().max(64)
shippedAt: z.string().datetime().nullable()
Changes
Placing the discussions of this file for the layout of this page…
# Shipment API# Shipment API
The shipments routes live in `src/handlers/shipments/`. Each file exports an Express callback.The shipments endpoints live in `src/handlers/shipments/`. Each file exports one typed handler, and `src/schemas/shipments.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /shipments/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /shipments/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The shipments routes live in `src/handlers/shipments/`. Each file exports an Express callback.
- `GET /shipments`
- `GET /shipments/:id`
- `POST /shipments`
- `PATCH /shipments/:id`
- `DELETE /shipments/:id`
- `GET /shipments/search`
- `GET /shipments/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The shipments endpoints live in `src/handlers/shipments/`. Each file exports one typed handler, and `src/schemas/shipments.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /shipments | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /shipments/:id | public | Path: `id` (UUID) |
| POST | /shipments | user | Body: `orderId`, `carrier`, `trackingNumber`, `shippedAt` |
| PATCH | /shipments/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Subscription API
The subscriptions routes live in src/handlers/subscriptions/. Each file exports an Express callback.
GET /subscriptions
GET /subscriptions/:id
POST /subscriptions
PATCH /subscriptions/:id
DELETE /subscriptions/:id
GET /subscriptions/search
GET /subscriptions/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Subscription API
The subscriptions endpoints live in src/handlers/subscriptions/. Each file exports one typed handler, and src/schemas/subscriptions.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/subscriptions
public
List query: limit (1–100, default 20), cursor
GET
/subscriptions/:id
public
Path: id (UUID)
POST
/subscriptions
user
Body: customerId, plan, renewsAt
PATCH
/subscriptions/:id
user
Body: any of the create fields, at least one
DELETE
/subscriptions/:id
admin
Path: id (UUID)
GET
/subscriptions/search
public
Query: q (2–100 characters), limit (1–50)
GET
/subscriptions/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
customerId
plan
renewsAt
Changes
After, lines 17–24.
Fields
customerId: z.string().uuid()
plan: z.enum(['monthly', 'quarterly', 'yearly'])
renewsAt: z.string().datetime()
Changes
Placing the discussions of this file for the layout of this page…
# Subscription API# Subscription API
The subscriptions routes live in `src/handlers/subscriptions/`. Each file exports an Express callback.The subscriptions endpoints live in `src/handlers/subscriptions/`. Each file exports one typed handler, and `src/schemas/subscriptions.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /subscriptions/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /subscriptions/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The subscriptions routes live in `src/handlers/subscriptions/`. Each file exports an Express callback.
- `GET /subscriptions`
- `GET /subscriptions/:id`
- `POST /subscriptions`
- `PATCH /subscriptions/:id`
- `DELETE /subscriptions/:id`
- `GET /subscriptions/search`
- `GET /subscriptions/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The subscriptions endpoints live in `src/handlers/subscriptions/`. Each file exports one typed handler, and `src/schemas/subscriptions.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /subscriptions | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /subscriptions/:id | public | Path: `id` (UUID) |
| POST | /subscriptions | user | Body: `customerId`, `plan`, `renewsAt` |
| PATCH | /subscriptions/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Team API
The teams routes live in src/handlers/teams/. Each file exports an Express callback.
GET /teams
GET /teams/:id
POST /teams
PATCH /teams/:id
DELETE /teams/:id
GET /teams/search
GET /teams/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Team API
The teams endpoints live in src/handlers/teams/. Each file exports one typed handler, and src/schemas/teams.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/teams
public
List query: limit (1–100, default 20), cursor
GET
/teams/:id
public
Path: id (UUID)
POST
/teams
user
Body: slug, name, ownerId
PATCH
/teams/:id
user
Body: any of the create fields, at least one
DELETE
/teams/:id
admin
Path: id (UUID)
GET
/teams/search
public
Query: q (2–100 characters), limit (1–50)
GET
/teams/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
slug
name
ownerId
Changes
After, lines 17–24.
Fields
slug: z.string().regex(/^[a-z0-9-]+$/)
name: z.string().min(1).max(120)
ownerId: z.string().uuid()
Changes
Placing the discussions of this file for the layout of this page…
# Team API# Team API
The teams routes live in `src/handlers/teams/`. Each file exports an Express callback.The teams endpoints live in `src/handlers/teams/`. Each file exports one typed handler, and `src/schemas/teams.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /teams/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /teams/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The teams routes live in `src/handlers/teams/`. Each file exports an Express callback.
- `GET /teams`
- `GET /teams/:id`
- `POST /teams`
- `PATCH /teams/:id`
- `DELETE /teams/:id`
- `GET /teams/search`
- `GET /teams/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The teams endpoints live in `src/handlers/teams/`. Each file exports one typed handler, and `src/schemas/teams.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /teams | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /teams/:id | public | Path: `id` (UUID) |
| POST | /teams | user | Body: `slug`, `name`, `ownerId` |
| PATCH | /teams/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Variant API
The variants routes live in src/handlers/variants/. Each file exports an Express callback.
GET /variants
GET /variants/:id
POST /variants
PATCH /variants/:id
DELETE /variants/:id
GET /variants/search
GET /variants/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Variant API
The variants endpoints live in src/handlers/variants/. Each file exports one typed handler, and src/schemas/variants.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/variants
public
List query: limit (1–100, default 20), cursor
GET
/variants/:id
public
Path: id (UUID)
POST
/variants
user
Body: productId, sku, options
PATCH
/variants/:id
user
Body: any of the create fields, at least one
DELETE
/variants/:id
admin
Path: id (UUID)
GET
/variants/search
public
Query: q (2–100 characters), limit (1–50)
GET
/variants/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
productId
sku
options
Changes
After, lines 17–24.
Fields
productId: z.string().uuid()
sku: z.string().min(3).max(32)
options: z.record(z.string(), z.string())
Changes
Placing the discussions of this file for the layout of this page…
# Variant API# Variant API
The variants routes live in `src/handlers/variants/`. Each file exports an Express callback.The variants endpoints live in `src/handlers/variants/`. Each file exports one typed handler, and `src/schemas/variants.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /variants/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /variants/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The variants routes live in `src/handlers/variants/`. Each file exports an Express callback.
- `GET /variants`
- `GET /variants/:id`
- `POST /variants`
- `PATCH /variants/:id`
- `DELETE /variants/:id`
- `GET /variants/search`
- `GET /variants/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The variants endpoints live in `src/handlers/variants/`. Each file exports one typed handler, and `src/schemas/variants.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /variants | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /variants/:id | public | Path: `id` (UUID) |
| POST | /variants | user | Body: `productId`, `sku`, `options` |
| PATCH | /variants/:id | user | Body: any of the create fields, at least one |
Line diff: Difftastic has no parser for this file and compared it as text. Word comparison marks the changed words of replaced lines.
Before, lines 1–14.
Wishlist API
The wishlists routes live in src/handlers/wishlists/. Each file exports an Express callback.
GET /wishlists
GET /wishlists/:id
POST /wishlists
PATCH /wishlists/:id
DELETE /wishlists/:id
GET /wishlists/search
GET /wishlists/export
Errors are returned as { "error": "<message>" } with a 400, 404 or 500 status.
After, lines 1–16.
Wishlist API
The wishlists endpoints live in src/handlers/wishlists/. Each file exports one typed handler, and src/schemas/wishlists.ts holds the schemas that the pipeline validates before the handler runs.
Method
Path
Access
Validation
GET
/wishlists
public
List query: limit (1–100, default 20), cursor
GET
/wishlists/:id
public
Path: id (UUID)
POST
/wishlists
user
Body: customerId, name, productIds
PATCH
/wishlists/:id
user
Body: any of the create fields, at least one
DELETE
/wishlists/:id
admin
Path: id (UUID)
GET
/wishlists/search
public
Query: q (2–100 characters), limit (1–50)
GET
/wishlists/export
admin
Query: format (csv or json), limit
An error is { "error": { "code": "<code>", "message": "<message>" } }. A request that fails validation gets a 422 with the field of each problem.
Before, lines 15–22.
Fields
customerId
name
productIds
Changes
After, lines 17–24.
Fields
customerId: z.string().uuid()
name: z.string().min(1).max(80)
productIds: z.array(z.string().uuid()).max(200)
Changes
Placing the discussions of this file for the layout of this page…
# Wishlist API# Wishlist API
The wishlists routes live in `src/handlers/wishlists/`. Each file exports an Express callback.The wishlists endpoints live in `src/handlers/wishlists/`. Each file exports one typed handler, and `src/schemas/wishlists.ts` holds the schemas that the pipeline validates before the handler runs.
| GET | /wishlists/search | public | Query: `q` (2–100 characters), `limit` (1–50) |
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.| GET | /wishlists/export | admin | Query: `format` (`csv` or `json`), `limit` |
An error is `{ "error": { "code": "<code>", "message": "<message>" } }`. A request that fails validation gets a 422 with the field of each problem.
The wishlists routes live in `src/handlers/wishlists/`. Each file exports an Express callback.
- `GET /wishlists`
- `GET /wishlists/:id`
- `POST /wishlists`
- `PATCH /wishlists/:id`
- `DELETE /wishlists/:id`
- `GET /wishlists/search`
- `GET /wishlists/export`
Errors are returned as `{ "error": "<message>" }` with a 400, 404 or 500 status.
The wishlists endpoints live in `src/handlers/wishlists/`. Each file exports one typed handler, and `src/schemas/wishlists.ts` holds the schemas that the pipeline validates before the handler runs.
| Method | Path | Access | Validation |
| --- | --- | --- | --- |
| GET | /wishlists | public | List query: `limit` (1–100, default 20), `cursor` |
| GET | /wishlists/:id | public | Path: `id` (UUID) |
| POST | /wishlists | user | Body: `customerId`, `name`, `productIds` |
| PATCH | /wishlists/:id | user | Body: any of the create fields, at least one |
The 64 scheduled jobs import the shared @storefront/logger package instead of the local log module. The two examples show the whole change; the other jobs repeat it exactly.
Mechanical change · 64 files · 64 hunks
Replace import { log } from '../log'; with import { logger } from '@storefront/logger';, and each log.info( and log.debug( call with logger.info( and logger.debug(. Nothing else changes.
Verification:
Applied the replacements to the captured old side of each job file and compared the result with its captured new side: all 64 files match exactly. No job ran.
2 files below show the representative examples, and 62 matching files wait in the remaining group. A reviewed example marks only its own file.
src/jobs/products-cleanup.ts
+5-5
Difftastic 0.69.0 · TypeScript: changed syntax is marked
Placing the discussions of this file for the layout of this page…
// Delete the expired products every night.// Delete the expired products every night.
import { db } from'../db';import { db } from'../db';