├── .gitignore ├── README.md ├── docs ├── DOCS.md ├── documentation │ ├── .nojekyll │ ├── assets │ │ ├── highlight.css │ │ ├── main.js │ │ ├── search.js │ │ └── style.css │ ├── classes │ │ ├── errors.MaxNumberOfPlaylistsError.html │ │ ├── errors.MaxPlaylistSizeError.html │ │ ├── errors.PaymentInvalidError.html │ │ ├── errors.ResourceNotFoundError.html │ │ ├── errors.SubscriptionAlreadyUpgradedError.html │ │ └── errors.ValidationError.html │ ├── enums │ │ ├── dto_customer_account_customer_account.PaymentStatus.html │ │ └── dto_customer_account_customer_account.SubscriptionType.html │ ├── functions │ │ ├── use_cases_create_customer_account_create_customer_account.createCustomerAccountUseCase.html │ │ ├── use_cases_create_customer_playlist_create_customer_playlist.createCustomerPlaylistUseCase.html │ │ ├── use_cases_retrieve_customer_account_retrieve_customer_account.retrieveCustomerAccountUseCase.html │ │ └── use_cases_upgrade_customer_account_upgrade_customer_account.upgradeCustomerAccountUseCase.html │ ├── index.html │ ├── media │ │ ├── diagram.png │ │ ├── header-part-one.png │ │ └── header.png │ ├── modules.html │ ├── modules │ │ ├── dto_customer_account_customer_account.html │ │ ├── dto_customer_address_customer_address.html │ │ ├── dto_customer_playlist_customer_playlist.html │ │ ├── errors.html │ │ ├── events_customer_account_created.html │ │ ├── events_customer_account_upgraded.html │ │ ├── events_customer_playlist_created.html │ │ ├── use_cases_create_customer_account_create_customer_account.html │ │ ├── use_cases_create_customer_playlist_create_customer_playlist.html │ │ ├── use_cases_retrieve_customer_account_retrieve_customer_account.html │ │ └── use_cases_upgrade_customer_account_upgrade_customer_account.html │ ├── types │ │ ├── dto_customer_account_customer_account.CreateCustomerAccountDto.html │ │ ├── dto_customer_account_customer_account.CustomerAccountDto.html │ │ ├── dto_customer_account_customer_account.NewCustomerAccountDto.html │ │ ├── dto_customer_address_customer_address.CustomerAddressDto.html │ │ ├── dto_customer_playlist_customer_playlist.CustomerPlaylistDto.html │ │ ├── dto_customer_playlist_customer_playlist.NewCustomerPlaylistDto.html │ │ └── dto_customer_playlist_customer_playlist.NewCustomerPlaylistSongDto.html │ └── variables │ │ ├── events_customer_account_created.eventName.html │ │ ├── events_customer_account_created.eventSchema.html │ │ ├── events_customer_account_created.eventSource.html │ │ ├── events_customer_account_created.eventVersion.html │ │ ├── events_customer_account_upgraded.eventName.html │ │ ├── events_customer_account_upgraded.eventSchema.html │ │ ├── events_customer_account_upgraded.eventSource.html │ │ ├── events_customer_account_upgraded.eventVersion.html │ │ ├── events_customer_playlist_created.eventName.html │ │ ├── events_customer_playlist_created.eventSchema.html │ │ ├── events_customer_playlist_created.eventSource.html │ │ └── events_customer_playlist_created.eventVersion.html └── images │ ├── diagram.png │ └── header.png ├── onion-sounds ├── .gitignore ├── .npmignore ├── .nvmrc ├── __mocks__ │ ├── @aws-lambda-powertools │ │ └── logger.ts │ ├── aws-sdk.ts │ └── uuid.ts ├── bin │ └── onion-sounds.ts ├── cdk.json ├── jest.config.js ├── package-lock.json ├── package.json ├── packages │ ├── apigw-error-handler │ │ ├── error-handler.test.ts │ │ ├── error-handler.ts │ │ └── index.ts │ ├── logger │ │ ├── index.ts │ │ └── logger.ts │ └── schema-validator │ │ ├── index.ts │ │ ├── schema-validator.test.ts │ │ └── schema-validator.ts ├── stateful │ └── stateful.ts ├── stateless │ ├── src │ │ ├── adapters │ │ │ ├── primary │ │ │ │ ├── add-song-to-playlist │ │ │ │ │ ├── add-song-to-playlist.adapter.test.ts │ │ │ │ │ ├── add-song-to-playlist.adapter.ts │ │ │ │ │ ├── add-song-to-playlist.schema.test.ts │ │ │ │ │ └── add-song-to-playlist.schema.ts │ │ │ │ ├── create-customer-account │ │ │ │ │ ├── create-customer-account.adapter.test.ts │ │ │ │ │ ├── create-customer-account.adapter.ts │ │ │ │ │ ├── create-customer-account.schema.test.ts │ │ │ │ │ └── create-customer-account.schema.ts │ │ │ │ ├── create-customer-playlist │ │ │ │ │ ├── create-customer-playlist.adpater.test.ts │ │ │ │ │ ├── create-customer-playlist.adpater.ts │ │ │ │ │ ├── create-customer-playlist.schema.test.ts │ │ │ │ │ └── create-customer-playlist.schema.ts │ │ │ │ ├── retrieve-customer-account │ │ │ │ │ ├── retrieve-customer-account.adapter.test.ts │ │ │ │ │ └── retrieve-customer-account.adapter.ts │ │ │ │ └── upgrade-customer-account │ │ │ │ │ ├── upgrade-customer-account.adapter.test.ts │ │ │ │ │ └── upgrade-customer-account.adapter.ts │ │ │ └── secondary │ │ │ │ ├── database-adapter │ │ │ │ ├── database-adapter.test.ts │ │ │ │ ├── database-adapter.ts │ │ │ │ └── index.ts │ │ │ │ └── event-adapter │ │ │ │ ├── event-adapter.test.ts │ │ │ │ ├── event-adapter.ts │ │ │ │ └── index.ts │ │ ├── config │ │ │ ├── config.test.ts │ │ │ ├── config.ts │ │ │ └── index.ts │ │ ├── dto │ │ │ ├── customer-account │ │ │ │ ├── customer-account.ts │ │ │ │ └── index.ts │ │ │ ├── customer-address │ │ │ │ ├── customer-address.ts │ │ │ │ └── index.ts │ │ │ └── customer-playlist │ │ │ │ ├── customer-playlist.ts │ │ │ │ └── index.ts │ │ ├── errors │ │ │ ├── index.ts │ │ │ ├── max-number-of-playlists-error.ts │ │ │ ├── max-playlist-size-error.ts │ │ │ ├── payment-invalid-error.ts │ │ │ ├── playlist-not-found-error.ts │ │ │ ├── resource-not-found.ts │ │ │ ├── subscription-already-upgraded-error.ts │ │ │ └── validation-error.ts │ │ ├── events │ │ │ ├── customer-account-created.ts │ │ │ ├── customer-account-updated.ts │ │ │ ├── customer-account-upgraded.ts │ │ │ ├── customer-playlist-created.ts │ │ │ └── song-added-to-playlist.ts │ │ ├── schemas │ │ │ ├── customer-account.schema.test.ts │ │ │ ├── customer-account.schema.ts │ │ │ ├── customer-address.schema.test.ts │ │ │ ├── customer-address.schema.ts │ │ │ ├── customer-playlist.schema.test.ts │ │ │ └── customer-playlist.schema.ts │ │ ├── shared │ │ │ ├── date-utils.ts │ │ │ └── index.ts │ │ └── use-cases │ │ │ ├── add-song-to-playlist │ │ │ ├── add-song-to-playlist.test.ts │ │ │ ├── add-song-to-playlist.ts │ │ │ └── index.ts │ │ │ ├── create-customer-account │ │ │ ├── create-customer-account.test.ts │ │ │ ├── create-customer-account.ts │ │ │ └── index.ts │ │ │ ├── create-customer-playlist │ │ │ ├── create-customer-playlist.test.ts │ │ │ ├── create-customer-playlist.ts │ │ │ └── index.ts │ │ │ ├── retrieve-customer-account │ │ │ ├── index.ts │ │ │ ├── retrieve-customer-account.test.ts │ │ │ └── retrieve-customer-account.ts │ │ │ └── upgrade-customer-account │ │ │ ├── index.ts │ │ │ ├── upgrade-customer-account.test.ts │ │ │ └── upgrade-customer-account.ts │ └── stateless.ts ├── tsconfig.json └── typedoc.json ├── open-api └── customer-accounts-open-api-v1.yml └── postman └── Serverless Clean Architecture.postman_collection.json /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | onion-sounds/coverage/ 3 | onion-sounds/cdk-outputs.json 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Serverless Lightweight Clean Code Approach 2 | 3 | An opinionated example of a lightweight 'clean code' Lambda function architecture, with code examples written in the AWS CDK and TypeScript. 4 | 5 |  6 | 7 | The article can be found here: https://medium.com/@leejamesgilmore/serverless-lightweight-clean-code-approach-84133c90eeeb 8 | 9 | ## Getting started 10 | 11 | To deploy the solution please look at the steps in the article linked above. 12 | 13 | ** The information and code provided are my own and I accept no responsibility on the use of the information. ** 14 | -------------------------------------------------------------------------------- /docs/DOCS.md: -------------------------------------------------------------------------------- 1 | # Onion Sounds - Customer Account Domain 2 | 3 | ## Introduction 4 | 5 | This documentation details the use cases involved in the customer account domain 6 | 7 | ## Diagram 8 | 9 |  10 | -------------------------------------------------------------------------------- /docs/documentation/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/documentation/assets/highlight.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --light-code-background: #FFFFFF; 3 | --dark-code-background: #1E1E1E; 4 | } 5 | 6 | @media (prefers-color-scheme: light) { :root { 7 | --code-background: var(--light-code-background); 8 | } } 9 | 10 | @media (prefers-color-scheme: dark) { :root { 11 | --code-background: var(--dark-code-background); 12 | } } 13 | 14 | :root[data-theme='light'] { 15 | --code-background: var(--light-code-background); 16 | } 17 | 18 | :root[data-theme='dark'] { 19 | --code-background: var(--dark-code-background); 20 | } 21 | 22 | pre, code { background: var(--code-background); } 23 | -------------------------------------------------------------------------------- /docs/documentation/index.html: -------------------------------------------------------------------------------- 1 |
This documentation details the use cases involved in the customer account domain
24 | 25 | 26 |Const