├── .gitignore ├── README.md ├── docs ├── DOCS.md ├── documentation │ ├── .nojekyll │ ├── assets │ │ ├── highlight.css │ │ ├── main.js │ │ ├── search.js │ │ └── style.css │ ├── classes │ │ ├── domain_customer_account_customer_account.CustomerAccount.html │ │ ├── domain_customer_address_customer_address.CustomerAddress.html │ │ ├── domain_customer_address_customer_address.CustomerAddressInvalidError.html │ │ ├── domain_customer_address_customer_address.CustomerAddressNonUSError.html │ │ ├── domain_customer_playlist_customer_playlist.CustomerPlaylist.html │ │ ├── errors.MaxNumberOfPlaylistsError.html │ │ ├── errors.MaxPlaylistSizeError.html │ │ ├── errors.PaymentInvalidError.html │ │ ├── errors.SubscriptionAlreadyUpgradedError.html │ │ └── errors.ValidationError.html │ ├── enums │ │ ├── models_customer_account_types.PaymentStatus.html │ │ └── models_customer_account_types.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 │ ├── interfaces │ │ └── entity_domain_event.ICreateDomainEvent.html │ ├── media │ │ ├── diagram.png │ │ └── header.png │ ├── modules.html │ ├── modules │ │ ├── domain_customer_account_customer_account.html │ │ ├── domain_customer_address_customer_address.html │ │ ├── domain_customer_playlist_customer_playlist.html │ │ ├── dto_customer_account_customer_account.html │ │ ├── dto_customer_address_customer_address.html │ │ ├── dto_customer_playlist_customer_playlist.html │ │ ├── entity_domain_event.html │ │ ├── errors.html │ │ ├── events_customer_account_created.html │ │ ├── events_customer_account_upgraded.html │ │ ├── events_customer_playlist_created.html │ │ ├── models_customer_account_types.html │ │ ├── models_customer_address_types.html │ │ ├── models_customer_playlist_types.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 │ │ ├── entity_domain_event.DomainEvent.html │ │ ├── models_customer_account_types.CreateCustomerAccountProps.html │ │ ├── models_customer_account_types.CustomerAccountProps.html │ │ ├── models_customer_account_types.NewCustomerAccountProps.html │ │ ├── models_customer_address_types.CustomerAddressProps.html │ │ ├── models_customer_playlist_types.CreateCustomerPlaylistProps.html │ │ ├── models_customer_playlist_types.CustomerPlaylistProps.html │ │ └── models_customer_playlist_types.NewCustomerPlaylistProps.html │ └── variables │ │ ├── events_customer_account_created.eventName.html │ │ ├── events_customer_account_created.eventSource.html │ │ ├── events_customer_account_upgraded.eventName.html │ │ ├── events_customer_account_upgraded.eventSource.html │ │ ├── events_customer_playlist_created.eventName.html │ │ └── events_customer_playlist_created.eventSource.html └── images │ ├── diagram.png │ ├── header-part-one.png │ └── header.png ├── onion-sounds ├── .gitignore ├── .npmignore ├── __mocks__ │ ├── 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 │ │ ├── domain │ │ │ ├── customer-account │ │ │ │ ├── __snapshots__ │ │ │ │ │ └── customer-account.test.ts.snap │ │ │ │ ├── customer-account.test.ts │ │ │ │ ├── customer-account.ts │ │ │ │ └── index.ts │ │ │ ├── customer-address │ │ │ │ ├── customer-address.test.ts │ │ │ │ └── customer-address.ts │ │ │ └── customer-playlist │ │ │ │ ├── __snapshots__ │ │ │ │ └── customer-playlist.test.ts.snap │ │ │ │ ├── customer-playlist.test.ts │ │ │ │ ├── customer-playlist.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 │ │ ├── entity │ │ │ ├── aggregate-root.ts │ │ │ ├── domain-event.ts │ │ │ ├── entity.ts │ │ │ ├── index.ts │ │ │ └── value-object.ts │ │ ├── errors │ │ │ ├── index.ts │ │ │ ├── max-number-of-playlists-error.ts │ │ │ ├── max-playlist-size-error.ts │ │ │ ├── payment-invalid-error.ts │ │ │ ├── playlist-not-found-error.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 │ │ ├── models │ │ │ ├── customer-account-types.ts │ │ │ ├── customer-address-types.ts │ │ │ ├── customer-playlist-types.ts │ │ │ └── index.ts │ │ ├── repositories │ │ │ ├── create-customer-account-repository │ │ │ │ ├── create-customer-account-repository.test.ts │ │ │ │ ├── create-customer-account-repository.ts │ │ │ │ └── index.ts │ │ │ ├── publish-event-recipient │ │ │ │ ├── index.ts │ │ │ │ ├── publish-event-recipient.test.ts │ │ │ │ └── publish-event-recipient.ts │ │ │ ├── retrieve-customer-account-repository │ │ │ │ ├── index.ts │ │ │ │ ├── retrieve-customer-account-repository.test.ts │ │ │ │ └── retrieve-customer-account-repository.ts │ │ │ └── update-customer-account-repository │ │ │ │ ├── index.ts │ │ │ │ ├── update-customer-account-repository.test.ts │ │ │ │ └── update-customer-account-repository.ts │ │ ├── schemas │ │ │ ├── customer-account.schema.test.ts │ │ │ ├── customer-account.schema.ts │ │ │ ├── customer-address.test.ts │ │ │ ├── customer-address.ts │ │ │ ├── customer-playlist.schema.test.ts │ │ │ └── customer-playlist.schema.ts │ │ └── use-cases │ │ │ ├── add-song-to-playlist │ │ │ ├── add-song-to-playlist.test.ts │ │ │ └── add-song-to-playlist.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 │ │ │ ├── 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 | # clean serverless code part 2 2 | 3 | Part 2 of using hexagonal architectures in our Serverless solutions to ensure clean separation of code and infrastructure; with examples written in the AWS CDK and TypeScript. 4 | 5 |  6 | 7 | The article can be found here: https://leejamesgilmore.medium.com/serverless-clean-architecture-code-with-domain-driven-design-part-2-9ad0882ff85b 8 | 9 | ## Part 1 10 | 11 |  12 | 13 | Part 1 of the article can be found here: https://leejamesgilmore.medium.com/serverless-clean-architecture-code-with-domain-driven-design-852796846d28 14 | 15 | ## Getting started 16 | 17 | To deploy the solution please look at the steps in the article linked above. 18 | 19 | ** The information and code provided are my own and I accept no responsibility on the use of the information. ** 20 | -------------------------------------------------------------------------------- /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 |