chore(25-02): apply biome formatter to task 1 and 2 files
This commit is contained in:
@@ -16,21 +16,43 @@ function textResult(data: unknown): ToolResult {
|
||||
}
|
||||
|
||||
function errorResult(message: string): ToolResult {
|
||||
return { content: [{ type: "text", text: JSON.stringify({ error: message }) }] };
|
||||
return {
|
||||
content: [{ type: "text", text: JSON.stringify({ error: message }) }],
|
||||
};
|
||||
}
|
||||
|
||||
const catalogItemInputSchema = {
|
||||
brand: z.string().describe("Brand or manufacturer name"),
|
||||
model: z.string().describe("Model name — combined with brand forms the unique identifier"),
|
||||
category: z.string().optional().describe("Category name (e.g., 'Bags', 'Lights')"),
|
||||
model: z
|
||||
.string()
|
||||
.describe("Model name — combined with brand forms the unique identifier"),
|
||||
category: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Category name (e.g., 'Bags', 'Lights')"),
|
||||
weightGrams: z.number().optional().describe("Weight in grams"),
|
||||
priceCents: z.number().optional().describe("MSRP price in cents (e.g., 9999 = $99.99)"),
|
||||
priceCents: z
|
||||
.number()
|
||||
.optional()
|
||||
.describe("MSRP price in cents (e.g., 9999 = $99.99)"),
|
||||
imageUrl: z.string().optional().describe("URL to the product image"),
|
||||
description: z.string().optional().describe("Product description"),
|
||||
sourceUrl: z.string().optional().describe("URL to the product page on manufacturer/retailer site"),
|
||||
imageCredit: z.string().optional().describe("Image credit — photographer or source name"),
|
||||
imageSourceUrl: z.string().optional().describe("Original URL where the image was sourced from"),
|
||||
tags: z.array(z.string()).optional().describe("Tags for categorization (created automatically if new)"),
|
||||
sourceUrl: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("URL to the product page on manufacturer/retailer site"),
|
||||
imageCredit: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Image credit — photographer or source name"),
|
||||
imageSourceUrl: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe("Original URL where the image was sourced from"),
|
||||
tags: z
|
||||
.array(z.string())
|
||||
.optional()
|
||||
.describe("Tags for categorization (created automatically if new)"),
|
||||
};
|
||||
|
||||
export const catalogToolDefinitions = [
|
||||
|
||||
@@ -48,11 +48,15 @@ app.post("/", zValidator("json", upsertGlobalItemSchema), async (c) => {
|
||||
});
|
||||
|
||||
// Bulk upsert — per D-06, D-07, D-08
|
||||
app.post("/bulk", zValidator("json", bulkUpsertGlobalItemsSchema), async (c) => {
|
||||
const db = c.get("db");
|
||||
const { items } = c.req.valid("json");
|
||||
const result = await bulkUpsertGlobalItems(db, items);
|
||||
return c.json(result);
|
||||
});
|
||||
app.post(
|
||||
"/bulk",
|
||||
zValidator("json", bulkUpsertGlobalItemsSchema),
|
||||
async (c) => {
|
||||
const db = c.get("db");
|
||||
const { items } = c.req.valid("json");
|
||||
const result = await bulkUpsertGlobalItems(db, items);
|
||||
return c.json(result);
|
||||
},
|
||||
);
|
||||
|
||||
export { app as globalItemRoutes };
|
||||
|
||||
Reference in New Issue
Block a user