Skip to content

Item Shape

Because items are represented by data in many different tables, the backend shapes the results of all database queries and optimizes the responses for developer usability. This processed item shape is referred to as a flattened item:

Item (Flattened)
type Item = {
id: string;
category: string;
subCategory: string;
condition: string;
currency: string;
retailPrice: number;
rentalPrice: {days:number; price: number;}[];
description: string;
size?: string;
sizeScale?: SizeScale;
fit?: number;
media: Array<Media>;
attributes: Array<Attribute>;
colors: Array<Color>;
designer: Designer;
materials: Array<Material>;
meta: Record<string, unknown>;
enabled: boolean;
createdAt: string;
updatedAt: string;
}
  • id : a unique id in CUID format (generated by paralleldrive)
  • category : one of the category identifiers shown on the categories page
  • subCategory : a subCategory from the list of options for the specified category
  • condition : item condition (“Brand New”, “Like New”, “Excellent” or “Great”, defined here)
  • currency : string, currency identifier for the item (for future use, defaults to USD)
  • size : string, the size of the item in one of the supported sizing scales (see Sizing)
  • fit : an integer from 1-5 representing the subjective fit of the item (see fit (link TODO))
  • description : text description of the item (typically one line, 4 or 5 words)
  • notes : text notes for the item (no current character limit)
  • retailPrice : integer representing the original purchase price (rounded) in US Dollars
  • rentalPrice : jsonb column holds an array of day/price pairs
  • enabled : only items with enabled: true are included in API responses
  • createdAt : item creation timestamp, ISO-8601 string format
  • updatedAt : item updated timestamp, ISO-8601 string format
  • meta : jsonb column used for unstructured item data (see Validation)
  • attributes : Array of related Attribute records (see Attributes)
  • colors : Array of related Color records (see Colors)
  • designer : The related Designer value
  • materials : Array of related Material records
  • sizeScale : The associated size scale chosen by the owner (see Sizing)
  • media : Array of related Media records (see Media)
Get All Items Endpoint
$ curl /resources/items | jq .
{
count: 117,
rows: [
{
"id": "<some cuid>",
"category": "accessories",
"subCategory": "sunglasses",
"ownerId": "<some cuid>",
"description": "Gucci Hailey Oval Glasses",
"notes": "Easy black glasses with the Gucci logo on the sides",
"fit": 2,
"currency": "USD",
"retailPrice": 400,
"rentalPrice": [
{"days": 4, "price": "123"},
{"days": 8, "price": "456"},
{"days": 12, "price": "789"}
],
"designerId": "<some cuid>",
"size": null,
"condition": "excellent",
"enabled": true,
"createdAt": "2024-06-18 23:00:37.131983+00",
"updatedAt": "2024-06-18 23:00:37.131983+00",
"owner": {
"id": "<some cuid>",
"username": "pioushhhh",
"name": "Pia La Cava"
},
"designer": {
"id": "<some cuid>",
"name": "gucci",
"displayName": "Gucci",
},
"colors": [...],
"materials": [],
"media": [...],
"occasions": [...],
"attributes": [...]
},
...
]
}