Skip to content

Fix/swagger cart paths#187

Open
littlepuppi wants to merge 5 commits intoprojectshft:masterfrom
littlepuppi:fix/swagger-cart-paths
Open

Fix/swagger cart paths#187
littlepuppi wants to merge 5 commits intoprojectshft:masterfrom
littlepuppi:fix/swagger-cart-paths

Conversation

@littlepuppi
Copy link

What

  • Fixed Swagger YAML structure
  • Merged duplicate paths blocks
  • Added /api/me/cart GET, POST, PATCH
  • Fixed invalid $ref schema usage

Why

  • Swagger UI was failing due to duplicate paths
  • PATCH endpoint was not rendering correctly

Testing

  • Swagger UI loads successfully
  • PATCH /api/me/cart/{productId} visible and documented

- Add comprehensive Swagger/OpenAPI 3.0 specification
- Implement all 8 required endpoints with full functionality
- Create complete test suite using chai-http (organized by feature)
- Add authentication middleware with JWT bearer tokens
- Implement brands, products, login, and cart operations
- Test all edge cases and error handling
- Follow TDD methodology throughout development
- Remove ES modules (type: module) from package.json
- Convert all test files from ES imports to CommonJS require
- Convert app/app.js and app/server.js to CommonJS
- Fix chai-http compatibility issues
- Add missing /api/products route to app.js
- All tests now passing (6/6)
- Convert to CommonJS for test compatibility
- Update login to accept any username/password combination
- Fix requireAuth to accept dynamic tokens
- Add POST /api/me/cart/:productId route
- Load data from JSON files instead of hardcoded arrays
- Fix brands/:brandId/products to use correct field names
- Update Swagger docs for flexible authentication
- All 19 tests passing
- Add POST /api/register endpoint for creating new accounts
- Auto-login after registration (returns token)
- Add 4 new tests for registration (all passing)
- Update Swagger documentation with register endpoint
- Update README with registration examples
- 20 tests passing total
"chai": "^4.3.10",
"chai-http": "^4.4.0",
"mocha": "^10.2.0",
"type": "module"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not a package, its breaking the npm install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants