dev #2346
openDescription
Fixed Pricing Issue:
Updated createToolStepOne to handle pricingPlans as an array and insert into pricingPlans table.
File: src/api/tools/createToolStepOne.ts
Added Slug Field:
Added slug (varchar, 255, not null, unique) to aiTools.
Implemented generateUniqueSlug using slugify and added to createToolStepOne.
Files: src/db/schema.ts, src/api/tools/createToolStepOne.ts
Migration: Added slug column and populated existing records.
Updated Get All Tools Route:
Added slug to response and slug query parameter for filtering.
File: src/api/tools/getAllTools.ts
Endpoint: GET /api/tools?slug=
Acceptance Criteria
Pricing:
Step 1 form saves pricingPlans to pricingPlans table.
Verify: SELECT * FROM pricingPlans WHERE toolId = <newTool.id>.
Slug:
aiTools table has slug column, populated on tool creation.
Verify: SELECT slug FROM aiTools WHERE id = <newTool.id>.
Get All Tools:
Response includes slug for each tool.
?slug= returns single tool or empty result.
Verify: GET /api/tools and GET /api/tools?slug=imageai-creator.