Skip to content

feat: refactor cart module to use TypeORM for database interactions - #48

Open
christopher-leal wants to merge 1 commit into
rolling-scopes-school:mainfrom
christopher-leal:task-8
Open

feat: refactor cart module to use TypeORM for database interactions#48
christopher-leal wants to merge 1 commit into
rolling-scopes-school:mainfrom
christopher-leal:task-8

Conversation

@christopher-leal

@christopher-leal christopher-leal commented May 14, 2026

Copy link
Copy Markdown
  • Replaced in-memory cart storage with TypeORM + PostgreSQL
  • Added CartEntity and CartItemEntity with proper column types, composite PK, and eager-loaded relations; product_data (simple-json) stores full product shape on PUT so GET can return it without external calls
  • CartService is now fully async using injected TypeORM repositories
  • Added DatabaseModule that retrieves credentials from AWS Secrets Manager via DB_SECRET_ARN in production, falls back to env vars locally
  • Created lambda.ts entry point using @vendia/serverless-express to wrap the NestJS app for Lambda; reflect-metadata imported first to preserve decorator metadata
  • CORS enabled for CloudFront (https://d2i4ewulasiv4x.cloudfront.net) and local dev (http://localhost:3000)

- Added TypeORM integration for cart and cart item entities.
- Created DatabaseModule to manage database connection using AWS Secrets Manager for credentials.
- Updated CartService to handle cart operations with TypeORM.
- Refactored CartController to return frontend-friendly cart items.
- Introduced new entities: CartEntity and CartItemEntity.
- Updated package.json to include necessary dependencies for TypeORM and AWS SDK.
- Enhanced app.module.ts to include DatabaseModule and global configuration.
- Added serverless support with a new lambda.ts file for AWS Lambda deployment.
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.

1 participant