From e0ec597474a27dee55b35e7d7e9226d29a6b8306 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Mon, 18 Dec 2023 01:21:51 +0330 Subject: [PATCH] feat: :sparkles: supporting Inbox and Outbox Pattern #70 --- Makefile | 93 +++--- .../docs.go | 2 +- .../swagger.json | 0 .../swagger.yaml | 0 .../docs.go | 2 +- .../swagger.json | 0 .../swagger.yaml | 0 .../{order_service => orderservice}/docs.go | 2 +- .../swagger.json | 0 .../swagger.yaml | 0 .../products.proto | 0 .../orders.proto | 0 .../docker-compose.infrastructure.yaml | 292 +++++++++--------- .../docker-compose/monitoring/prometheus.yml | 2 +- deployments/docker-compose/traefik.yaml | 4 +- internal/pkg/core/core_fx.go | 8 +- internal/pkg/core/customtypes/custom_time.go | 2 +- internal/pkg/core/events/event.go | 14 +- internal/pkg/core/messaging/mocks/IMessage.go | 9 +- .../otel/tracing/producer/producer.go | 2 +- .../message_persistence_service.go | 24 -- ...tence_repository.go => message_service.go} | 14 +- .../messaging/persistmessage/store_message.go | 4 +- internal/pkg/core/messaging/types/message.go | 23 +- .../messaging/types/mock_IMessage_test.go | 9 +- internal/pkg/core/mocks/EventSerializer.go | 17 +- internal/pkg/core/mocks/IDomainEvent.go | 7 +- internal/pkg/core/mocks/IEvent.go | 7 +- .../serializer/contratcs/event_serializer.go | 17 + .../contratcs/event_serrialization_result.go | 6 + .../contratcs/message_serializer.go | 16 + .../contratcs/metadata_serializer.go | 8 + .../serializer/{ => contratcs}/serilizer.go | 2 +- .../pkg/core/serializer/event_serializer.go | 154 --------- .../core/serializer/json/event_serializer.go | 134 ++++++++ .../core/serializer/json/json_serializer.go | 4 +- .../serializer/json/json_serilizer_test.go | 5 +- .../serializer/json/message_serializer.go | 1 + .../serializer/json/metadata_serializer.go | 44 +++ .../core/serializer/metadata_serializer.go | 48 --- internal/pkg/es/errors/errors.go | 2 +- .../errors/aggregate_not_found_error.go | 2 +- .../errors/append_to_stream_error.go | 2 +- .../errors/delete_stream_error.go | 2 +- .../eventstroredb/errors/read_stream_error.go | 2 +- .../errors/stream_not_found_error.go | 2 +- .../errors/truncate_stream_error.go | 2 +- internal/pkg/eventstroredb/esdb_serilizer.go | 64 +++- ...sdb_subscription_check_point_repository.go | 2 +- internal/pkg/eventstroredb/event_store.go | 24 +- .../custom_grpc_errors.go | 2 +- .../grpc_error_parser.go | 6 +- .../{grpcErrors => grpcerrors}/grpc_errors.go | 2 +- .../error_interceptor.go | 10 +- internal/pkg/grpc/server.go | 2 +- internal/pkg/health/health_endpoint.go | 2 +- .../config/echo_http_options.go | 0 .../contracts/echoserver.go | 2 +- .../contracts/route_builder.go | 0 .../custom_echo_fx.go | 4 +- .../echo_server.go | 16 +- .../hadnlers/problemdetail_error_handler.go | 2 +- .../middlewares/ip_ratelimit/config.go | 0 .../middlewares/ip_ratelimit/ip_ratelimit.go | 0 .../middlewares/log/config.go | 0 .../middlewares/log/log_middleware.go | 0 .../middlewares/otel_metrics/config.go | 0 .../middlewares/otel_metrics/metric.go | 0 .../otel_metrics/metrics_middleware.go | 0 .../middlewares/otel_metrics/view.go | 0 .../middlewares/otel_tracing/config.go | 0 .../otel_tracing/tracing_middleware.go | 0 .../middlewares/problem_detail/config.go | 2 +- .../problem_detail_middleware.go | 2 +- internal/pkg/http/http_fx.go | 2 +- .../contracts/contracts.go | 0 .../customerrors}/api_error.go | 0 .../customerrors}/application_error.go | 0 .../customerrors}/bad_request_error.go | 0 .../customerrors}/conflict_error.go | 0 .../customerrors}/custom_errors.go | 2 +- .../customerrors}/custom_errors_test.go | 4 +- .../customerrors}/domain_error.go | 0 .../customerrors}/forbiden_error.go | 0 .../customerrors}/internal_server_error.go | 0 .../customerrors}/marshaling_error.go | 0 .../customerrors}/not_found_error.go | 0 .../customerrors}/unauthorized_error.go | 0 .../customerrors}/unmarshaling_error.go | 0 .../customerrors}/validation_error.go | 0 .../custom_problem_details_errors.go | 0 .../problemdetails}/option_builder.go | 0 .../problemdetails}/problem_detail_parser.go | 4 +- .../problemdetails}/problem_details.go | 2 +- .../problemdetails}/problem_details_test.go | 2 +- .../repository/mongo_generic_repository.go | 2 +- .../mongo_generic_repository_test.go | 2 +- internal/pkg/otel/metrics/metrics.go | 2 +- internal/pkg/otel/metrics/metrics_fx.go | 2 +- internal/pkg/otel/metrics/metrics_test.go | 2 +- internal/pkg/otel/tracing/utils/utils.go | 9 +- internal/pkg/postgresgorm/db.go | 28 +- internal/pkg/postgresgorm/gorm_options.go | 13 + internal/pkg/postgresgorm/helpers.go | 70 ----- internal/pkg/postgresgorm/helpers/helpers.go | 32 +- .../repository/gorm_generic_repository.go | 4 +- .../gorm_generic_repository_test.go | 2 +- internal/pkg/postgresgorm/scopes/scopes.go | 88 ++++++ .../message_persistence_dbcontext.go | 12 + ...ository.go => postgres_message_service.go} | 96 +++++- ...st.go => postgres_message_service_test.go} | 24 +- .../postgres_messaging_fx.go | 2 +- .../pkg/rabbitmq/bus/rabbitmq_bus_test.go | 57 +++- .../rabbitmq/consumer/rabbitmq_consumer.go | 86 +++--- .../consumer/rabbitmq_consumer_test.go | 5 +- .../rabbitmq/producer/rabbitmq_producer.go | 33 +- .../producer/rabbitmq_producer_test.go | 22 +- internal/pkg/rabbitmq/rabbitmq_fx.go | 5 +- internal/pkg/rabbitmq/types/connection.go | 2 +- .../pkg/reflection/typemapper/type_mapper.go | 12 +- .../reflection/typemapper/type_mapper_test.go | 2 +- .../{error_utils => errorutils}/errors.go | 2 +- .../errors_test.go | 0 internal/services/catalog_read_service/.env | 1 - internal/services/catalog_write_service/.env | 1 - .../.air.toml | 0 .../.dockerignore | 0 internal/services/catalogreadservice/.env | 1 + .../.gitignore | 0 .../.golangci.yml | 0 .../Dockerfile | 0 .../Makefile | 0 .../arch-go.yml | 0 .../client.http | 0 .../cmd/app/main.go | 0 .../cmd/migration/.gitkeep | 0 .../config/config.development.json | 6 +- .../config/config.go | 0 .../config/config.test.json | 6 +- .../config/confix_fx.go | 0 .../docs/docs.go | 0 .../docs/swagger.json | 0 .../docs/swagger.yaml | 0 .../go.mod | 18 +- .../go.sum | 115 ++----- .../mappings/mapping_profile.go | 0 .../mediator/mediator_configurations.go | 0 .../products_module_configurator.go | 0 .../rabbitmq/rabbitmq_configuration.go | 0 .../internal/products/consts/consts.go | 0 .../data/product_cache_repository.go | 0 .../contracts/data/product_repository.go | 0 .../contracts/params/product_route_params.go | 0 .../repositories/mongo_product_repository.go | 0 .../repositories/redis_product_repository.go | 0 .../internal/products/dto/product_dto.go | 0 .../creating_product/v1/create_product.go | 0 .../v1/create_product_handler.go | 2 +- .../v1/dtos/create_product_response_dto.go | 0 .../externalevents/product_created.go | 0 .../product_created_consumer.go | 2 +- .../v1/commands/delete_product.go | 0 .../v1/commands/delete_product_handler.go | 2 +- .../external_events/product_deleted.go | 0 .../product_deleted_consumer.go | 2 +- .../v1/dtos/get_product_by_id_request_dto.go | 0 .../v1/dtos/get_product_by_id_response_dto.go | 0 .../endpoints/get_product_by_id_endpoint.go | 2 +- .../v1/queries/get_product_by_id.go | 0 .../v1/queries/get_product_by_id_handler.go | 2 +- .../v1/dtos/get_products_request_dto.go | 0 .../v1/dtos/get_products_response_dto.go | 0 .../v1/endpoints/get_products_endpoint.go | 2 +- .../v1/queries/get_products.go | 0 .../v1/queries/get_products_handler.go | 2 +- .../v1/dtos/search_products_request_dto.go | 0 .../v1/dtos/search_products_response_dto.go | 0 .../v1/endpoints/search_products_endpoint.go | 2 +- .../v1/queries/search_products.go | 0 .../v1/queries/search_products_handler.go | 2 +- .../v1/commands/update_product.go | 0 .../v1/commands/update_product_handler.go | 2 +- .../external_events/product_updated.go | 0 .../product_updated_consumer.go | 2 +- .../internal/products/models/product.go | 0 .../internal/products/products_fx.go | 2 +- .../internal/shared/app/app.go | 0 .../internal/shared/app/application.go | 0 .../shared/app/application_builder.go | 0 .../internal/shared/app/test/test_app.go | 2 +- .../shared/app/test/test_application.go | 0 .../app/test/test_application_builder.go | 0 .../catalogs/catalogs_configurator.go | 2 +- .../catalogs/catalogs_configurator_swagger.go | 2 +- .../configurations/catalogs/catalogs_fx.go | 0 .../infrastructure_configurator.go | 0 .../infrastructure/infrastructure_fx.go | 2 +- .../shared/contracts/catalogs_metrics.go | 0 .../integration/integration_test_fixture.go | 0 .../mocks/ProductCacheRepository.go | 0 .../mocks/ProductRepository.go | 0 .../mocks/UnsafeProductsServiceServer.go | 0 .../readme.md | 0 .../revive-config.toml | 0 .../staticcheck.conf | 0 .../taskfile.yml | 0 .../taskfile_db.yml | 0 .../taskfile_test.yml | 0 .../v1/get_product_by_id_test.go | 0 .../v1/get_products_endpoint_test.go | 0 .../data/mongo_product_repository_test.go | 2 +- .../v1/commands/create_product_test.go | 0 .../v1/events/product_created_test.go | 0 .../v1/commands/delete_product_test.go | 0 .../v1/events/product_deleted_test.go | 0 .../v1/queries/get_product_by_id_test.go | 0 .../v1/queries/get_products_handler_test.go | 0 .../commands/update_product_handler_test.go | 0 .../v1/events/product_updated_test.go | 0 .../test/load_tests/.openapi-generator-ignore | 0 .../test/load_tests/.openapi-generator/FILES | 0 .../load_tests/.openapi-generator/VERSION | 0 .../test/load_tests/README.md | 0 .../test/load_tests/script.js | 0 .../.air.toml | 0 .../.dockerignore | 0 internal/services/catalogwriteservice/.env | 1 + .../.gitignore | 0 .../.golangci.yml | 0 .../Dockerfile | 0 .../Makefile | 0 .../arch-go.yml | 0 .../atlas.hcl | 0 .../client.http | 0 .../cmd/app/main.go | 0 .../cmd/migration/main.go | 0 .../config/app_options.go | 0 .../config/config.development.json | 6 +- .../config/config.test.json | 6 +- .../config/config_fx.go | 0 .../db/fixtures/products/products.yaml | 0 .../db/migrations/atlas/20230919170700.sql | 0 .../db/migrations/atlas/atlas.sum | 0 .../goose/00001_enable_uuid_extension.sql | 0 .../goose/00002_create_products_table.sql | 0 .../db/migrations/atlas/goose/atlas.sum | 0 .../db/migrations/atlas/readme.md | 0 .../000001_enable_uuid_extension.down.sql | 0 .../000001_enable_uuid_extension.up.sql | 0 .../000002_create_products_table.down.sql | 0 .../000002_create_products_table.up.sql | 0 .../db/migrations/go-migrate/atlas.sum | 0 .../db/migrations/go-migrate/readme.md | 0 .../db/migrations/go-migrate/schema.sql | 0 .../00001_enable_uuid_extension.sql | 0 .../00002_create_products_table.sql | 0 .../db/migrations/goose-migrate/readme.md | 0 .../docs/docs.go | 0 .../docs/swagger.json | 0 .../docs/swagger.yaml | 0 .../go.mod | 0 .../go.sum | 0 .../configurations/endpoints/endpoints.go | 0 .../mappings/mapping_profile.go | 2 +- .../configurations/mediator/mediator.go | 0 .../products_module_configurator.go | 0 .../rabbitmq/rabbitmq_configurations.go | 0 .../products/contracts/product_repository.go | 0 .../data/models/product_data_model.go | 18 +- .../repositories/pg_product_repository.go | 18 +- .../v1/fxparams/product_handler_params.go | 0 .../dtos/v1/fxparams/product_route_params.go | 0 .../internal/products/dtos/v1/product_dto.go | 0 .../creatingproduct/v1/create_product.go | 0 .../v1/create_product_endpoint.go | 2 +- .../v1/create_product_handler.go | 8 +- .../v1/dtos/create_product_request_dto.go | 0 .../v1/dtos/create_product_response_dto.go | 0 .../v1/events/domainevents/.gitkeep | 0 .../integrationevents/product_created.go | 0 .../deletingproduct/v1/delete_product.go | 0 .../v1/delete_product_endpoint.go | 2 +- .../v1/delete_product_handler.go | 4 +- .../v1/dtos/delete_product_request_dto.go | 0 .../integrationevents/product_deleted.go | 0 .../v1/dtos/get_product_by_id_request_dto.go | 0 .../v1/dtos/get_product_by_id_response_dto.go | 0 .../v1/get_product_by_id.go | 0 .../v1/get_product_by_id_endpoint.go | 2 +- .../v1/get_product_by_id_handler.go | 4 +- .../v1/dtos/get_products_request_dto.go | 0 .../v1/dtos/get_products_response_dto.go | 0 .../gettingproducts}/v1/get_products.go | 0 .../v1/get_products_endpoint.go | 4 +- .../v1/get_products_handler.go | 8 +- .../v1/dtos/search_products_request_dto.go | 0 .../v1/dtos/search_products_response_dto.go | 0 .../searchingproduct/v1/search_products.go | 0 .../v1/search_products_endpoint.go | 2 +- .../v1/search_products_handler.go | 4 +- .../v1/dtos/update_product_request_dto.go | 0 .../integrationevents/product_updated.go | 0 .../updatingproduct/v1/update_product.go | 0 .../v1/update_product_endpoint.go | 2 +- .../v1/update_product_handler.go | 4 +- .../internal/products/models/product.go | 2 +- .../internal/products/products_fx.go | 4 +- .../internal/shared/app/app.go | 0 .../internal/shared/app/application.go | 0 .../shared/app/application_builder.go | 0 .../internal/shared/app/test/test_app.go | 6 +- .../shared/app/test/test_application.go | 0 .../app/test/test_application_builder.go | 0 .../catalogs/catalogs_configurator.go | 14 +- .../catalogs_configurator_migration.go | 23 +- .../catalogs/catalogs_configurator_seed.go | 104 +++++++ .../catalogs/catalogs_configurator_swagger.go | 2 +- .../configurations/catalogs/catalogs_fx.go | 0 .../infrastructure_configurator.go | 0 .../infrastructure/infrastructure_fx.go | 2 +- .../shared/contracts/catalogs_metrics.go | 0 .../internal/shared/data/data_fx.go | 0 .../data/dbcontext/catalogs_dbcontext.go | 48 +-- .../data/dbcontext/catalogs_dbcontext_test.go | 124 ++++++-- .../internal/shared/data/scopes/scopes.go | 3 + .../shared/grpc/genproto/products.pb.go | 39 +-- .../shared/grpc/genproto/products_grpc.pb.go | 4 +- .../grpc/product_grpc_service_server.go | 8 +- .../integration/integration_test_fixture.go | 24 +- .../unittest/unit_test_fixture.go | 142 +++++---- .../mocks/CatalogContext.go | 0 .../mocks/ProductRepository.go | 0 .../mocks/ProductsServiceClient.go | 0 .../mocks/ProductsServiceServer.go | 0 .../mocks/UnsafeProductsServiceServer.go | 0 .../readme.md | 0 .../revive-config.toml | 0 .../taskfile.yml | 0 .../taskfile_db.yml | 0 .../taskfile_test.yml | 0 .../creatingproduct/v1/create_product_test.go | 0 .../deletingproduct/v1/delete_product_test.go | 2 +- .../v1/get_product_by_id_test.go | 2 +- .../gettingproducts/v1/get_products_test.go | 0 .../v1/search_products_test.go | 0 .../updatingproduct/v1/update_product_test.go | 2 +- .../grpc/product_grpc_service_server_test.go | 6 +- .../pg_product_repository_integration_test.go | 18 +- .../catalogs_unit_of_work_integration_test.go | 10 +- .../creatingproduct/v1/create_product_test.go | 4 +- .../deletingproduct/v1/delete_product_test.go | 4 +- .../v1/get_product_by_id_test.go | 4 +- .../gettingproducts/v1/get_products_test.go | 4 +- .../updatingproduct/v1/update_product_test.go | 12 +- .../test/load/.openapi-generator-ignore | 0 .../test/load/.openapi-generator/FILES | 0 .../test/load/.openapi-generator/VERSION | 0 .../test/load/README.md | 0 .../test/load/script.js | 0 .../v1/create_product_handler_unit_test.go | 4 +- .../v1/create_product_unit_test.go | 0 .../v1/delete_product_handler_unit_test.go | 6 +- .../v1/delete_product_unit_test.go | 0 .../v1/get_product_by_Id_unit_test.go | 0 .../v1/get_product_by_id_handler_unit_test.go | 8 +- .../v1/get_products_handler_unit_test.go | 6 +- .../v1/search_products_unit_test.go | 2 +- .../v1/update_product_handler_unit_test.go | 12 +- .../v1/update_product_unit_test.go | 0 .../unit/products/mappings_profile_test.go | 6 +- internal/services/order_service/.env | 1 - .../{order_service => orderservice}/.air.toml | 0 .../.dockerignore | 0 internal/services/orderservice/.env | 1 + .../.golangci.yml | 0 .../Dockerfile | 0 .../{order_service => orderservice}/Makefile | 0 .../arch-go.yml | 0 .../client.http | 0 .../cmd/app/main.go | 0 .../cmd/migration/.gitkeep | 0 .../config/config.development.json | 6 +- .../config/config.go | 0 .../config/config.test.json | 6 +- .../config/config_fx.go | 0 .../docs/docs.go | 0 .../docs/swagger.json | 0 .../docs/swagger.yaml | 0 .../{order_service => orderservice}/go.mod | 15 +- .../{order_service => orderservice}/go.sum | 41 ++- .../mappings/mappings_profile.go | 0 .../mediatr/mediator_configurations.go | 0 .../orders_module_configurator.go | 2 +- .../rabbitmq/rabbitmq_configurations.go | 0 .../params/order_projection_params.go | 0 .../contracts/params/order_route_params.go | 0 .../repositories/order_repository.go | 0 .../elastic_order_read_repository.go | 0 .../mongo_order_read_repository.go | 0 .../internal/orders/dtos/v1/order_dto.go | 0 .../internal/orders/dtos/v1/order_read_dto.go | 0 .../internal/orders/dtos/v1/shopItem_dto.go | 0 .../orders/dtos/v1/shopItem_read_dto.go | 0 .../invalid_delivery_address_error.go | 2 +- .../domain_exceptions/invalid_email_error.go | 2 +- .../order_domain_errors_test.go | 4 +- .../order_items_required_errors.go | 2 +- .../order_not_found_error.go | 2 +- .../v1/commands/create_order.go | 0 .../v1/commands/create_order_handler.go | 2 +- .../v1/dtos/create_order_request_dto.go | 0 .../v1/dtos/create_order_response_dto.go | 0 .../v1/endpoints/create_order_endpoint.go | 2 +- .../v1/events/domain_events/order_created.go | 2 +- .../integration_events/order_created.go | 0 .../v1/dtos/get_order_by_id_request_dto.go | 0 .../v1/dtos/get_order_by_id_response_dto.go | 0 .../v1/endpoints/get_order_by_id_endpoint.go | 2 +- .../v1/queries/get_order_by_id.go | 0 .../v1/queries/get_order_by_id_handler.go | 2 +- .../v1/dtos/get_orders_request_dto.go | 0 .../v1/dtos/get_orders_response_dto.go | 0 .../v1/endpoints/get_orders_endpoint.go | 2 +- .../getting_orders/v1/queries/get_orders.go | 0 .../v1/queries/get_orders_handler.go | 2 +- .../v1/commands/submit_order.go | 0 .../events/domain_events/order_submitted.go | 2 +- .../v1/commands/update_shopping_card.go | 0 .../v1/events/shopping_card_updated.go | 0 .../orders/models/orders/aggregate/order.go | 2 +- .../models/orders/read_models/order_read.go | 0 .../orders/read_models/shop_item_read.go | 0 .../models/orders/value_objects/shop_item.go | 0 .../internal/orders/orders_fx.go | 2 +- .../projections/elastic_order_projection.go | 0 .../projections/mongo_order_projection.go | 2 +- .../internal/shared/app/app.go | 0 .../internal/shared/app/application.go | 0 .../shared/app/application_builder.go | 0 .../internal/shared/app/test/test_app.go | 2 +- .../shared/app/test/test_application.go | 0 .../app/test/test_application_builder.go | 0 .../infrastructure_configurator.go | 0 .../infrastructure/infrastructure_fx.go | 2 +- .../orders/orders_configurator.go | 2 +- .../orders/orders_configurator_swagger.go | 2 +- .../shared/configurations/orders/orders_fx.go | 0 .../shared/contracts/orders_metrics.go | 0 .../shared/grpc/genproto/orders.pb.go | 2 +- .../shared/grpc/genproto/orders_grpc.pb.go | 4 +- .../shared/grpc/order_grpc_service_server.go | 2 +- .../integration/integration_test_fixture.go | 0 .../mocks/InvalidDeliveryAddressError.go | 0 .../mocks/InvalidEmailAddressError.go | 0 .../mocks/OrderElasticRepository.go | 0 .../mocks/OrderMongoRepository.go | 0 .../mocks/OrderNotFoundError.go | 0 .../mocks/OrderShopItemsRequiredError.go | 0 .../mocks/OrdersServiceClient.go | 0 .../mocks/OrdersServiceServer.go | 0 .../mocks/UnsafeOrdersServiceServer.go | 0 .../mocks/orderReadRepository.go | 0 .../{order_service => orderservice}/readme.md | 0 .../revive-config.toml | 0 .../taskfile.yml | 0 .../taskfile_db.yml | 0 .../taskfile_test.yml | 0 .../creating_order/v1/create_order_test.go | 0 .../v1/get_order_by_id_test.go | 0 .../grpc/order_grpc_service_server_test.go | 0 .../creating_order/v1/create_order_test.go | 0 .../v1/get_order_by_id_test.go | 0 taskfile.yml | 64 ++-- 473 files changed, 1635 insertions(+), 1257 deletions(-) rename api/openapi/{catalog_read_service => catalogreadservice}/docs.go (99%) rename api/openapi/{catalog_read_service => catalogreadservice}/swagger.json (100%) rename api/openapi/{catalog_read_service => catalogreadservice}/swagger.yaml (100%) rename api/openapi/{catalog_write_service => catalogwriteservice}/docs.go (99%) rename api/openapi/{catalog_write_service => catalogwriteservice}/swagger.json (100%) rename api/openapi/{catalog_write_service => catalogwriteservice}/swagger.yaml (100%) rename api/openapi/{order_service => orderservice}/docs.go (99%) rename api/openapi/{order_service => orderservice}/swagger.json (100%) rename api/openapi/{order_service => orderservice}/swagger.yaml (100%) rename api/protobuf/{catalog_write_service => catalogwriteservice}/products.proto (100%) rename api/protobuf/{order_service => orderservice}/orders.proto (100%) delete mode 100644 internal/pkg/core/messaging/persistmessage/message_persistence_service.go rename internal/pkg/core/messaging/persistmessage/{message_persistence_repository.go => message_service.go} (61%) create mode 100644 internal/pkg/core/serializer/contratcs/event_serializer.go create mode 100644 internal/pkg/core/serializer/contratcs/event_serrialization_result.go create mode 100644 internal/pkg/core/serializer/contratcs/message_serializer.go create mode 100644 internal/pkg/core/serializer/contratcs/metadata_serializer.go rename internal/pkg/core/serializer/{ => contratcs}/serilizer.go (95%) delete mode 100644 internal/pkg/core/serializer/event_serializer.go create mode 100644 internal/pkg/core/serializer/json/event_serializer.go create mode 100644 internal/pkg/core/serializer/json/message_serializer.go create mode 100644 internal/pkg/core/serializer/json/metadata_serializer.go delete mode 100644 internal/pkg/core/serializer/metadata_serializer.go rename internal/pkg/grpc/{grpcErrors => grpcerrors}/custom_grpc_errors.go (99%) rename internal/pkg/grpc/{grpcErrors => grpcerrors}/grpc_error_parser.go (96%) rename internal/pkg/grpc/{grpcErrors => grpcerrors}/grpc_errors.go (99%) rename internal/pkg/grpc/interceptors/{grpc_error => grpcerror}/error_interceptor.go (87%) rename internal/pkg/http/{custom_echo => customecho}/config/echo_http_options.go (100%) rename internal/pkg/http/{custom_echo => customecho}/contracts/echoserver.go (96%) rename internal/pkg/http/{custom_echo => customecho}/contracts/route_builder.go (100%) rename internal/pkg/http/{custom_echo => customecho}/custom_echo_fx.go (98%) rename internal/pkg/http/{custom_echo => customecho}/echo_server.go (92%) rename internal/pkg/http/{custom_echo => customecho}/hadnlers/problemdetail_error_handler.go (86%) rename internal/pkg/http/{custom_echo => customecho}/middlewares/ip_ratelimit/config.go (100%) rename internal/pkg/http/{custom_echo => customecho}/middlewares/ip_ratelimit/ip_ratelimit.go (100%) rename internal/pkg/http/{custom_echo => customecho}/middlewares/log/config.go (100%) rename internal/pkg/http/{custom_echo => customecho}/middlewares/log/log_middleware.go (100%) rename internal/pkg/http/{custom_echo => customecho}/middlewares/otel_metrics/config.go (100%) rename internal/pkg/http/{custom_echo => customecho}/middlewares/otel_metrics/metric.go (100%) rename internal/pkg/http/{custom_echo => customecho}/middlewares/otel_metrics/metrics_middleware.go (100%) rename internal/pkg/http/{custom_echo => customecho}/middlewares/otel_metrics/view.go (100%) rename internal/pkg/http/{custom_echo => customecho}/middlewares/otel_tracing/config.go (100%) rename internal/pkg/http/{custom_echo => customecho}/middlewares/otel_tracing/tracing_middleware.go (100%) rename internal/pkg/http/{custom_echo => customecho}/middlewares/problem_detail/config.go (83%) rename internal/pkg/http/{custom_echo => customecho}/middlewares/problem_detail/problem_detail_middleware.go (89%) rename internal/pkg/http/{http_errors => httperrors}/contracts/contracts.go (100%) rename internal/pkg/http/{http_errors/custom_errors => httperrors/customerrors}/api_error.go (100%) rename internal/pkg/http/{http_errors/custom_errors => httperrors/customerrors}/application_error.go (100%) rename internal/pkg/http/{http_errors/custom_errors => httperrors/customerrors}/bad_request_error.go (100%) rename internal/pkg/http/{http_errors/custom_errors => httperrors/customerrors}/conflict_error.go (100%) rename internal/pkg/http/{http_errors/custom_errors => httperrors/customerrors}/custom_errors.go (98%) rename internal/pkg/http/{http_errors/custom_errors => httperrors/customerrors}/custom_errors_test.go (99%) rename internal/pkg/http/{http_errors/custom_errors => httperrors/customerrors}/domain_error.go (100%) rename internal/pkg/http/{http_errors/custom_errors => httperrors/customerrors}/forbiden_error.go (100%) rename internal/pkg/http/{http_errors/custom_errors => httperrors/customerrors}/internal_server_error.go (100%) rename internal/pkg/http/{http_errors/custom_errors => httperrors/customerrors}/marshaling_error.go (100%) rename internal/pkg/http/{http_errors/custom_errors => httperrors/customerrors}/not_found_error.go (100%) rename internal/pkg/http/{http_errors/custom_errors => httperrors/customerrors}/unauthorized_error.go (100%) rename internal/pkg/http/{http_errors/custom_errors => httperrors/customerrors}/unmarshaling_error.go (100%) rename internal/pkg/http/{http_errors/custom_errors => httperrors/customerrors}/validation_error.go (100%) rename internal/pkg/http/{http_errors/problemDetails => httperrors/problemdetails}/custom_problem_details_errors.go (100%) rename internal/pkg/http/{http_errors/problemDetails => httperrors/problemdetails}/option_builder.go (100%) rename internal/pkg/http/{http_errors/problemDetails => httperrors/problemdetails}/problem_detail_parser.go (97%) rename internal/pkg/http/{http_errors/problemDetails => httperrors/problemdetails}/problem_details.go (99%) rename internal/pkg/http/{http_errors/problemDetails => httperrors/problemdetails}/problem_details_test.go (98%) delete mode 100644 internal/pkg/postgresgorm/helpers.go create mode 100644 internal/pkg/postgresgorm/scopes/scopes.go rename internal/pkg/postgresmessaging/messagepersistence/{message_persistence_repository.go => postgres_message_service.go} (66%) rename internal/pkg/postgresmessaging/messagepersistence/{message_persistence_repository_test.go => postgres_message_service_test.go} (82%) rename internal/pkg/utils/{error_utils => errorutils}/errors.go (98%) rename internal/pkg/utils/{error_utils => errorutils}/errors_test.go (100%) delete mode 100644 internal/services/catalog_read_service/.env delete mode 100644 internal/services/catalog_write_service/.env rename internal/services/{catalog_read_service => catalogreadservice}/.air.toml (100%) rename internal/services/{catalog_read_service => catalogreadservice}/.dockerignore (100%) create mode 100644 internal/services/catalogreadservice/.env rename internal/services/{catalog_read_service => catalogreadservice}/.gitignore (100%) rename internal/services/{catalog_read_service => catalogreadservice}/.golangci.yml (100%) rename internal/services/{catalog_read_service => catalogreadservice}/Dockerfile (100%) rename internal/services/{catalog_read_service => catalogreadservice}/Makefile (100%) rename internal/services/{catalog_read_service => catalogreadservice}/arch-go.yml (100%) rename internal/services/{catalog_read_service => catalogreadservice}/client.http (100%) rename internal/services/{catalog_read_service => catalogreadservice}/cmd/app/main.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/cmd/migration/.gitkeep (100%) rename internal/services/{catalog_read_service => catalogreadservice}/config/config.development.json (95%) rename internal/services/{catalog_read_service => catalogreadservice}/config/config.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/config/config.test.json (95%) rename internal/services/{catalog_read_service => catalogreadservice}/config/confix_fx.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/docs/docs.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/docs/swagger.json (100%) rename internal/services/{catalog_read_service => catalogreadservice}/docs/swagger.yaml (100%) rename internal/services/{catalog_read_service => catalogreadservice}/go.mod (95%) rename internal/services/{catalog_read_service => catalogreadservice}/go.sum (92%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/configurations/mappings/mapping_profile.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/configurations/mediator/mediator_configurations.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/configurations/products_module_configurator.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/configurations/rabbitmq/rabbitmq_configuration.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/consts/consts.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/contracts/data/product_cache_repository.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/contracts/data/product_repository.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/contracts/params/product_route_params.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/data/repositories/mongo_product_repository.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/data/repositories/redis_product_repository.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/dto/product_dto.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/creating_product/v1/create_product.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/creating_product/v1/create_product_handler.go (98%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/creating_product/v1/dtos/create_product_response_dto.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/creating_product/v1/events/integrationevents/externalevents/product_created.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/creating_product/v1/events/integrationevents/externalevents/product_created_consumer.go (97%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/deleting_products/v1/commands/delete_product.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/deleting_products/v1/commands/delete_product_handler.go (97%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/deleting_products/v1/events/integration_events/external_events/product_deleted.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/deleting_products/v1/events/integration_events/external_events/product_deleted_consumer.go (97%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/get_product_by_id/v1/dtos/get_product_by_id_request_dto.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/get_product_by_id/v1/dtos/get_product_by_id_response_dto.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/get_product_by_id/v1/endpoints/get_product_by_id_endpoint.go (97%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/get_product_by_id/v1/queries/get_product_by_id.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/get_product_by_id/v1/queries/get_product_by_id_handler.go (98%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/getting_products/v1/dtos/get_products_request_dto.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/getting_products/v1/dtos/get_products_response_dto.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/getting_products/v1/endpoints/get_products_endpoint.go (98%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/getting_products/v1/queries/get_products.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/getting_products/v1/queries/get_products_handler.go (97%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/searching_products/v1/dtos/search_products_request_dto.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/searching_products/v1/dtos/search_products_response_dto.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/searching_products/v1/endpoints/search_products_endpoint.go (98%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/searching_products/v1/queries/search_products.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/searching_products/v1/queries/search_products_handler.go (97%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/updating_products/v1/commands/update_product.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/updating_products/v1/commands/update_product_handler.go (98%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/updating_products/v1/events/integration_events/external_events/product_updated.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/features/updating_products/v1/events/integration_events/external_events/product_updated_consumer.go (98%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/models/product.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/products/products_fx.go (98%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/shared/app/app.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/shared/app/application.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/shared/app/application_builder.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/shared/app/test/test_app.go (99%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/shared/app/test/test_application.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/shared/app/test/test_application_builder.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/shared/configurations/catalogs/catalogs_configurator.go (98%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/shared/configurations/catalogs/catalogs_configurator_swagger.go (94%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/shared/configurations/catalogs/catalogs_fx.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/shared/configurations/catalogs/infrastructure/infrastructure_configurator.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/shared/configurations/catalogs/infrastructure/infrastructure_fx.go (98%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/shared/contracts/catalogs_metrics.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/internal/shared/testfixture/integration/integration_test_fixture.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/mocks/ProductCacheRepository.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/mocks/ProductRepository.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/mocks/UnsafeProductsServiceServer.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/readme.md (100%) rename internal/services/{catalog_read_service => catalogreadservice}/revive-config.toml (100%) rename internal/services/{catalog_read_service => catalogreadservice}/staticcheck.conf (100%) rename internal/services/{catalog_read_service => catalogreadservice}/taskfile.yml (100%) rename internal/services/{catalog_read_service => catalogreadservice}/taskfile_db.yml (100%) rename internal/services/{catalog_read_service => catalogreadservice}/taskfile_test.yml (100%) rename internal/services/{catalog_read_service => catalogreadservice}/test/end_to_end/products/features/getting_product_by_id/v1/get_product_by_id_test.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/test/end_to_end/products/features/getting_products/v1/get_products_endpoint_test.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/test/integration/products/data/mongo_product_repository_test.go (99%) rename internal/services/{catalog_read_service => catalogreadservice}/test/integration/products/features/creating_product/v1/commands/create_product_test.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/test/integration/products/features/creating_product/v1/events/product_created_test.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/test/integration/products/features/deleting_product/v1/commands/delete_product_test.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/test/integration/products/features/deleting_product/v1/events/product_deleted_test.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/test/integration/products/features/getting_product_by_id/v1/queries/get_product_by_id_test.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/test/integration/products/features/getting_products/v1/queries/get_products_handler_test.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/test/integration/products/features/updating_product/v1/commands/update_product_handler_test.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/test/integration/products/features/updating_product/v1/events/product_updated_test.go (100%) rename internal/services/{catalog_read_service => catalogreadservice}/test/load_tests/.openapi-generator-ignore (100%) rename internal/services/{catalog_read_service => catalogreadservice}/test/load_tests/.openapi-generator/FILES (100%) rename internal/services/{catalog_read_service => catalogreadservice}/test/load_tests/.openapi-generator/VERSION (100%) rename internal/services/{catalog_read_service => catalogreadservice}/test/load_tests/README.md (100%) rename internal/services/{catalog_read_service => catalogreadservice}/test/load_tests/script.js (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/.air.toml (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/.dockerignore (100%) create mode 100644 internal/services/catalogwriteservice/.env rename internal/services/{catalog_write_service => catalogwriteservice}/.gitignore (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/.golangci.yml (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/Dockerfile (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/Makefile (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/arch-go.yml (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/atlas.hcl (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/client.http (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/cmd/app/main.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/cmd/migration/main.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/config/app_options.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/config/config.development.json (95%) rename internal/services/{catalog_write_service => catalogwriteservice}/config/config.test.json (94%) rename internal/services/{catalog_write_service => catalogwriteservice}/config/config_fx.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/fixtures/products/products.yaml (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/migrations/atlas/20230919170700.sql (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/migrations/atlas/atlas.sum (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/migrations/atlas/goose/00001_enable_uuid_extension.sql (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/migrations/atlas/goose/00002_create_products_table.sql (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/migrations/atlas/goose/atlas.sum (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/migrations/atlas/readme.md (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/migrations/go-migrate/000001_enable_uuid_extension.down.sql (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/migrations/go-migrate/000001_enable_uuid_extension.up.sql (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/migrations/go-migrate/000002_create_products_table.down.sql (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/migrations/go-migrate/000002_create_products_table.up.sql (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/migrations/go-migrate/atlas.sum (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/migrations/go-migrate/readme.md (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/migrations/go-migrate/schema.sql (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/migrations/goose-migrate/00001_enable_uuid_extension.sql (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/migrations/goose-migrate/00002_create_products_table.sql (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/db/migrations/goose-migrate/readme.md (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/docs/docs.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/docs/swagger.json (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/docs/swagger.yaml (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/go.mod (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/go.sum (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/configurations/endpoints/endpoints.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/configurations/mappings/mapping_profile.go (97%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/configurations/mediator/mediator.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/configurations/products_module_configurator.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/configurations/rabbitmq/rabbitmq_configurations.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/contracts/product_repository.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/data/models/product_data_model.go (56%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/data/repositories/pg_product_repository.go (92%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/dtos/v1/fxparams/product_handler_params.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/dtos/v1/fxparams/product_route_params.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/dtos/v1/product_dto.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/creatingproduct/v1/create_product.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/creatingproduct/v1/create_product_endpoint.go (97%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/creatingproduct/v1/create_product_handler.go (95%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/creatingproduct/v1/dtos/create_product_request_dto.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/creatingproduct/v1/dtos/create_product_response_dto.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/creatingproduct/v1/events/domainevents/.gitkeep (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/creatingproduct/v1/events/integrationevents/product_created.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/deletingproduct/v1/delete_product.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/deletingproduct/v1/delete_product_endpoint.go (97%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/deletingproduct/v1/delete_product_handler.go (95%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/deletingproduct/v1/dtos/delete_product_request_dto.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/deletingproduct/v1/events/integrationevents/product_deleted.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/gettingproductbyid/v1/dtos/get_product_by_id_request_dto.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/gettingproductbyid/v1/dtos/get_product_by_id_response_dto.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/gettingproductbyid/v1/get_product_by_id.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/gettingproductbyid/v1/get_product_by_id_endpoint.go (97%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/gettingproductbyid/v1/get_product_by_id_handler.go (94%) rename internal/services/{catalog_write_service/internal/products/features/getting_products => catalogwriteservice/internal/products/features/gettingproducts}/v1/dtos/get_products_request_dto.go (100%) rename internal/services/{catalog_write_service/internal/products/features/getting_products => catalogwriteservice/internal/products/features/gettingproducts}/v1/dtos/get_products_response_dto.go (100%) rename internal/services/{catalog_write_service/internal/products/features/getting_products => catalogwriteservice/internal/products/features/gettingproducts}/v1/get_products.go (100%) rename internal/services/{catalog_write_service/internal/products/features/getting_products => catalogwriteservice/internal/products/features/gettingproducts}/v1/get_products_endpoint.go (94%) rename internal/services/{catalog_write_service/internal/products/features/getting_products => catalogwriteservice/internal/products/features/gettingproducts}/v1/get_products_handler.go (89%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/searchingproduct/v1/dtos/search_products_request_dto.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/searchingproduct/v1/dtos/search_products_response_dto.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/searchingproduct/v1/search_products.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/searchingproduct/v1/search_products_endpoint.go (98%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/searchingproduct/v1/search_products_handler.go (97%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/updatingproduct/v1/dtos/update_product_request_dto.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/updatingproduct/v1/events/integrationevents/product_updated.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/updatingproduct/v1/update_product.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/updatingproduct/v1/update_product_endpoint.go (97%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/features/updatingproduct/v1/update_product_handler.go (96%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/models/product.go (90%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/products/products_fx.go (98%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/app/app.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/app/application.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/app/application_builder.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/app/test/test_app.go (96%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/app/test/test_application.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/app/test/test_application_builder.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/configurations/catalogs/catalogs_configurator.go (86%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/configurations/catalogs/catalogs_configurator_migration.go (72%) create mode 100644 internal/services/catalogwriteservice/internal/shared/configurations/catalogs/catalogs_configurator_seed.go rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/configurations/catalogs/catalogs_configurator_swagger.go (94%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/configurations/catalogs/catalogs_fx.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/configurations/catalogs/infrastructure/infrastructure_configurator.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/configurations/catalogs/infrastructure/infrastructure_fx.go (98%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/contracts/catalogs_metrics.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/data/data_fx.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/data/dbcontext/catalogs_dbcontext.go (85%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/data/dbcontext/catalogs_dbcontext_test.go (67%) create mode 100644 internal/services/catalogwriteservice/internal/shared/data/scopes/scopes.go rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/grpc/genproto/products.pb.go (95%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/grpc/genproto/products_grpc.pb.go (98%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/grpc/product_grpc_service_server.go (97%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/testfixtures/integration/integration_test_fixture.go (92%) rename internal/services/{catalog_write_service => catalogwriteservice}/internal/shared/testfixtures/unittest/unit_test_fixture.go (71%) rename internal/services/{catalog_write_service => catalogwriteservice}/mocks/CatalogContext.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/mocks/ProductRepository.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/mocks/ProductsServiceClient.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/mocks/ProductsServiceServer.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/mocks/UnsafeProductsServiceServer.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/readme.md (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/revive-config.toml (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/taskfile.yml (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/taskfile_db.yml (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/taskfile_test.yml (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/endtoend/products/features/creatingproduct/v1/create_product_test.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/endtoend/products/features/deletingproduct/v1/delete_product_test.go (97%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/endtoend/products/features/gettingproductbyid/v1/get_product_by_id_test.go (97%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/endtoend/products/features/gettingproducts/v1/get_products_test.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/endtoend/products/features/searchingproduct/v1/search_products_test.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/endtoend/products/features/updatingproduct/v1/update_product_test.go (98%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/endtoend/products/grpc/product_grpc_service_server_test.go (93%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/integration/products/data/repositories/pg_product_repository_integration_test.go (94%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/integration/products/data/uow/catalogs_unit_of_work_integration_test.go (97%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/integration/products/features/creatingproduct/v1/create_product_test.go (98%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/integration/products/features/deletingproduct/v1/delete_product_test.go (98%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/integration/products/features/gettingproductbyid/v1/get_product_by_id_test.go (98%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/integration/products/features/gettingproducts/v1/get_products_test.go (97%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/integration/products/features/updatingproduct/v1/update_product_test.go (96%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/load/.openapi-generator-ignore (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/load/.openapi-generator/FILES (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/load/.openapi-generator/VERSION (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/load/README.md (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/load/script.js (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/unit/products/features/creatingproduct/v1/create_product_handler_unit_test.go (98%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/unit/products/features/creatingproduct/v1/create_product_unit_test.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/unit/products/features/deletingproduct/v1/delete_product_handler_unit_test.go (96%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/unit/products/features/deletingproduct/v1/delete_product_unit_test.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/unit/products/features/gettingproductbyid/v1/get_product_by_Id_unit_test.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/unit/products/features/gettingproductbyid/v1/get_product_by_id_handler_unit_test.go (92%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/unit/products/features/gettingproducts/v1/get_products_handler_unit_test.go (94%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/unit/products/features/searchingproducts/v1/search_products_unit_test.go (98%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/unit/products/features/updatingproduct/v1/update_product_handler_unit_test.go (92%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/unit/products/features/updatingproduct/v1/update_product_unit_test.go (100%) rename internal/services/{catalog_write_service => catalogwriteservice}/test/unit/products/mappings_profile_test.go (94%) delete mode 100644 internal/services/order_service/.env rename internal/services/{order_service => orderservice}/.air.toml (100%) rename internal/services/{order_service => orderservice}/.dockerignore (100%) create mode 100644 internal/services/orderservice/.env rename internal/services/{order_service => orderservice}/.golangci.yml (100%) rename internal/services/{order_service => orderservice}/Dockerfile (100%) rename internal/services/{order_service => orderservice}/Makefile (100%) rename internal/services/{order_service => orderservice}/arch-go.yml (100%) rename internal/services/{order_service => orderservice}/client.http (100%) rename internal/services/{order_service => orderservice}/cmd/app/main.go (100%) rename internal/services/{order_service => orderservice}/cmd/migration/.gitkeep (100%) rename internal/services/{order_service => orderservice}/config/config.development.json (95%) rename internal/services/{order_service => orderservice}/config/config.go (100%) rename internal/services/{order_service => orderservice}/config/config.test.json (95%) rename internal/services/{order_service => orderservice}/config/config_fx.go (100%) rename internal/services/{order_service => orderservice}/docs/docs.go (100%) rename internal/services/{order_service => orderservice}/docs/swagger.json (100%) rename internal/services/{order_service => orderservice}/docs/swagger.yaml (100%) rename internal/services/{order_service => orderservice}/go.mod (95%) rename internal/services/{order_service => orderservice}/go.sum (98%) rename internal/services/{order_service => orderservice}/internal/orders/configurations/mappings/mappings_profile.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/configurations/mediatr/mediator_configurations.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/configurations/orders_module_configurator.go (99%) rename internal/services/{order_service => orderservice}/internal/orders/configurations/rabbitmq/rabbitmq_configurations.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/contracts/params/order_projection_params.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/contracts/params/order_route_params.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/contracts/repositories/order_repository.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/data/repositories/elastic_order_read_repository.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/data/repositories/mongo_order_read_repository.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/dtos/v1/order_dto.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/dtos/v1/order_read_dto.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/dtos/v1/shopItem_dto.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/dtos/v1/shopItem_read_dto.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/exceptions/domain_exceptions/invalid_delivery_address_error.go (94%) rename internal/services/{order_service => orderservice}/internal/orders/exceptions/domain_exceptions/invalid_email_error.go (94%) rename internal/services/{order_service => orderservice}/internal/orders/exceptions/domain_exceptions/order_domain_errors_test.go (95%) rename internal/services/{order_service => orderservice}/internal/orders/exceptions/domain_exceptions/order_items_required_errors.go (94%) rename internal/services/{order_service => orderservice}/internal/orders/exceptions/domain_exceptions/order_not_found_error.go (94%) rename internal/services/{order_service => orderservice}/internal/orders/features/creating_order/v1/commands/create_order.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/features/creating_order/v1/commands/create_order_handler.go (98%) rename internal/services/{order_service => orderservice}/internal/orders/features/creating_order/v1/dtos/create_order_request_dto.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/features/creating_order/v1/dtos/create_order_response_dto.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/features/creating_order/v1/endpoints/create_order_endpoint.go (98%) rename internal/services/{order_service => orderservice}/internal/orders/features/creating_order/v1/events/domain_events/order_created.go (98%) rename internal/services/{order_service => orderservice}/internal/orders/features/creating_order/v1/events/integration_events/order_created.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/features/getting_order_by_id/v1/dtos/get_order_by_id_request_dto.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/features/getting_order_by_id/v1/dtos/get_order_by_id_response_dto.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/features/getting_order_by_id/v1/endpoints/get_order_by_id_endpoint.go (98%) rename internal/services/{order_service => orderservice}/internal/orders/features/getting_order_by_id/v1/queries/get_order_by_id.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/features/getting_order_by_id/v1/queries/get_order_by_id_handler.go (98%) rename internal/services/{order_service => orderservice}/internal/orders/features/getting_orders/v1/dtos/get_orders_request_dto.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/features/getting_orders/v1/dtos/get_orders_response_dto.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/features/getting_orders/v1/endpoints/get_orders_endpoint.go (98%) rename internal/services/{order_service => orderservice}/internal/orders/features/getting_orders/v1/queries/get_orders.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/features/getting_orders/v1/queries/get_orders_handler.go (98%) rename internal/services/{order_service => orderservice}/internal/orders/features/submitting_order/v1/commands/submit_order.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/features/submitting_order/v1/events/domain_events/order_submitted.go (91%) rename internal/services/{order_service => orderservice}/internal/orders/features/updating_shopping_card/v1/commands/update_shopping_card.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/features/updating_shopping_card/v1/events/shopping_card_updated.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/models/orders/aggregate/order.go (99%) rename internal/services/{order_service => orderservice}/internal/orders/models/orders/read_models/order_read.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/models/orders/read_models/shop_item_read.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/models/orders/value_objects/shop_item.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/orders_fx.go (98%) rename internal/services/{order_service => orderservice}/internal/orders/projections/elastic_order_projection.go (100%) rename internal/services/{order_service => orderservice}/internal/orders/projections/mongo_order_projection.go (99%) rename internal/services/{order_service => orderservice}/internal/shared/app/app.go (100%) rename internal/services/{order_service => orderservice}/internal/shared/app/application.go (100%) rename internal/services/{order_service => orderservice}/internal/shared/app/application_builder.go (100%) rename internal/services/{order_service => orderservice}/internal/shared/app/test/test_app.go (99%) rename internal/services/{order_service => orderservice}/internal/shared/app/test/test_application.go (100%) rename internal/services/{order_service => orderservice}/internal/shared/app/test/test_application_builder.go (100%) rename internal/services/{order_service => orderservice}/internal/shared/configurations/orders/infrastructure/infrastructure_configurator.go (100%) rename internal/services/{order_service => orderservice}/internal/shared/configurations/orders/infrastructure/infrastructure_fx.go (98%) rename internal/services/{order_service => orderservice}/internal/shared/configurations/orders/orders_configurator.go (98%) rename internal/services/{order_service => orderservice}/internal/shared/configurations/orders/orders_configurator_swagger.go (93%) rename internal/services/{order_service => orderservice}/internal/shared/configurations/orders/orders_fx.go (100%) rename internal/services/{order_service => orderservice}/internal/shared/contracts/orders_metrics.go (100%) rename internal/services/{order_service => orderservice}/internal/shared/grpc/genproto/orders.pb.go (99%) rename internal/services/{order_service => orderservice}/internal/shared/grpc/genproto/orders_grpc.pb.go (99%) rename internal/services/{order_service => orderservice}/internal/shared/grpc/order_grpc_service_server.go (99%) rename internal/services/{order_service => orderservice}/internal/shared/test_fixtures/integration/integration_test_fixture.go (100%) rename internal/services/{order_service => orderservice}/mocks/InvalidDeliveryAddressError.go (100%) rename internal/services/{order_service => orderservice}/mocks/InvalidEmailAddressError.go (100%) rename internal/services/{order_service => orderservice}/mocks/OrderElasticRepository.go (100%) rename internal/services/{order_service => orderservice}/mocks/OrderMongoRepository.go (100%) rename internal/services/{order_service => orderservice}/mocks/OrderNotFoundError.go (100%) rename internal/services/{order_service => orderservice}/mocks/OrderShopItemsRequiredError.go (100%) rename internal/services/{order_service => orderservice}/mocks/OrdersServiceClient.go (100%) rename internal/services/{order_service => orderservice}/mocks/OrdersServiceServer.go (100%) rename internal/services/{order_service => orderservice}/mocks/UnsafeOrdersServiceServer.go (100%) rename internal/services/{order_service => orderservice}/mocks/orderReadRepository.go (100%) rename internal/services/{order_service => orderservice}/readme.md (100%) rename internal/services/{order_service => orderservice}/revive-config.toml (100%) rename internal/services/{order_service => orderservice}/taskfile.yml (100%) rename internal/services/{order_service => orderservice}/taskfile_db.yml (100%) rename internal/services/{order_service => orderservice}/taskfile_test.yml (100%) rename internal/services/{order_service => orderservice}/test/end_to_end/orders/features/creating_order/v1/create_order_test.go (100%) rename internal/services/{order_service => orderservice}/test/end_to_end/orders/features/getting_order_by_id/v1/get_order_by_id_test.go (100%) rename internal/services/{order_service => orderservice}/test/end_to_end/orders/grpc/order_grpc_service_server_test.go (100%) rename internal/services/{order_service => orderservice}/test/integration/orders/features/creating_order/v1/create_order_test.go (100%) rename internal/services/{order_service => orderservice}/test/integration/orders/features/getting_order_by_id/v1/get_order_by_id_test.go (100%) diff --git a/Makefile b/Makefile index eb60a135..fb6aa917 100644 --- a/Makefile +++ b/Makefile @@ -4,36 +4,36 @@ install-tools: .PHONY: run-catalogs-write-service run-catalogs-write-service: - @./scripts/run.sh catalog_write_service + @./scripts/run.sh catalogwriteservice .PHONY: run-catalog-read-service run-catalog-read-service: - @./scripts/run.sh catalog_read_service + @./scripts/run.sh catalogreadservice .PHONY: run-order-service run-order-service: - @./scripts/run.sh order_service + @./scripts/run.sh orderservice .PHONY: build build: @./scripts/build.sh pkg - @./scripts/build.sh catalog_write_service - @./scripts/build.sh catalog_read_service - @./scripts/build.sh order_service + @./scripts/build.sh catalogwriteservice + @./scripts/build.sh catalogreadservice + @./scripts/build.sh orderservice .PHONY: update-dependencies update-dependencies: @./scripts/update-dependencies.sh pkg - @./scripts/update-dependencies.sh catalog_write_service - @./scripts/update-dependencies.sh catalog_read_service - @./scripts/update-dependencies.sh order_service + @./scripts/update-dependencies.sh catalogwriteservice + @./scripts/update-dependencies.sh catalogreadservice + @./scripts/update-dependencies.sh orderservice .PHONY: install-dependencies install-dependencies: @./scripts/install-dependencies.sh pkg - @./scripts/install-dependencies.sh catalog_write_service - @./scripts/install-dependencies.sh catalog_read_service - @./scripts/install-dependencies.sh order_service + @./scripts/install-dependencies.sh catalogwriteservice + @./scripts/install-dependencies.sh catalogreadservice + @./scripts/install-dependencies.sh orderservice .PHONY: docker-compose-infra-up docker-compose-infra-up: @@ -44,33 +44,33 @@ docker-compose-infra-down: .PHONY: openapi openapi: - @./scripts/openapi.sh catalog_write_service - @./scripts/openapi.sh catalog_read_service - @./scripts/openapi.sh order_service + @./scripts/openapi.sh catalogwriteservice + @./scripts/openapi.sh catalogreadservice + @./scripts/openapi.sh orderservice # https://stackoverflow.com/questions/13616033/install-protocol-buffers-on-windows .PHONY: proto proto: - @./scripts/proto.sh catalog_write_service - @./scripts/proto.sh order_service + @./scripts/proto.sh catalogwriteservice + @./scripts/proto.sh orderservice .PHONY: unit-test unit-test: - @./scripts/test.sh catalog_read_service unit - @./scripts/test.sh catalog_write_service unit - @./scripts/test.sh order_service unit + @./scripts/test.sh catalogreadservice unit + @./scripts/test.sh catalogwriteservice unit + @./scripts/test.sh orderservice unit .PHONY: integration-test integration-test: - @./scripts/test.sh catalog_read_service integration - @./scripts/test.sh catalog_write_service integration - @./scripts/test.sh order_service integration + @./scripts/test.sh catalogreadservice integration + @./scripts/test.sh catalogwriteservice integration + @./scripts/test.sh orderservice integration .PHONY: e2e-test e2e-test: - @./scripts/test.sh catalog_read_service e2e - @./scripts/test.sh catalog_write_service e2e - @./scripts/test.sh order_service e2e + @./scripts/test.sh catalogreadservice e2e + @./scripts/test.sh catalogwriteservice e2e + @./scripts/test.sh orderservice e2e #.PHONY: load-test #load-test: @@ -80,16 +80,16 @@ e2e-test: .PHONY: format format: - @./scripts/format.sh catalog_write_service - @./scripts/format.sh catalog_read_service - @./scripts/format.sh order_service + @./scripts/format.sh catalogwriteservice + @./scripts/format.sh catalogreadservice + @./scripts/format.sh orderservice @./scripts/format.sh pkg .PHONY: lint lint: - @./scripts/lint.sh catalog_write_service - @./scripts/lint.sh catalog_read_service - @./scripts/lint.sh order_service + @./scripts/lint.sh catalogwriteservice + @./scripts/lint.sh catalogreadservice + @./scripts/lint.sh orderservice @./scripts/lint.sh pkg # https://github.com/golang-migrate/migrate/blob/856ea12df9d230b0145e23d951b7dbd6b86621cb/database/postgres/TUTORIAL.md @@ -98,30 +98,29 @@ lint: # https://github.com/golang-migrate/migrate/tree/856ea12df9d230b0145e23d951b7dbd6b86621cb/cmd/migrate#usage .PHONY: go-migrate go-migrate: - @./scripts/go-migrate.sh -p ./internal/services/catalog_write_service/db/migrations/go-migrate -c create -n create_product_table - @./scripts/go-migrate.sh -p ./internal/services/catalog_write_service/db/migrations/go-migrate -c up -o postgres://postgres:postgres@localhost:5432/catalogs_service?sslmode=disable - @./scripts/go-migrate.sh -p ./internal/services/catalog_write_service/db/migrations/go-migrate -c down -o postgres://postgres:postgres@localhost:5432/catalogs_service?sslmode=disable + @./scripts/go-migrate.sh -p ./internal/services/catalogwriteservice/db/migrations/go-migrate -c create -n create_product_table + @./scripts/go-migrate.sh -p ./internal/services/catalogwriteservice/db/migrations/go-migrate -c up -o postgres://postgres:postgres@localhost:5432/catalogs_service?sslmode=disable + @./scripts/go-migrate.sh -p ./internal/services/catalogwriteservice/db/migrations/go-migrate -c down -o postgres://postgres:postgres@localhost:5432/catalogs_service?sslmode=disable # https://github.com/pressly/goose#usage .PHONY: goose-migrate goose-migrate: - @./scripts/goose-migrate.sh -p ./internal/services/catalog_write_service/db/migrations/goose-migrate -c create -n create_product_table - @./scripts/goose-migrate.sh -p ./internal/services/catalog_write_service/db/migrations/goose-migrate -c up -o "user=postgres password=postgres dbname=catalogs_service sslmode=disable" - @./scripts/goose-migrate.sh -p ./internal/services/catalog_write_service/db/migrations/goose-migrate -c down -o "user=postgres password=postgres dbname=catalogs_service sslmode=disable" + @./scripts/goose-migrate.sh -p ./internal/services/catalogwriteservice/db/migrations/goose-migrate -c create -n create_product_table + @./scripts/goose-migrate.sh -p ./internal/services/catalogwriteservice/db/migrations/goose-migrate -c up -o "user=postgres password=postgres dbname=catalogs_service sslmode=disable" + @./scripts/goose-migrate.sh -p ./internal/services/catalogwriteservice/db/migrations/goose-migrate -c down -o "user=postgres password=postgres dbname=catalogs_service sslmode=disable" # https://atlasgo.io/guides/orms/gorm .PHONY: atlas atlas: - @./scripts/atlas-migrate.sh -c gorm-sync -p "./internal/services/catalog_write_service" - @./scripts/atlas-migrate.sh -c apply -p "./internal/services/catalog_write_service" -o "postgres://postgres:postgres@localhost:5432/catalogs_service?sslmode=disable" + @./scripts/atlas-migrate.sh -c gorm-sync -p "./internal/services/catalogwriteservice" + @./scripts/atlas-migrate.sh -c apply -p "./internal/services/catalogwriteservice" -o "postgres://postgres:postgres@localhost:5432/catalogs_service?sslmode=disable" .PHONY: cycle-check cycle-check: - cd internal/services/catalog_write_service && goimportcycle -dot imports.dot dot -Tpng -o cycle/catalog_write_service.png imports.dot - cd internal/services/catalog_write_service && goimportcycle -dot imports.dot dot -Tpng -o cycle/catalog_write_service.png imports.dot - cd internal/services/catalog_read_service && goimportcycle -dot imports.dot dot -Tpng -o cycle/catalog_read_service.png imports.dot cd internal/pkg && goimportcycle -dot imports.dot dot -Tpng -o cycle/pkg.png imports.dot - + cd internal/services/catalogwriteservice && goimportcycle -dot imports.dot dot -Tpng -o cycle/catalogwriteservice.png imports.dot + cd internal/services/catalogwriteservice && goimportcycle -dot imports.dot dot -Tpng -o cycle/catalogwriteservice.png imports.dot + cd internal/services/orderservice && goimportcycle -dot imports.dot dot -Tpng -o cycle/orderservice.png imports.dot #.PHONY: c4 #c4: @@ -138,6 +137,6 @@ pkg-mocks: .PHONY: services-mocks services-mocks: - cd internal/services/catalog_write_service && mockery --output mocks --all - cd internal/services/catalog_read_service && mockery --output mocks --all - cd internal/services/order_service && mockery --output mocks --all + cd internal/services/catalogwriteservice && mockery --output mocks --all + cd internal/services/catalogreadservice && mockery --output mocks --all + cd internal/services/orderservice && mockery --output mocks --all diff --git a/api/openapi/catalog_read_service/docs.go b/api/openapi/catalogreadservice/docs.go similarity index 99% rename from api/openapi/catalog_read_service/docs.go rename to api/openapi/catalogreadservice/docs.go index 1c44e7b8..c6384bf4 100644 --- a/api/openapi/catalog_read_service/docs.go +++ b/api/openapi/catalogreadservice/docs.go @@ -1,6 +1,6 @@ // Code generated by swaggo/swag. DO NOT EDIT. -package catalog_read_service +package catalogreadservice import "github.com/swaggo/swag" diff --git a/api/openapi/catalog_read_service/swagger.json b/api/openapi/catalogreadservice/swagger.json similarity index 100% rename from api/openapi/catalog_read_service/swagger.json rename to api/openapi/catalogreadservice/swagger.json diff --git a/api/openapi/catalog_read_service/swagger.yaml b/api/openapi/catalogreadservice/swagger.yaml similarity index 100% rename from api/openapi/catalog_read_service/swagger.yaml rename to api/openapi/catalogreadservice/swagger.yaml diff --git a/api/openapi/catalog_write_service/docs.go b/api/openapi/catalogwriteservice/docs.go similarity index 99% rename from api/openapi/catalog_write_service/docs.go rename to api/openapi/catalogwriteservice/docs.go index 5f8aa576..ca894145 100644 --- a/api/openapi/catalog_write_service/docs.go +++ b/api/openapi/catalogwriteservice/docs.go @@ -1,6 +1,6 @@ // Code generated by swaggo/swag. DO NOT EDIT. -package catalog_write_service +package catalogwriteservice import "github.com/swaggo/swag" diff --git a/api/openapi/catalog_write_service/swagger.json b/api/openapi/catalogwriteservice/swagger.json similarity index 100% rename from api/openapi/catalog_write_service/swagger.json rename to api/openapi/catalogwriteservice/swagger.json diff --git a/api/openapi/catalog_write_service/swagger.yaml b/api/openapi/catalogwriteservice/swagger.yaml similarity index 100% rename from api/openapi/catalog_write_service/swagger.yaml rename to api/openapi/catalogwriteservice/swagger.yaml diff --git a/api/openapi/order_service/docs.go b/api/openapi/orderservice/docs.go similarity index 99% rename from api/openapi/order_service/docs.go rename to api/openapi/orderservice/docs.go index 934905f3..119e33d6 100644 --- a/api/openapi/order_service/docs.go +++ b/api/openapi/orderservice/docs.go @@ -1,6 +1,6 @@ // Code generated by swaggo/swag. DO NOT EDIT. -package order_service +package orderservice import "github.com/swaggo/swag" diff --git a/api/openapi/order_service/swagger.json b/api/openapi/orderservice/swagger.json similarity index 100% rename from api/openapi/order_service/swagger.json rename to api/openapi/orderservice/swagger.json diff --git a/api/openapi/order_service/swagger.yaml b/api/openapi/orderservice/swagger.yaml similarity index 100% rename from api/openapi/order_service/swagger.yaml rename to api/openapi/orderservice/swagger.yaml diff --git a/api/protobuf/catalog_write_service/products.proto b/api/protobuf/catalogwriteservice/products.proto similarity index 100% rename from api/protobuf/catalog_write_service/products.proto rename to api/protobuf/catalogwriteservice/products.proto diff --git a/api/protobuf/order_service/orders.proto b/api/protobuf/orderservice/orders.proto similarity index 100% rename from api/protobuf/order_service/orders.proto rename to api/protobuf/orderservice/orders.proto diff --git a/deployments/docker-compose/docker-compose.infrastructure.yaml b/deployments/docker-compose/docker-compose.infrastructure.yaml index 2c7144e3..4b24e5c7 100644 --- a/deployments/docker-compose/docker-compose.infrastructure.yaml +++ b/deployments/docker-compose/docker-compose.infrastructure.yaml @@ -45,20 +45,20 @@ services: networks: - ecommerce - # node_exporter will use for gathering metrics on the system level with its own /metrics endpoint like cpu, ram, ... - # https://prometheus.io/docs/guides/node-exporter/ - node_exporter: - container_name: node_exporter - pull_policy: if_not_present - restart: unless-stopped - image: prom/node-exporter - ports: - - "9100:9100" - networks: - - ecommerce +# # node_exporter will use for gathering metrics on the system level with its own /metrics endpoint (http://localhost:9100/metrics) like cpu, ram, ... +# # https://prometheus.io/docs/guides/node-exporter/ +# node_exporter: +# container_name: node_exporter +# pull_policy: if_not_present +# restart: unless-stopped +# image: prom/node-exporter +# ports: +# - "9100:9100" +# networks: +# - ecommerce grafana: - image: grafana/grafana + image: grafana/grafana:latest pull_policy: if_not_present container_name: grafana restart: unless-stopped @@ -103,13 +103,13 @@ services: networks: - ecommerce -# k6-tracing: -# image: ghcr.io/grafana/xk6-client-tracing:latest -# environment: -# - ENDPOINT=tempo:4317 -# restart: always -# depends_on: -# - tempo +# # k6-tracing: +# # image: ghcr.io/grafana/xk6-client-tracing:latest +# # environment: +# # - ENDPOINT=tempo:4317 +# # restart: always +# # depends_on: +# # - tempo postgres: image: postgres:latest @@ -138,7 +138,7 @@ services: - ecommerce mongo: - image: mongo + image: mongo:latest pull_policy: if_not_present container_name: mongo restart: unless-stopped @@ -191,15 +191,15 @@ services: networks: - ecommerce - zipkin: - image: openzipkin/zipkin:latest - pull_policy: if_not_present - restart: unless-stopped - container_name: zipkin - ports: - - "9411:9411" - networks: - - ecommerce +# zipkin: +# image: openzipkin/zipkin:latest +# pull_policy: if_not_present +# restart: unless-stopped +# container_name: zipkin +# ports: +# - "9411:9411" +# networks: +# - ecommerce # https://developers.eventstore.com/server/v21.10/installation.html#insecure-single-node # https://hub.docker.com/r/eventstore/eventstore/tags @@ -233,135 +233,135 @@ services: networks: - ecommerce - # containers monitoring - cadvisor: - image: gcr.io/cadvisor/cadvisor:latest - restart: unless-stopped - ports: - - "9091:8080" - # network_mode: host - volumes: - - /:/rootfs:ro - - /var/run:/var/run:ro - - /sys:/sys:ro - - /var/lib/docker/:/var/lib/docker:ro - - /dev/disk/:/dev/disk:ro - devices: - - /dev/kmsg - networks: - - ecommerce +# # containers monitoring - Analyzes resource usage and performance characteristics of running containers. +# cadvisor: +# image: gcr.io/cadvisor/cadvisor:latest +# restart: unless-stopped +# ports: +# - "9091:8080" +# # network_mode: host +# volumes: +# - /:/rootfs:ro +# - /var/run:/var/run:ro +# - /sys:/sys:ro +# - /var/lib/docker/:/var/lib/docker:ro +# - /dev/disk/:/dev/disk:ro +# devices: +# - /dev/kmsg +# networks: +# - ecommerce -# # https://stackoverflow.com/questions/67791781/how-to-configure-apm-server-to-docker-compose-file -# # https://www.elastic.co/guide/en/apm/guide/current/open-telemetry.html -# apm-server: -# image: docker.elastic.co/apm/apm-server:latest -# cap_add: ["CHOWN", "DAC_OVERRIDE", "SETGID", "SETUID"] -# cap_drop: ["ALL"] -# ports: -# - 8200:8200 -# command: > -# apm-server -e -# -E apm-server.rum.enabled=true -# -E setup.kibana.host=kibana:5601 -# -E setup.template.settings.index.number_of_replicas=0 -# -E apm-server.kibana.enabled=true -# -E apm-server.kibana.host=kibana:5601 -# -E output.elasticsearch.hosts=["elasticsearch:9200"] +# # # https://stackoverflow.com/questions/67791781/how-to-configure-apm-server-to-docker-compose-file +# # # https://www.elastic.co/guide/en/apm/guide/current/open-telemetry.html +# # apm-server: +# # image: docker.elastic.co/apm/apm-server:latest +# # cap_add: ["CHOWN", "DAC_OVERRIDE", "SETGID", "SETUID"] +# # cap_drop: ["ALL"] +# # ports: +# # - 8200:8200 +# # command: > +# # apm-server -e +# # -E apm-server.rum.enabled=true +# # -E setup.kibana.host=kibana:5601 +# # -E setup.template.settings.index.number_of_replicas=0 +# # -E apm-server.kibana.enabled=true +# # -E apm-server.kibana.host=kibana:5601 +# # -E output.elasticsearch.hosts=["elasticsearch:9200"] - # elasticsearch: - # container_name: elastic_search - # restart: unless-stopped - # image: elasticsearch:8.5.2 - # environment: - # - discovery.type=single-node - # - bootstrap.memory_lock=true - # - xpack.monitoring.enabled=true - # - xpack.watcher.enabled=false - # - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - # ulimits: - # memlock: - # soft: -1 - # hard: -1 - # volumes: - # - elastic-data:/usr/share/elasticsearch/data - # ports: - # - ${ELASTIC_HOST_PORT:-9200}:${ELASTIC_PORT:-9200} - # - 9300:9300 - # networks: - # - ecommerce +# # elasticsearch: +# # container_name: elastic_search +# # restart: unless-stopped +# # image: elasticsearch:8.5.2 +# # environment: +# # - discovery.type=single-node +# # - bootstrap.memory_lock=true +# # - xpack.monitoring.enabled=true +# # - xpack.watcher.enabled=false +# # - "ES_JAVA_OPTS=-Xms512m -Xmx512m" +# # ulimits: +# # memlock: +# # soft: -1 +# # hard: -1 +# # volumes: +# # - elastic-data:/usr/share/elasticsearch/data +# # ports: +# # - ${ELASTIC_HOST_PORT:-9200}:${ELASTIC_PORT:-9200} +# # - 9300:9300 +# # networks: +# # - ecommerce - # kibana: - # image: kibana:8.5.2 - # container_name: kibana - # restart: unless-stopped - # environment: - # - ELASTICSEARCH_HOSTS=http://elastic_search:${ELASTIC_PORT:-9200} - # ports: - # - ${KIBANA_HOST_PORT:-5601}:${KIBANA_PORT:-5601} - # networks: - # - ecommerce - # depends_on: - # - elasticsearch +# # kibana: +# # image: kibana:8.5.2 +# # container_name: kibana +# # restart: unless-stopped +# # environment: +# # - ELASTICSEARCH_HOSTS=http://elastic_search:${ELASTIC_PORT:-9200} +# # ports: +# # - ${KIBANA_HOST_PORT:-5601}:${KIBANA_PORT:-5601} +# # networks: +# # - ecommerce +# # depends_on: +# # - elasticsearch - # zookeeper: - # image: confluentinc/cp-zookeeper:7.0.1 - # hostname: zookeeper - # container_name: zookeeper - # restart: unless-stopped - # ports: - # - "2181:2181" - # environment: - # ZOOKEEPER_CLIENT_PORT: 2181 - # ZOOKEEPER_TICK_TIME: 2000 - # networks: - # - ecommerce +# # zookeeper: +# # image: confluentinc/cp-zookeeper:7.0.1 +# # hostname: zookeeper +# # container_name: zookeeper +# # restart: unless-stopped +# # ports: +# # - "2181:2181" +# # environment: +# # ZOOKEEPER_CLIENT_PORT: 2181 +# # ZOOKEEPER_TICK_TIME: 2000 +# # networks: +# # - ecommerce - # kafka: - # image: confluentinc/cp-kafka:7.0.1 - # hostname: kafka - # container_name: kafka - # restart: unless-stopped - # depends_on: - # - zookeeper - # ports: - # - "9092:9092" - # environment: - # KAFKA_BROKER_ID: 1 - # KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181' - # KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT - # KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092 - # KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 - # ADVERTISED_HOST_NAME: kafka - # KAFKA_ADVERTISED_HOSTNAME: 127.0.0.1 - # networks: - # - ecommerce +# # kafka: +# # image: confluentinc/cp-kafka:7.0.1 +# # hostname: kafka +# # container_name: kafka +# # restart: unless-stopped +# # depends_on: +# # - zookeeper +# # ports: +# # - "9092:9092" +# # environment: +# # KAFKA_BROKER_ID: 1 +# # KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181' +# # KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT +# # KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092 +# # KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 +# # ADVERTISED_HOST_NAME: kafka +# # KAFKA_ADVERTISED_HOSTNAME: 127.0.0.1 +# # networks: +# # - ecommerce - # kafka-ui: - # image: provectuslabs/kafka-ui - # container_name: kafka-ui - # ports: - # - "8080:8080" - # restart: always - # environment: - # - KAFKA_CLUSTERS_0_NAME=local - # - KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka:9092 - # - KAFKA_CLUSTERS_0_ZOOKEEPER=zookeeper:2181 +# # kafka-ui: +# # image: provectuslabs/kafka-ui +# # container_name: kafka-ui +# # ports: +# # - "8080:8080" +# # restart: always +# # environment: +# # - KAFKA_CLUSTERS_0_NAME=local +# # - KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka:9092 +# # - KAFKA_CLUSTERS_0_ZOOKEEPER=zookeeper:2181 - # kafdrop: - # image: obsidiandynamics/kafdrop - # container_name: kafdrop - # ports: - # - '9000:9000' - # environment: - # - 'KAFKA_BROKERCONNECT=' - # - 'JVM_OPTS=-Xms32M -Xmx64M' - # - SERVER_SERVLET_CONTEXTPATH=/ +# # kafdrop: +# # image: obsidiandynamics/kafdrop +# # container_name: kafdrop +# # ports: +# # - '9000:9000' +# # environment: +# # - 'KAFKA_BROKERCONNECT=' +# # - 'JVM_OPTS=-Xms32M -Xmx64M' +# # - SERVER_SERVLET_CONTEXTPATH=/ volumes: eventstore-volume-data: eventstore-volume-logs: - elastic-data: +# elastic-data: networks: ecommerce: diff --git a/deployments/docker-compose/monitoring/prometheus.yml b/deployments/docker-compose/monitoring/prometheus.yml index 582ba0f4..39e05870 100644 --- a/deployments/docker-compose/monitoring/prometheus.yml +++ b/deployments/docker-compose/monitoring/prometheus.yml @@ -47,7 +47,7 @@ scrape_configs: # http://localhost:8000/metrics # localhost doesn't work here because inner prometheus container localhost will infer to localhost inner the container which is different with system localhost. for access to actual system localhost we should use `host.docker.internal` # instead of `localhost` to access node_exporter container inner prometheus container we can use our container network name to access this container because they are in same docker-compose and same default network - - job_name: order_service + - job_name: orderservice scrape_interval: 1s static_configs: - targets: [ "host.docker.internal:8000" ] diff --git a/deployments/docker-compose/traefik.yaml b/deployments/docker-compose/traefik.yaml index ba35cfd1..9233b9bc 100644 --- a/deployments/docker-compose/traefik.yaml +++ b/deployments/docker-compose/traefik.yaml @@ -141,9 +141,9 @@ - + - + diff --git a/internal/pkg/core/core_fx.go b/internal/pkg/core/core_fx.go index e853947c..fd3df78a 100644 --- a/internal/pkg/core/core_fx.go +++ b/internal/pkg/core/core_fx.go @@ -1,7 +1,6 @@ package core import ( - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer/json" "go.uber.org/fx" @@ -12,8 +11,9 @@ import ( var Module = fx.Module( "corefx", fx.Provide( - json.NewDefaultSerializer, - serializer.NewDefaultEventSerializer, - serializer.NewDefaultMetadataSerializer, + json.NewDefaultJsonSerializer, + json.NewDefaultEventJsonSerializer, + json.NewDefaultMessageJsonSerializer, + json.NewDefaultMetadataJsonSerializer, ), ) diff --git a/internal/pkg/core/customtypes/custom_time.go b/internal/pkg/core/customtypes/custom_time.go index 57791650..1e03d73d 100644 --- a/internal/pkg/core/customtypes/custom_time.go +++ b/internal/pkg/core/customtypes/custom_time.go @@ -8,7 +8,7 @@ import ( "strings" "time" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/araddon/dateparse" ) diff --git a/internal/pkg/core/events/event.go b/internal/pkg/core/events/event.go index e97e19d9..a8f12405 100644 --- a/internal/pkg/core/events/event.go +++ b/internal/pkg/core/events/event.go @@ -3,13 +3,17 @@ package events import ( "time" + typeMapper "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/reflection/typemapper" + uuid "github.com/satori/go.uuid" ) type IEvent interface { GetEventId() uuid.UUID - GetEventType() string GetOccurredOn() time.Time + // GetEventTypeName get short type name of the event - we use event short type name instead of full type name because this event in other receiver packages could have different package name + GetEventTypeName() string + GetEventFullTypeName() string } type Event struct { @@ -37,3 +41,11 @@ func (e *Event) GetEventType() string { func (e *Event) GetOccurredOn() time.Time { return e.OccurredOn } + +func (e *Event) GetEventTypeName() string { + return typeMapper.GetTypeName(e) +} + +func (e *Event) GetEventFullTypeName() string { + return typeMapper.GetFullTypeName(e) +} diff --git a/internal/pkg/core/messaging/mocks/IMessage.go b/internal/pkg/core/messaging/mocks/IMessage.go index 95db2f29..c7e7b3b6 100644 --- a/internal/pkg/core/messaging/mocks/IMessage.go +++ b/internal/pkg/core/messaging/mocks/IMessage.go @@ -104,7 +104,7 @@ func (_c *IMessage_GetCreated_Call) RunAndReturn(run func() time.Time) *IMessage } // GetEventTypeName provides a mock function with given fields: -func (_m *IMessage) GetEventTypeName() string { +func (_m *IMessage) GetMessageTypeName() string { ret := _m.Called() var r0 string @@ -117,14 +117,14 @@ func (_m *IMessage) GetEventTypeName() string { return r0 } -// IMessage_GetEventTypeName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEventTypeName' +// IMessage_GetEventTypeName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMessageTypeName' type IMessage_GetEventTypeName_Call struct { *mock.Call } // GetEventTypeName is a helper method to define mock.On call func (_e *IMessage_Expecter) GetEventTypeName() *IMessage_GetEventTypeName_Call { - return &IMessage_GetEventTypeName_Call{Call: _e.mock.On("GetEventTypeName")} + return &IMessage_GetEventTypeName_Call{Call: _e.mock.On("GetMessageTypeName")} } func (_c *IMessage_GetEventTypeName_Call) Run(run func()) *IMessage_GetEventTypeName_Call { @@ -223,7 +223,8 @@ func (_c *IMessage_SetEventTypeName_Call) RunAndReturn(run func(string)) *IMessa func NewIMessage(t interface { mock.TestingT Cleanup(func()) -}) *IMessage { +}, +) *IMessage { mock := &IMessage{} mock.Mock.Test(t) diff --git a/internal/pkg/core/messaging/otel/tracing/producer/producer.go b/internal/pkg/core/messaging/otel/tracing/producer/producer.go index ec504151..81315286 100644 --- a/internal/pkg/core/messaging/otel/tracing/producer/producer.go +++ b/internal/pkg/core/messaging/otel/tracing/producer/producer.go @@ -111,7 +111,7 @@ func getTraceOptions( semconv.MessageIDKey.String(message.GeMessageId()), semconv.MessagingMessageConversationID(correlationId), attribute.Key(tracing.MessageType). - String(message.GetEventTypeName()), + String(message.GetMessageTypeName()), attribute.Key(tracing.MessageName). String(messageHeader.GetMessageName(*meta)), attribute.Key(tracing.Payload).String(payload), diff --git a/internal/pkg/core/messaging/persistmessage/message_persistence_service.go b/internal/pkg/core/messaging/persistmessage/message_persistence_service.go deleted file mode 100644 index 7ae6258a..00000000 --- a/internal/pkg/core/messaging/persistmessage/message_persistence_service.go +++ /dev/null @@ -1,24 +0,0 @@ -package persistmessage - -import ( - "context" - - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/types" -) - -type IMessagePersistenceService interface { - GetByFilter( - predicate func(StoreMessage) bool, - ctx context.Context, - ) ([]StoreMessage, error) - AddPublishMessage( - messageEnvelope types.MessageEnvelopeTMessage, - ctx context.Context, - ) error - AddReceivedMessage( - messageEnvelope types.MessageEnvelope, - ctx context.Context, - ) error - Process(messageID string, ctx context.Context) error - ProcessAll(ctx context.Context) error -} diff --git a/internal/pkg/core/messaging/persistmessage/message_persistence_repository.go b/internal/pkg/core/messaging/persistmessage/message_service.go similarity index 61% rename from internal/pkg/core/messaging/persistmessage/message_persistence_repository.go rename to internal/pkg/core/messaging/persistmessage/message_service.go index 59d5c3f3..163deb03 100644 --- a/internal/pkg/core/messaging/persistmessage/message_persistence_repository.go +++ b/internal/pkg/core/messaging/persistmessage/message_service.go @@ -3,10 +3,12 @@ package persistmessage import ( "context" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/types" + uuid "github.com/satori/go.uuid" ) -type MessagePersistenceRepository interface { +type MessageService interface { Add(ctx context.Context, storeMessage *StoreMessage) error Update(ctx context.Context, storeMessage *StoreMessage) error ChangeState( @@ -22,4 +24,14 @@ type MessagePersistenceRepository interface { GetById(ctx context.Context, id uuid.UUID) (*StoreMessage, error) Remove(ctx context.Context, storeMessage *StoreMessage) (bool, error) CleanupMessages(ctx context.Context) error + Process(messageID string, ctx context.Context) error + ProcessAll(ctx context.Context) error + AddPublishMessage( + messageEnvelope types.MessageEnvelopeTMessage, + ctx context.Context, + ) error + AddReceivedMessage( + messageEnvelope types.MessageEnvelope, + ctx context.Context, + ) error } diff --git a/internal/pkg/core/messaging/persistmessage/store_message.go b/internal/pkg/core/messaging/persistmessage/store_message.go index 44ab41c0..8343df8f 100644 --- a/internal/pkg/core/messaging/persistmessage/store_message.go +++ b/internal/pkg/core/messaging/persistmessage/store_message.go @@ -25,7 +25,7 @@ type StoreMessage struct { ID uuid.UUID `gorm:"primaryKey"` DataType string Data string - Created time.Time + CreatedAt time.Time `gorm:"default:current_timestamp"` RetryCount int MessageStatus MessageStatus DeliveryType MessageDeliveryType @@ -41,7 +41,7 @@ func NewStoreMessage( ID: id, DataType: dataType, Data: data, - Created: time.Now(), + CreatedAt: time.Now(), MessageStatus: Stored, RetryCount: 0, DeliveryType: deliveryType, diff --git a/internal/pkg/core/messaging/types/message.go b/internal/pkg/core/messaging/types/message.go index 7203ffda..114b0b4b 100644 --- a/internal/pkg/core/messaging/types/message.go +++ b/internal/pkg/core/messaging/types/message.go @@ -2,14 +2,16 @@ package types import ( "time" + + typeMapper "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/reflection/typemapper" ) type IMessage interface { GeMessageId() string GetCreated() time.Time - GetEventTypeName() string - SetEventTypeName(string) - IsMessage() bool + // GetMessageTypeName get short type name of the message - we use message short type name instead of full type name because this message in other receiver packages could have different package name + GetMessageTypeName() string + GetMessageFullTypeName() string } type Message struct { @@ -27,13 +29,6 @@ func NewMessageWithTypeName(messageId string, eventTypeName string) *Message { return &Message{MessageId: messageId, Created: time.Now(), EventType: eventTypeName} } -func (m *Message) IsMessage() bool { - if m == nil { - return false - } - return true -} - func (m *Message) GeMessageId() string { return m.MessageId } @@ -42,10 +37,10 @@ func (m *Message) GetCreated() time.Time { return m.Created } -func (m *Message) GetEventTypeName() string { - return m.EventType +func (m *Message) GetMessageTypeName() string { + return typeMapper.GetTypeName(m) } -func (m *Message) SetEventTypeName(eventTypeName string) { - m.EventType = eventTypeName +func (m *Message) GetMessageFullTypeName() string { + return typeMapper.GetFullTypeName(m) } diff --git a/internal/pkg/core/messaging/types/mock_IMessage_test.go b/internal/pkg/core/messaging/types/mock_IMessage_test.go index 0b1b265b..7f030c23 100644 --- a/internal/pkg/core/messaging/types/mock_IMessage_test.go +++ b/internal/pkg/core/messaging/types/mock_IMessage_test.go @@ -104,7 +104,7 @@ func (_c *MockIMessage_GetCreated_Call) RunAndReturn(run func() time.Time) *Mock } // GetEventTypeName provides a mock function with given fields: -func (_m *MockIMessage) GetEventTypeName() string { +func (_m *MockIMessage) GetMessageTypeName() string { ret := _m.Called() var r0 string @@ -117,14 +117,14 @@ func (_m *MockIMessage) GetEventTypeName() string { return r0 } -// MockIMessage_GetEventTypeName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEventTypeName' +// MockIMessage_GetEventTypeName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMessageTypeName' type MockIMessage_GetEventTypeName_Call struct { *mock.Call } // GetEventTypeName is a helper method to define mock.On call func (_e *MockIMessage_Expecter) GetEventTypeName() *MockIMessage_GetEventTypeName_Call { - return &MockIMessage_GetEventTypeName_Call{Call: _e.mock.On("GetEventTypeName")} + return &MockIMessage_GetEventTypeName_Call{Call: _e.mock.On("GetMessageTypeName")} } func (_c *MockIMessage_GetEventTypeName_Call) Run(run func()) *MockIMessage_GetEventTypeName_Call { @@ -223,7 +223,8 @@ func (_c *MockIMessage_SetEventTypeName_Call) RunAndReturn(run func(string)) *Mo func NewMockIMessage(t interface { mock.TestingT Cleanup(func()) -}) *MockIMessage { +}, +) *MockIMessage { mock := &MockIMessage{} mock.Mock.Test(t) diff --git a/internal/pkg/core/mocks/EventSerializer.go b/internal/pkg/core/mocks/EventSerializer.go index 4cf217fa..c7de4adf 100644 --- a/internal/pkg/core/mocks/EventSerializer.go +++ b/internal/pkg/core/mocks/EventSerializer.go @@ -5,6 +5,8 @@ package mocks import ( reflect "reflect" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer/contratcs" + mock "github.com/stretchr/testify/mock" serializer "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer" @@ -343,15 +345,15 @@ func (_c *EventSerializer_Serialize_Call) RunAndReturn(run func(interface{}) (*s } // Serializer provides a mock function with given fields: -func (_m *EventSerializer) Serializer() serializer.Serializer { +func (_m *EventSerializer) Serializer() contratcs.Serializer { ret := _m.Called() - var r0 serializer.Serializer - if rf, ok := ret.Get(0).(func() serializer.Serializer); ok { + var r0 contratcs.Serializer + if rf, ok := ret.Get(0).(func() contratcs.Serializer); ok { r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(serializer.Serializer) + r0 = ret.Get(0).(contratcs.Serializer) } } @@ -375,12 +377,12 @@ func (_c *EventSerializer_Serializer_Call) Run(run func()) *EventSerializer_Seri return _c } -func (_c *EventSerializer_Serializer_Call) Return(_a0 serializer.Serializer) *EventSerializer_Serializer_Call { +func (_c *EventSerializer_Serializer_Call) Return(_a0 contratcs.Serializer) *EventSerializer_Serializer_Call { _c.Call.Return(_a0) return _c } -func (_c *EventSerializer_Serializer_Call) RunAndReturn(run func() serializer.Serializer) *EventSerializer_Serializer_Call { +func (_c *EventSerializer_Serializer_Call) RunAndReturn(run func() contratcs.Serializer) *EventSerializer_Serializer_Call { _c.Call.Return(run) return _c } @@ -390,7 +392,8 @@ func (_c *EventSerializer_Serializer_Call) RunAndReturn(run func() serializer.Se func NewEventSerializer(t interface { mock.TestingT Cleanup(func()) -}) *EventSerializer { +}, +) *EventSerializer { mock := &EventSerializer{} mock.Mock.Test(t) diff --git a/internal/pkg/core/mocks/IDomainEvent.go b/internal/pkg/core/mocks/IDomainEvent.go index 72c220e3..b8a34b51 100644 --- a/internal/pkg/core/mocks/IDomainEvent.go +++ b/internal/pkg/core/mocks/IDomainEvent.go @@ -165,14 +165,14 @@ func (_m *IDomainEvent) GetEventType() string { return r0 } -// IDomainEvent_GetEventType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEventType' +// IDomainEvent_GetEventType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEventTypeName' type IDomainEvent_GetEventType_Call struct { *mock.Call } // GetEventType is a helper method to define mock.On call func (_e *IDomainEvent_Expecter) GetEventType() *IDomainEvent_GetEventType_Call { - return &IDomainEvent_GetEventType_Call{Call: _e.mock.On("GetEventType")} + return &IDomainEvent_GetEventType_Call{Call: _e.mock.On("GetEventTypeName")} } func (_c *IDomainEvent_GetEventType_Call) Run(run func()) *IDomainEvent_GetEventType_Call { @@ -283,7 +283,8 @@ func (_c *IDomainEvent_WithAggregate_Call) RunAndReturn(run func(uuid.UUID, int6 func NewIDomainEvent(t interface { mock.TestingT Cleanup(func()) -}) *IDomainEvent { +}, +) *IDomainEvent { mock := &IDomainEvent{} mock.Mock.Test(t) diff --git a/internal/pkg/core/mocks/IEvent.go b/internal/pkg/core/mocks/IEvent.go index 57d4e505..02f5c2a3 100644 --- a/internal/pkg/core/mocks/IEvent.go +++ b/internal/pkg/core/mocks/IEvent.go @@ -80,14 +80,14 @@ func (_m *IEvent) GetEventType() string { return r0 } -// IEvent_GetEventType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEventType' +// IEvent_GetEventType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEventTypeName' type IEvent_GetEventType_Call struct { *mock.Call } // GetEventType is a helper method to define mock.On call func (_e *IEvent_Expecter) GetEventType() *IEvent_GetEventType_Call { - return &IEvent_GetEventType_Call{Call: _e.mock.On("GetEventType")} + return &IEvent_GetEventType_Call{Call: _e.mock.On("GetEventTypeName")} } func (_c *IEvent_GetEventType_Call) Run(run func()) *IEvent_GetEventType_Call { @@ -153,7 +153,8 @@ func (_c *IEvent_GetOccurredOn_Call) RunAndReturn(run func() time.Time) *IEvent_ func NewIEvent(t interface { mock.TestingT Cleanup(func()) -}) *IEvent { +}, +) *IEvent { mock := &IEvent{} mock.Mock.Test(t) diff --git a/internal/pkg/core/serializer/contratcs/event_serializer.go b/internal/pkg/core/serializer/contratcs/event_serializer.go new file mode 100644 index 00000000..ce36a2f1 --- /dev/null +++ b/internal/pkg/core/serializer/contratcs/event_serializer.go @@ -0,0 +1,17 @@ +package contratcs + +import ( + "reflect" + + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/domain" +) + +type EventSerializer interface { + Serialize(event domain.IDomainEvent) (*EventSerializationResult, error) + SerializeObject(event interface{}) (*EventSerializationResult, error) + Deserialize(data []byte, eventType string, contentType string) (domain.IDomainEvent, error) + DeserializeObject(data []byte, eventType string, contentType string) (interface{}, error) + DeserializeType(data []byte, eventType reflect.Type, contentType string) (domain.IDomainEvent, error) + ContentType() string + Serializer() Serializer +} diff --git a/internal/pkg/core/serializer/contratcs/event_serrialization_result.go b/internal/pkg/core/serializer/contratcs/event_serrialization_result.go new file mode 100644 index 00000000..f528235a --- /dev/null +++ b/internal/pkg/core/serializer/contratcs/event_serrialization_result.go @@ -0,0 +1,6 @@ +package contratcs + +type EventSerializationResult struct { + Data []byte + ContentType string +} diff --git a/internal/pkg/core/serializer/contratcs/message_serializer.go b/internal/pkg/core/serializer/contratcs/message_serializer.go new file mode 100644 index 00000000..30682839 --- /dev/null +++ b/internal/pkg/core/serializer/contratcs/message_serializer.go @@ -0,0 +1,16 @@ +package contratcs + +import ( + "reflect" + + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/types" +) + +type MessageSerializer interface { + Serialize(message types.IMessage) (*EventSerializationResult, error) + Deserialize(data []byte, messageType string, contentType string) (types.IMessage, error) + DeserializeObject(data []byte, messageType string, contentType string) (interface{}, error) + DeserializeType(data []byte, messageType reflect.Type, contentType string) (types.IMessage, error) + ContentType() string + Serializer() Serializer +} diff --git a/internal/pkg/core/serializer/contratcs/metadata_serializer.go b/internal/pkg/core/serializer/contratcs/metadata_serializer.go new file mode 100644 index 00000000..7f3d3966 --- /dev/null +++ b/internal/pkg/core/serializer/contratcs/metadata_serializer.go @@ -0,0 +1,8 @@ +package contratcs + +import "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/metadata" + +type MetadataSerializer interface { + Serialize(meta metadata.Metadata) ([]byte, error) + Deserialize(bytes []byte) (metadata.Metadata, error) +} diff --git a/internal/pkg/core/serializer/serilizer.go b/internal/pkg/core/serializer/contratcs/serilizer.go similarity index 95% rename from internal/pkg/core/serializer/serilizer.go rename to internal/pkg/core/serializer/contratcs/serilizer.go index 47825d26..24e1651c 100644 --- a/internal/pkg/core/serializer/serilizer.go +++ b/internal/pkg/core/serializer/contratcs/serilizer.go @@ -1,4 +1,4 @@ -package serializer +package contratcs type Serializer interface { Marshal(v interface{}) ([]byte, error) diff --git a/internal/pkg/core/serializer/event_serializer.go b/internal/pkg/core/serializer/event_serializer.go deleted file mode 100644 index c7338d96..00000000 --- a/internal/pkg/core/serializer/event_serializer.go +++ /dev/null @@ -1,154 +0,0 @@ -package serializer - -import ( - "reflect" - - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/events" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/types" - typeMapper "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/reflection/typemapper" - - "emperror.dev/errors" -) - -type EventSerializer interface { - Serialize(event interface{}) (*EventSerializationResult, error) - Deserialize(data []byte, eventType string, contentType string) (interface{}, error) - DeserializeType(data []byte, eventType reflect.Type, contentType string) (interface{}, error) - DeserializeMessage(data []byte, eventType string, contentType string) (interface{}, error) - DeserializeEvent(data []byte, eventType string, contentType string) (interface{}, error) - ContentType() string - Serializer() Serializer -} - -type EventSerializationResult struct { - Data []byte - ContentType string -} - -type DefaultEventSerializer struct { - serializer Serializer -} - -func NewDefaultEventSerializer(serializer Serializer) EventSerializer { - return &DefaultEventSerializer{serializer: serializer} -} - -func (s *DefaultEventSerializer) Serializer() Serializer { - return s.serializer -} - -func (s *DefaultEventSerializer) Serialize( - event interface{}, -) (*EventSerializationResult, error) { - if event == nil { - return &EventSerializationResult{Data: nil, ContentType: s.ContentType()}, nil - } - - // here we just get type name instead of full type name - eventType := typeMapper.GetTypeName(event) - - data, err := s.serializer.Marshal(event) - if err != nil { - return nil, errors.WrapIff(err, "event.GetJsonData type: %s", eventType) - } - - result := &EventSerializationResult{Data: data, ContentType: s.ContentType()} - - return result, nil -} - -func (s *DefaultEventSerializer) Deserialize( - data []byte, - eventType string, - contentType string, -) (interface{}, error) { - if data == nil { - return nil, nil - } - - targetEventPointer := typeMapper.InstanceByTypeName(eventType) - - if contentType != s.ContentType() { - return nil, errors.Errorf("contentType: %s is not supported", contentType) - } - - if err := s.serializer.Unmarshal(data, targetEventPointer); err != nil { - return nil, errors.WrapIff(err, "event.GetJsonData type: %s", eventType) - } - - return targetEventPointer, nil -} - -func (s *DefaultEventSerializer) DeserializeType( - data []byte, - eventType reflect.Type, - contentType string, -) (interface{}, error) { - if data == nil { - return nil, nil - } - - targetEventPointer := typeMapper.InstanceByType(eventType) - - if contentType != s.ContentType() { - return nil, errors.Errorf("contentType: %s is not supported", contentType) - } - - if err := s.serializer.Unmarshal(data, targetEventPointer); err != nil { - return nil, errors.WrapIff(err, "event.GetJsonData type: %s", eventType) - } - - return targetEventPointer, nil -} - -func (s *DefaultEventSerializer) DeserializeMessage( - data []byte, - eventType string, - contentType string, -) (interface{}, error) { - if data == nil { - return nil, nil - } - - targetEventPointer := typeMapper.InstanceByTypeNameAndImplementedInterface[types.IMessage]( - eventType, - ) - - if contentType != s.ContentType() { - return nil, errors.Errorf("contentType: %s is not supported", contentType) - } - - if err := s.serializer.Unmarshal(data, targetEventPointer); err != nil { - return nil, errors.WrapIff(err, "event.GetJsonData type: %s", eventType) - } - - return targetEventPointer, nil -} - -func (s *DefaultEventSerializer) DeserializeEvent( - data []byte, - eventType string, - contentType string, -) (interface{}, error) { - if data == nil { - return nil, nil - } - - targetEventPointer := typeMapper.InstanceByTypeNameAndImplementedInterface[events.IEvent]( - eventType, - ) - - if contentType != s.ContentType() { - return nil, errors.Errorf("contentType: %s is not supported", contentType) - } - - if err := s.serializer.Unmarshal(data, targetEventPointer); err != nil { - return nil, errors.WrapIff(err, "event.GetJsonData type: %s", eventType) - } - - return targetEventPointer, nil -} - -func (s *DefaultEventSerializer) ContentType() string { - return "application/json" -} diff --git a/internal/pkg/core/serializer/json/event_serializer.go b/internal/pkg/core/serializer/json/event_serializer.go new file mode 100644 index 00000000..901a7f58 --- /dev/null +++ b/internal/pkg/core/serializer/json/event_serializer.go @@ -0,0 +1,134 @@ +package json + +import ( + "reflect" + + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/domain" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer/contratcs" + typeMapper "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/reflection/typemapper" + + "emperror.dev/errors" +) + +type DefaultEventJsonSerializer struct { + serializer contratcs.Serializer +} + +func NewDefaultEventJsonSerializer(serializer contratcs.Serializer) contratcs.EventSerializer { + return &DefaultEventJsonSerializer{serializer: serializer} +} + +func (s *DefaultEventJsonSerializer) Serializer() contratcs.Serializer { + return s.serializer +} + +func (s *DefaultEventJsonSerializer) Serialize(event domain.IDomainEvent) (*contratcs.EventSerializationResult, error) { + return s.SerializeObject(event) +} + +func (s *DefaultEventJsonSerializer) SerializeObject(event interface{}) (*contratcs.EventSerializationResult, error) { + if event == nil { + return &contratcs.EventSerializationResult{Data: nil, ContentType: s.ContentType()}, nil + } + + // we use event short type name instead of full type name because this event in other receiver packages could have different package name + eventType := typeMapper.GetTypeName(event) + + data, err := s.serializer.Marshal(event) + if err != nil { + return nil, errors.WrapIff(err, "error in Marshaling: `%s`", eventType) + } + + result := &contratcs.EventSerializationResult{Data: data, ContentType: s.ContentType()} + + return result, nil +} + +func (s *DefaultEventJsonSerializer) Deserialize( + data []byte, + eventType string, + contentType string, +) (domain.IDomainEvent, error) { + if data == nil { + return nil, nil + } + + targetEventPointer := typeMapper.EmptyInstanceByTypeNameAndImplementedInterface[domain.IDomainEvent]( + eventType, + ) + + if targetEventPointer == nil { + return nil, errors.Errorf("event type `%s` is not impelemted IDomainEvent or can't be instansiated", eventType) + } + + if contentType != s.ContentType() { + return nil, errors.Errorf("contentType: %s is not supported", contentType) + } + + if err := s.serializer.Unmarshal(data, targetEventPointer); err != nil { + return nil, errors.WrapIff(err, "error in Unmarshaling: `%s`", eventType) + } + + return targetEventPointer.(domain.IDomainEvent), nil +} + +func (s *DefaultEventJsonSerializer) DeserializeObject( + data []byte, + eventType string, + contentType string, +) (interface{}, error) { + if data == nil { + return nil, nil + } + + targetEventPointer := typeMapper.InstanceByTypeName(eventType) + + if targetEventPointer == nil { + return nil, errors.Errorf("event type `%s` can't be instansiated", eventType) + } + + if contentType != s.ContentType() { + return nil, errors.Errorf("contentType: %s is not supported", contentType) + } + + if err := s.serializer.Unmarshal(data, targetEventPointer); err != nil { + return nil, errors.WrapIff(err, "error in Unmarshaling: `%s`", eventType) + } + + return targetEventPointer, nil +} + +func (s *DefaultEventJsonSerializer) DeserializeType( + data []byte, + eventType reflect.Type, + contentType string, +) (domain.IDomainEvent, error) { + if data == nil { + return nil, nil + } + + // we use event short type name instead of full type name because this event in other receiver packages could have different package name + eventTypeName := typeMapper.GetTypeName(eventType) + + targetEventPointer := typeMapper.EmptyInstanceByTypeNameAndImplementedInterface[domain.IDomainEvent]( + eventTypeName, + ) + + if targetEventPointer == nil { + return nil, errors.Errorf("event type `%s` is not impelemted IDomainEvent or can't be instansiated", eventType) + } + + if contentType != s.ContentType() { + return nil, errors.Errorf("contentType: %s is not supported", contentType) + } + + if err := s.serializer.Unmarshal(data, targetEventPointer); err != nil { + return nil, errors.WrapIff(err, "error in Unmarshaling: `%s`", eventType) + } + + return targetEventPointer.(domain.IDomainEvent), nil +} + +func (s *DefaultEventJsonSerializer) ContentType() string { + return "application/json" +} diff --git a/internal/pkg/core/serializer/json/json_serializer.go b/internal/pkg/core/serializer/json/json_serializer.go index 16018f86..930260f0 100644 --- a/internal/pkg/core/serializer/json/json_serializer.go +++ b/internal/pkg/core/serializer/json/json_serializer.go @@ -3,7 +3,7 @@ package json import ( "log" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer/contratcs" "github.com/TylerBrock/colorjson" "github.com/goccy/go-json" @@ -12,7 +12,7 @@ import ( type jsonSerializer struct{} -func NewDefaultSerializer() serializer.Serializer { +func NewDefaultJsonSerializer() contratcs.Serializer { return &jsonSerializer{} } diff --git a/internal/pkg/core/serializer/json/json_serilizer_test.go b/internal/pkg/core/serializer/json/json_serilizer_test.go index 6c35f431..3877cb6e 100644 --- a/internal/pkg/core/serializer/json/json_serilizer_test.go +++ b/internal/pkg/core/serializer/json/json_serilizer_test.go @@ -1,3 +1,6 @@ +//go:build unit +// +build unit + package json import ( @@ -12,7 +15,7 @@ type person struct { Age int } -var currentSerializer = NewDefaultSerializer() +var currentSerializer = NewDefaultJsonSerializer() func Test_Deserialize_Unstructured_Data_Into_Empty_Interface(t *testing.T) { // https://www.sohamkamani.com/golang/json/#decoding-json-to-maps---unstructured-data diff --git a/internal/pkg/core/serializer/json/message_serializer.go b/internal/pkg/core/serializer/json/message_serializer.go new file mode 100644 index 00000000..a5b981cc --- /dev/null +++ b/internal/pkg/core/serializer/json/message_serializer.go @@ -0,0 +1 @@ +package json diff --git a/internal/pkg/core/serializer/json/metadata_serializer.go b/internal/pkg/core/serializer/json/metadata_serializer.go new file mode 100644 index 00000000..5f9f648c --- /dev/null +++ b/internal/pkg/core/serializer/json/metadata_serializer.go @@ -0,0 +1,44 @@ +package json + +import ( + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/metadata" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer/contratcs" + + "emperror.dev/errors" +) + +type DefaultMetadataJsonSerializer struct { + serializer contratcs.Serializer +} + +func NewDefaultMetadataJsonSerializer(serializer contratcs.Serializer) contratcs.MetadataSerializer { + return &DefaultMetadataJsonSerializer{serializer: serializer} +} + +func (s *DefaultMetadataJsonSerializer) Serialize(meta metadata.Metadata) ([]byte, error) { + if meta == nil { + return nil, nil + } + + marshal, err := s.serializer.Marshal(meta) + if err != nil { + return nil, errors.WrapIf(err, "failed to marshal metadata") + } + + return marshal, nil +} + +func (s *DefaultMetadataJsonSerializer) Deserialize(bytes []byte) (metadata.Metadata, error) { + if bytes == nil { + return nil, nil + } + + var meta metadata.Metadata + + err := s.serializer.Unmarshal(bytes, &meta) + if err != nil { + return nil, errors.WrapIf(err, "failed to unmarshal metadata") + } + + return meta, nil +} diff --git a/internal/pkg/core/serializer/metadata_serializer.go b/internal/pkg/core/serializer/metadata_serializer.go deleted file mode 100644 index 4c75ee8a..00000000 --- a/internal/pkg/core/serializer/metadata_serializer.go +++ /dev/null @@ -1,48 +0,0 @@ -package serializer - -import ( - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/metadata" - - "emperror.dev/errors" -) - -type MetadataSerializer interface { - Serialize(meta metadata.Metadata) ([]byte, error) - Deserialize(bytes []byte) (metadata.Metadata, error) -} - -type DefaultMetadataSerializer struct { - serializer Serializer -} - -func NewDefaultMetadataSerializer(serializer Serializer) MetadataSerializer { - return &DefaultMetadataSerializer{serializer: serializer} -} - -func (s *DefaultMetadataSerializer) Serialize(meta metadata.Metadata) ([]byte, error) { - if meta == nil { - return nil, nil - } - - marshal, err := s.serializer.Marshal(meta) - if err != nil { - return nil, errors.WrapIf(err, "failed to marshal metadata") - } - - return marshal, nil -} - -func (s *DefaultMetadataSerializer) Deserialize(bytes []byte) (metadata.Metadata, error) { - if bytes == nil { - return nil, nil - } - - var meta metadata.Metadata - - err := s.serializer.Unmarshal(bytes, &meta) - if err != nil { - return nil, errors.WrapIf(err, "failed to unmarshal metadata") - } - - return meta, nil -} diff --git a/internal/pkg/es/errors/errors.go b/internal/pkg/es/errors/errors.go index 4a2980c1..e431daf4 100644 --- a/internal/pkg/es/errors/errors.go +++ b/internal/pkg/es/errors/errors.go @@ -3,7 +3,7 @@ package errors import ( "fmt" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "emperror.dev/errors" ) diff --git a/internal/pkg/eventstroredb/errors/aggregate_not_found_error.go b/internal/pkg/eventstroredb/errors/aggregate_not_found_error.go index 54f4da05..2d8b089d 100644 --- a/internal/pkg/eventstroredb/errors/aggregate_not_found_error.go +++ b/internal/pkg/eventstroredb/errors/aggregate_not_found_error.go @@ -3,7 +3,7 @@ package errors import ( "fmt" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "emperror.dev/errors" uuid "github.com/satori/go.uuid" diff --git a/internal/pkg/eventstroredb/errors/append_to_stream_error.go b/internal/pkg/eventstroredb/errors/append_to_stream_error.go index bb40ca1f..060b3a16 100644 --- a/internal/pkg/eventstroredb/errors/append_to_stream_error.go +++ b/internal/pkg/eventstroredb/errors/append_to_stream_error.go @@ -3,7 +3,7 @@ package errors import ( "fmt" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "emperror.dev/errors" ) diff --git a/internal/pkg/eventstroredb/errors/delete_stream_error.go b/internal/pkg/eventstroredb/errors/delete_stream_error.go index 5e840f62..8d93cd58 100644 --- a/internal/pkg/eventstroredb/errors/delete_stream_error.go +++ b/internal/pkg/eventstroredb/errors/delete_stream_error.go @@ -3,7 +3,7 @@ package errors import ( "fmt" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "emperror.dev/errors" ) diff --git a/internal/pkg/eventstroredb/errors/read_stream_error.go b/internal/pkg/eventstroredb/errors/read_stream_error.go index 3ea35e12..68d0b7cb 100644 --- a/internal/pkg/eventstroredb/errors/read_stream_error.go +++ b/internal/pkg/eventstroredb/errors/read_stream_error.go @@ -1,7 +1,7 @@ package errors import ( - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "emperror.dev/errors" ) diff --git a/internal/pkg/eventstroredb/errors/stream_not_found_error.go b/internal/pkg/eventstroredb/errors/stream_not_found_error.go index e9d2d45c..d89d42a2 100644 --- a/internal/pkg/eventstroredb/errors/stream_not_found_error.go +++ b/internal/pkg/eventstroredb/errors/stream_not_found_error.go @@ -3,7 +3,7 @@ package errors import ( "fmt" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "emperror.dev/errors" ) diff --git a/internal/pkg/eventstroredb/errors/truncate_stream_error.go b/internal/pkg/eventstroredb/errors/truncate_stream_error.go index 479f7a39..13c8edc8 100644 --- a/internal/pkg/eventstroredb/errors/truncate_stream_error.go +++ b/internal/pkg/eventstroredb/errors/truncate_stream_error.go @@ -3,7 +3,7 @@ package errors import ( "fmt" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "emperror.dev/errors" ) diff --git a/internal/pkg/eventstroredb/esdb_serilizer.go b/internal/pkg/eventstroredb/esdb_serilizer.go index 2de85f15..a5cb1910 100644 --- a/internal/pkg/eventstroredb/esdb_serilizer.go +++ b/internal/pkg/eventstroredb/esdb_serilizer.go @@ -6,7 +6,7 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/domain" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/metadata" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer/contratcs" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/es/models" appendResult "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/es/models/append_result" readPosition "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/es/models/stream_position/read_position" @@ -23,13 +23,13 @@ import ( ) type EsdbSerializer struct { - metadataSerializer serializer.MetadataSerializer - eventSerializer serializer.EventSerializer + metadataSerializer contratcs.MetadataSerializer + eventSerializer contratcs.EventSerializer } func NewEsdbSerializer( - metadataSerializer serializer.MetadataSerializer, - eventSerializer serializer.EventSerializer, + metadataSerializer contratcs.MetadataSerializer, + eventSerializer contratcs.EventSerializer, ) *EsdbSerializer { return &EsdbSerializer{ metadataSerializer: metadataSerializer, @@ -139,7 +139,7 @@ func (e *EsdbSerializer) EsdbPositionToStreamReadPosition( func (e *EsdbSerializer) ResolvedEventToStreamEvent( resolveEvent *esdb.ResolvedEvent, ) (*models.StreamEvent, error) { - deserializedEvent, err := e.eventSerializer.DeserializeEvent( + deserializedEvent, err := e.eventSerializer.Deserialize( resolveEvent.Event.Data, resolveEvent.Event.EventType, resolveEvent.Event.ContentType, @@ -160,7 +160,7 @@ func (e *EsdbSerializer) ResolvedEventToStreamEvent( return &models.StreamEvent{ EventID: id, - Event: deserializedEvent.(domain.IDomainEvent), + Event: deserializedEvent, Metadata: deserializedMeta, Version: int64(resolveEvent.Event.EventNumber), Position: e.EsdbPositionToStreamReadPosition(resolveEvent.OriginalEvent().Position).Value(), @@ -192,6 +192,30 @@ func (e *EsdbSerializer) EsdbWriteResultToAppendEventResult( } func (e *EsdbSerializer) Serialize( + data domain.IDomainEvent, + meta metadata.Metadata, +) (*esdb.EventData, error) { + serializedData, err := e.eventSerializer.Serialize(data) + if err != nil { + return nil, err + } + + serializedMeta, err := e.metadataSerializer.Serialize(meta) + if err != nil { + return nil, err + } + + id, err := uuid.NewV4() + return &esdb.EventData{ + EventID: id, + EventType: typeMapper.GetTypeName(data), + Data: serializedData.Data, + ContentType: esdb.JsonContentType, + Metadata: serializedMeta, + }, nil +} + +func (e *EsdbSerializer) SerializeObject( data interface{}, meta metadata.Metadata, ) (*esdb.EventData, error) { @@ -217,12 +241,36 @@ func (e *EsdbSerializer) Serialize( func (e *EsdbSerializer) Deserialize( resolveEvent *esdb.ResolvedEvent, +) (domain.IDomainEvent, metadata.Metadata, error) { + eventType := resolveEvent.Event.EventType + data := resolveEvent.Event.Data + userMeta := resolveEvent.Event.UserMetadata + + payload, err := e.eventSerializer.Deserialize( + data, + eventType, + resolveEvent.Event.ContentType, + ) + if err != nil { + return nil, nil, err + } + + meta, err := e.metadataSerializer.Deserialize(userMeta) + if err != nil { + return nil, nil, err + } + + return payload, meta, nil +} + +func (e *EsdbSerializer) DeserializeObject( + resolveEvent *esdb.ResolvedEvent, ) (interface{}, metadata.Metadata, error) { eventType := resolveEvent.Event.EventType data := resolveEvent.Event.Data userMeta := resolveEvent.Event.UserMetadata - payload, err := e.eventSerializer.DeserializeEvent( + payload, err := e.eventSerializer.Deserialize( data, eventType, resolveEvent.Event.ContentType, diff --git a/internal/pkg/eventstroredb/esdb_subscription_check_point_repository.go b/internal/pkg/eventstroredb/esdb_subscription_check_point_repository.go index 739b5321..ebcf09ad 100644 --- a/internal/pkg/eventstroredb/esdb_subscription_check_point_repository.go +++ b/internal/pkg/eventstroredb/esdb_subscription_check_point_repository.go @@ -71,7 +71,7 @@ func (e *esdbSubscriptionCheckpointRepository) Load( return 0, errors.WrapIf(err, "stream.Recv") } - deserialized, _, err := e.esdbSerilizer.Deserialize(event) + deserialized, _, err := e.esdbSerilizer.DeserializeObject(event) if err != nil { return 0, err } diff --git a/internal/pkg/eventstroredb/event_store.go b/internal/pkg/eventstroredb/event_store.go index f2b1e57c..d6bf7049 100644 --- a/internal/pkg/eventstroredb/event_store.go +++ b/internal/pkg/eventstroredb/event_store.go @@ -68,7 +68,7 @@ func (e *eventStoreDbEventStore) StreamExists( span, errors.WithMessage( esErrors.NewReadStreamError(err), - "[eventStoreDbEventStore_StreamExists:ReadStream] error in reading stream", + "error in reading stream", ), ) } @@ -113,7 +113,7 @@ func (e *eventStoreDbEventStore) AppendEvents( span, errors.WithMessage( esErrors.NewAppendToStreamError(err, streamName.String()), - "[eventStoreDbEventStore_AppendEvents:AppendToStream] error in appending to stream", + "error in appending to stream", ), ) } @@ -125,7 +125,7 @@ func (e *eventStoreDbEventStore) AppendEvents( ) e.log.Infow( - "[eventStoreDbEventStore_AppendEvents] events append to stream successfully", + "events append to stream successfully", logger.Fields{ "AppendEventsResult": appendEventsResult, "StreamId": streamName.String(), @@ -155,7 +155,7 @@ func (e *eventStoreDbEventStore) AppendNewEvents( span, errors.WithMessage( esErrors.NewAppendToStreamError(err, streamName.String()), - "[eventStoreDbEventStore_AppendNewEvents:AppendEvents] error in appending to stream", + "error in appending to stream", ), ) } @@ -163,7 +163,7 @@ func (e *eventStoreDbEventStore) AppendNewEvents( span.SetAttributes(attribute.Object("AppendNewEvents", appendEventsResult)) e.log.Infow( - "[eventStoreDbEventStore_AppendNewEvents] events append to stream successfully", + "events append to stream successfully", logger.Fields{ "AppendEventsResult": appendEventsResult, "StreamId": streamName.String(), @@ -199,7 +199,7 @@ func (e *eventStoreDbEventStore) ReadEvents( span, errors.WithMessage( esErrors.NewReadStreamError(err), - "[eventStoreDbEventStore_ReadEvents:ReadStream] error in reading stream", + "error in reading stream", ), ) } @@ -214,7 +214,7 @@ func (e *eventStoreDbEventStore) ReadEvents( span, errors.WrapIf( err, - "[eventStoreDbEventStore_ReadEvents.EsdbReadStreamToResolvedEvents] error in converting to resolved events", + "error in converting to resolved events", ), ) } @@ -225,7 +225,7 @@ func (e *eventStoreDbEventStore) ReadEvents( span, errors.WrapIf( err, - "[eventStoreDbEventStore_ReadEvents.ResolvedEventsToStreamEvents] error in converting to stream events", + "error in converting to stream events", ), ) } @@ -389,7 +389,7 @@ func (e *eventStoreDbEventStore) TruncateStream( span, errors.WithMessage( esErrors.NewTruncateStreamError(err, streamName.String()), - "[eventStoreDbEventStore_TruncateStream:SetStreamMetadata] error in truncating stream", + "error in truncating stream", ), ) } @@ -398,7 +398,7 @@ func (e *eventStoreDbEventStore) TruncateStream( e.log.Infow( fmt.Sprintf( - "[eventStoreDbEventStore.TruncateStream] stream with id %s truncated successfully", + "stream with id %s truncated successfully", streamName.String(), ), logger.Fields{ @@ -432,7 +432,7 @@ func (e *eventStoreDbEventStore) DeleteStream( span, errors.WithMessage( esErrors.NewDeleteStreamError(err, streamName.String()), - "[eventStoreDbEventStore_DeleteStream:DeleteStream] error in deleting stream", + "error in deleting stream", ), ) } @@ -441,7 +441,7 @@ func (e *eventStoreDbEventStore) DeleteStream( e.log.Infow( fmt.Sprintf( - "[eventStoreDbEventStore.DeleteStream] stream with id %s deleted successfully", + "stream with id %s deleted successfully", streamName.String(), ), logger.Fields{ diff --git a/internal/pkg/grpc/grpcErrors/custom_grpc_errors.go b/internal/pkg/grpc/grpcerrors/custom_grpc_errors.go similarity index 99% rename from internal/pkg/grpc/grpcErrors/custom_grpc_errors.go rename to internal/pkg/grpc/grpcerrors/custom_grpc_errors.go index f28fd4af..cd1066f5 100644 --- a/internal/pkg/grpc/grpcErrors/custom_grpc_errors.go +++ b/internal/pkg/grpc/grpcerrors/custom_grpc_errors.go @@ -1,4 +1,4 @@ -package grpcErrors +package grpcerrors import ( "time" diff --git a/internal/pkg/grpc/grpcErrors/grpc_error_parser.go b/internal/pkg/grpc/grpcerrors/grpc_error_parser.go similarity index 96% rename from internal/pkg/grpc/grpcErrors/grpc_error_parser.go rename to internal/pkg/grpc/grpcerrors/grpc_error_parser.go index be8a55d4..d951ae45 100644 --- a/internal/pkg/grpc/grpcErrors/grpc_error_parser.go +++ b/internal/pkg/grpc/grpcerrors/grpc_error_parser.go @@ -1,12 +1,12 @@ -package grpcErrors +package grpcerrors import ( "context" "database/sql" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/constants" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" - errorUtils "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils/error_utils" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" + errorUtils "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils/errorutils" "emperror.dev/errors" "github.com/go-playground/validator" diff --git a/internal/pkg/grpc/grpcErrors/grpc_errors.go b/internal/pkg/grpc/grpcerrors/grpc_errors.go similarity index 99% rename from internal/pkg/grpc/grpcErrors/grpc_errors.go rename to internal/pkg/grpc/grpcerrors/grpc_errors.go index 2d4f41aa..1e62d063 100644 --- a/internal/pkg/grpc/grpcErrors/grpc_errors.go +++ b/internal/pkg/grpc/grpcerrors/grpc_errors.go @@ -1,4 +1,4 @@ -package grpcErrors +package grpcerrors import ( "encoding/json" diff --git a/internal/pkg/grpc/interceptors/grpc_error/error_interceptor.go b/internal/pkg/grpc/interceptors/grpcerror/error_interceptor.go similarity index 87% rename from internal/pkg/grpc/interceptors/grpc_error/error_interceptor.go rename to internal/pkg/grpc/interceptors/grpcerror/error_interceptor.go index 3f267c71..aa23aef0 100644 --- a/internal/pkg/grpc/interceptors/grpc_error/error_interceptor.go +++ b/internal/pkg/grpc/interceptors/grpcerror/error_interceptor.go @@ -3,7 +3,7 @@ package grpcError import ( "context" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/grpc/grpcErrors" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/grpc/grpcerrors" "emperror.dev/errors" "google.golang.org/grpc" @@ -19,11 +19,11 @@ func UnaryServerInterceptor() grpc.UnaryServerInterceptor { ) (interface{}, error) { resp, err := handler(ctx, req) - var grpcErr grpcErrors.GrpcErr + var grpcErr grpcerrors.GrpcErr // if error was not `grpcErr` we will convert the error to a `grpcErr` if ok := errors.As(err, &grpcErr); !ok { - grpcErr = grpcErrors.ParseError(err) + grpcErr = grpcerrors.ParseError(err) } if grpcErr != nil { @@ -44,11 +44,11 @@ func StreamServerInterceptor() grpc.StreamServerInterceptor { ) error { err := handler(srv, ss) - var grpcErr grpcErrors.GrpcErr + var grpcErr grpcerrors.GrpcErr // if error was not `grpcErr` we will convert the error to a `grpcErr` if ok := errors.As(err, &grpcErr); !ok { - grpcErr = grpcErrors.ParseError(err) + grpcErr = grpcerrors.ParseError(err) } if grpcErr != nil { diff --git a/internal/pkg/grpc/server.go b/internal/pkg/grpc/server.go index 98c0cce3..78a8ece2 100644 --- a/internal/pkg/grpc/server.go +++ b/internal/pkg/grpc/server.go @@ -7,7 +7,7 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/grpc/config" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/grpc/handlers/otel" - grpcError "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/grpc/interceptors/grpc_error" + grpcError "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/grpc/interceptors/grpcerror" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "emperror.dev/errors" diff --git a/internal/pkg/health/health_endpoint.go b/internal/pkg/health/health_endpoint.go index 75a10fcd..20fe7363 100644 --- a/internal/pkg/health/health_endpoint.go +++ b/internal/pkg/health/health_endpoint.go @@ -4,7 +4,7 @@ import ( "net/http" contracts2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/health/contracts" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/contracts" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/contracts" "github.com/labstack/echo/v4" ) diff --git a/internal/pkg/http/custom_echo/config/echo_http_options.go b/internal/pkg/http/customecho/config/echo_http_options.go similarity index 100% rename from internal/pkg/http/custom_echo/config/echo_http_options.go rename to internal/pkg/http/customecho/config/echo_http_options.go diff --git a/internal/pkg/http/custom_echo/contracts/echoserver.go b/internal/pkg/http/customecho/contracts/echoserver.go similarity index 96% rename from internal/pkg/http/custom_echo/contracts/echoserver.go rename to internal/pkg/http/customecho/contracts/echoserver.go index a53f95ef..bc4d22cf 100644 --- a/internal/pkg/http/custom_echo/contracts/echoserver.go +++ b/internal/pkg/http/customecho/contracts/echoserver.go @@ -3,7 +3,7 @@ package contracts import ( "context" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/config" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/config" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/labstack/echo/v4" diff --git a/internal/pkg/http/custom_echo/contracts/route_builder.go b/internal/pkg/http/customecho/contracts/route_builder.go similarity index 100% rename from internal/pkg/http/custom_echo/contracts/route_builder.go rename to internal/pkg/http/customecho/contracts/route_builder.go diff --git a/internal/pkg/http/custom_echo/custom_echo_fx.go b/internal/pkg/http/customecho/custom_echo_fx.go similarity index 98% rename from internal/pkg/http/custom_echo/custom_echo_fx.go rename to internal/pkg/http/customecho/custom_echo_fx.go index a73fa406..d0baf920 100644 --- a/internal/pkg/http/custom_echo/custom_echo_fx.go +++ b/internal/pkg/http/customecho/custom_echo_fx.go @@ -5,8 +5,8 @@ import ( "errors" "net/http" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/config" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/contracts" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/config" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/contracts" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "go.uber.org/fx" diff --git a/internal/pkg/http/custom_echo/echo_server.go b/internal/pkg/http/customecho/echo_server.go similarity index 92% rename from internal/pkg/http/custom_echo/echo_server.go rename to internal/pkg/http/customecho/echo_server.go index 384878d3..83b25d98 100644 --- a/internal/pkg/http/custom_echo/echo_server.go +++ b/internal/pkg/http/customecho/echo_server.go @@ -6,14 +6,14 @@ import ( "strings" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/constants" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/config" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/contracts" - hadnlers "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/hadnlers" - ipratelimit "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/middlewares/ip_ratelimit" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/middlewares/log" - otelMetrics "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/middlewares/otel_metrics" - oteltracing "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/middlewares/otel_tracing" - problemdetail "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/middlewares/problem_detail" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/config" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/contracts" + hadnlers "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/hadnlers" + ipratelimit "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/middlewares/ip_ratelimit" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/middlewares/log" + otelMetrics "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/middlewares/otel_metrics" + oteltracing "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/middlewares/otel_tracing" + problemdetail "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/middlewares/problem_detail" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/labstack/echo/v4" diff --git a/internal/pkg/http/custom_echo/hadnlers/problemdetail_error_handler.go b/internal/pkg/http/customecho/hadnlers/problemdetail_error_handler.go similarity index 86% rename from internal/pkg/http/custom_echo/hadnlers/problemdetail_error_handler.go rename to internal/pkg/http/customecho/hadnlers/problemdetail_error_handler.go index 2cbbeab2..bc291f20 100644 --- a/internal/pkg/http/custom_echo/hadnlers/problemdetail_error_handler.go +++ b/internal/pkg/http/customecho/hadnlers/problemdetail_error_handler.go @@ -1,7 +1,7 @@ package handlers import ( - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/problemDetails" + problemDetails "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/problemdetails" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "emperror.dev/errors" diff --git a/internal/pkg/http/custom_echo/middlewares/ip_ratelimit/config.go b/internal/pkg/http/customecho/middlewares/ip_ratelimit/config.go similarity index 100% rename from internal/pkg/http/custom_echo/middlewares/ip_ratelimit/config.go rename to internal/pkg/http/customecho/middlewares/ip_ratelimit/config.go diff --git a/internal/pkg/http/custom_echo/middlewares/ip_ratelimit/ip_ratelimit.go b/internal/pkg/http/customecho/middlewares/ip_ratelimit/ip_ratelimit.go similarity index 100% rename from internal/pkg/http/custom_echo/middlewares/ip_ratelimit/ip_ratelimit.go rename to internal/pkg/http/customecho/middlewares/ip_ratelimit/ip_ratelimit.go diff --git a/internal/pkg/http/custom_echo/middlewares/log/config.go b/internal/pkg/http/customecho/middlewares/log/config.go similarity index 100% rename from internal/pkg/http/custom_echo/middlewares/log/config.go rename to internal/pkg/http/customecho/middlewares/log/config.go diff --git a/internal/pkg/http/custom_echo/middlewares/log/log_middleware.go b/internal/pkg/http/customecho/middlewares/log/log_middleware.go similarity index 100% rename from internal/pkg/http/custom_echo/middlewares/log/log_middleware.go rename to internal/pkg/http/customecho/middlewares/log/log_middleware.go diff --git a/internal/pkg/http/custom_echo/middlewares/otel_metrics/config.go b/internal/pkg/http/customecho/middlewares/otel_metrics/config.go similarity index 100% rename from internal/pkg/http/custom_echo/middlewares/otel_metrics/config.go rename to internal/pkg/http/customecho/middlewares/otel_metrics/config.go diff --git a/internal/pkg/http/custom_echo/middlewares/otel_metrics/metric.go b/internal/pkg/http/customecho/middlewares/otel_metrics/metric.go similarity index 100% rename from internal/pkg/http/custom_echo/middlewares/otel_metrics/metric.go rename to internal/pkg/http/customecho/middlewares/otel_metrics/metric.go diff --git a/internal/pkg/http/custom_echo/middlewares/otel_metrics/metrics_middleware.go b/internal/pkg/http/customecho/middlewares/otel_metrics/metrics_middleware.go similarity index 100% rename from internal/pkg/http/custom_echo/middlewares/otel_metrics/metrics_middleware.go rename to internal/pkg/http/customecho/middlewares/otel_metrics/metrics_middleware.go diff --git a/internal/pkg/http/custom_echo/middlewares/otel_metrics/view.go b/internal/pkg/http/customecho/middlewares/otel_metrics/view.go similarity index 100% rename from internal/pkg/http/custom_echo/middlewares/otel_metrics/view.go rename to internal/pkg/http/customecho/middlewares/otel_metrics/view.go diff --git a/internal/pkg/http/custom_echo/middlewares/otel_tracing/config.go b/internal/pkg/http/customecho/middlewares/otel_tracing/config.go similarity index 100% rename from internal/pkg/http/custom_echo/middlewares/otel_tracing/config.go rename to internal/pkg/http/customecho/middlewares/otel_tracing/config.go diff --git a/internal/pkg/http/custom_echo/middlewares/otel_tracing/tracing_middleware.go b/internal/pkg/http/customecho/middlewares/otel_tracing/tracing_middleware.go similarity index 100% rename from internal/pkg/http/custom_echo/middlewares/otel_tracing/tracing_middleware.go rename to internal/pkg/http/customecho/middlewares/otel_tracing/tracing_middleware.go diff --git a/internal/pkg/http/custom_echo/middlewares/problem_detail/config.go b/internal/pkg/http/customecho/middlewares/problem_detail/config.go similarity index 83% rename from internal/pkg/http/custom_echo/middlewares/problem_detail/config.go rename to internal/pkg/http/customecho/middlewares/problem_detail/config.go index 715133a7..27fcbc3c 100644 --- a/internal/pkg/http/custom_echo/middlewares/problem_detail/config.go +++ b/internal/pkg/http/customecho/middlewares/problem_detail/config.go @@ -1,7 +1,7 @@ package problemdetail import ( - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/problemDetails" + problemDetails "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/problemdetails" "github.com/labstack/echo/v4/middleware" ) diff --git a/internal/pkg/http/custom_echo/middlewares/problem_detail/problem_detail_middleware.go b/internal/pkg/http/customecho/middlewares/problem_detail/problem_detail_middleware.go similarity index 89% rename from internal/pkg/http/custom_echo/middlewares/problem_detail/problem_detail_middleware.go rename to internal/pkg/http/customecho/middlewares/problem_detail/problem_detail_middleware.go index 829548d9..9db974a1 100644 --- a/internal/pkg/http/custom_echo/middlewares/problem_detail/problem_detail_middleware.go +++ b/internal/pkg/http/customecho/middlewares/problem_detail/problem_detail_middleware.go @@ -1,7 +1,7 @@ package problemdetail import ( - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/problemDetails" + problemDetails "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/problemdetails" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" diff --git a/internal/pkg/http/http_fx.go b/internal/pkg/http/http_fx.go index c2f9334a..20ba60cb 100644 --- a/internal/pkg/http/http_fx.go +++ b/internal/pkg/http/http_fx.go @@ -2,7 +2,7 @@ package http import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/client" - customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo" + customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho" "go.uber.org/fx" ) diff --git a/internal/pkg/http/http_errors/contracts/contracts.go b/internal/pkg/http/httperrors/contracts/contracts.go similarity index 100% rename from internal/pkg/http/http_errors/contracts/contracts.go rename to internal/pkg/http/httperrors/contracts/contracts.go diff --git a/internal/pkg/http/http_errors/custom_errors/api_error.go b/internal/pkg/http/httperrors/customerrors/api_error.go similarity index 100% rename from internal/pkg/http/http_errors/custom_errors/api_error.go rename to internal/pkg/http/httperrors/customerrors/api_error.go diff --git a/internal/pkg/http/http_errors/custom_errors/application_error.go b/internal/pkg/http/httperrors/customerrors/application_error.go similarity index 100% rename from internal/pkg/http/http_errors/custom_errors/application_error.go rename to internal/pkg/http/httperrors/customerrors/application_error.go diff --git a/internal/pkg/http/http_errors/custom_errors/bad_request_error.go b/internal/pkg/http/httperrors/customerrors/bad_request_error.go similarity index 100% rename from internal/pkg/http/http_errors/custom_errors/bad_request_error.go rename to internal/pkg/http/httperrors/customerrors/bad_request_error.go diff --git a/internal/pkg/http/http_errors/custom_errors/conflict_error.go b/internal/pkg/http/httperrors/customerrors/conflict_error.go similarity index 100% rename from internal/pkg/http/http_errors/custom_errors/conflict_error.go rename to internal/pkg/http/httperrors/customerrors/conflict_error.go diff --git a/internal/pkg/http/http_errors/custom_errors/custom_errors.go b/internal/pkg/http/httperrors/customerrors/custom_errors.go similarity index 98% rename from internal/pkg/http/http_errors/custom_errors/custom_errors.go rename to internal/pkg/http/httperrors/customerrors/custom_errors.go index a7a0d6c7..58d51b46 100644 --- a/internal/pkg/http/http_errors/custom_errors/custom_errors.go +++ b/internal/pkg/http/httperrors/customerrors/custom_errors.go @@ -4,7 +4,7 @@ import ( "fmt" "io" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/contracts" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/contracts" "emperror.dev/errors" ) diff --git a/internal/pkg/http/http_errors/custom_errors/custom_errors_test.go b/internal/pkg/http/httperrors/customerrors/custom_errors_test.go similarity index 99% rename from internal/pkg/http/http_errors/custom_errors/custom_errors_test.go rename to internal/pkg/http/httperrors/customerrors/custom_errors_test.go index 1298aded..60985897 100644 --- a/internal/pkg/http/http_errors/custom_errors/custom_errors_test.go +++ b/internal/pkg/http/httperrors/customerrors/custom_errors_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/contracts" - errorUtils "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils/error_utils" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/contracts" + errorUtils "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils/errorutils" "emperror.dev/errors" "github.com/stretchr/testify/assert" diff --git a/internal/pkg/http/http_errors/custom_errors/domain_error.go b/internal/pkg/http/httperrors/customerrors/domain_error.go similarity index 100% rename from internal/pkg/http/http_errors/custom_errors/domain_error.go rename to internal/pkg/http/httperrors/customerrors/domain_error.go diff --git a/internal/pkg/http/http_errors/custom_errors/forbiden_error.go b/internal/pkg/http/httperrors/customerrors/forbiden_error.go similarity index 100% rename from internal/pkg/http/http_errors/custom_errors/forbiden_error.go rename to internal/pkg/http/httperrors/customerrors/forbiden_error.go diff --git a/internal/pkg/http/http_errors/custom_errors/internal_server_error.go b/internal/pkg/http/httperrors/customerrors/internal_server_error.go similarity index 100% rename from internal/pkg/http/http_errors/custom_errors/internal_server_error.go rename to internal/pkg/http/httperrors/customerrors/internal_server_error.go diff --git a/internal/pkg/http/http_errors/custom_errors/marshaling_error.go b/internal/pkg/http/httperrors/customerrors/marshaling_error.go similarity index 100% rename from internal/pkg/http/http_errors/custom_errors/marshaling_error.go rename to internal/pkg/http/httperrors/customerrors/marshaling_error.go diff --git a/internal/pkg/http/http_errors/custom_errors/not_found_error.go b/internal/pkg/http/httperrors/customerrors/not_found_error.go similarity index 100% rename from internal/pkg/http/http_errors/custom_errors/not_found_error.go rename to internal/pkg/http/httperrors/customerrors/not_found_error.go diff --git a/internal/pkg/http/http_errors/custom_errors/unauthorized_error.go b/internal/pkg/http/httperrors/customerrors/unauthorized_error.go similarity index 100% rename from internal/pkg/http/http_errors/custom_errors/unauthorized_error.go rename to internal/pkg/http/httperrors/customerrors/unauthorized_error.go diff --git a/internal/pkg/http/http_errors/custom_errors/unmarshaling_error.go b/internal/pkg/http/httperrors/customerrors/unmarshaling_error.go similarity index 100% rename from internal/pkg/http/http_errors/custom_errors/unmarshaling_error.go rename to internal/pkg/http/httperrors/customerrors/unmarshaling_error.go diff --git a/internal/pkg/http/http_errors/custom_errors/validation_error.go b/internal/pkg/http/httperrors/customerrors/validation_error.go similarity index 100% rename from internal/pkg/http/http_errors/custom_errors/validation_error.go rename to internal/pkg/http/httperrors/customerrors/validation_error.go diff --git a/internal/pkg/http/http_errors/problemDetails/custom_problem_details_errors.go b/internal/pkg/http/httperrors/problemdetails/custom_problem_details_errors.go similarity index 100% rename from internal/pkg/http/http_errors/problemDetails/custom_problem_details_errors.go rename to internal/pkg/http/httperrors/problemdetails/custom_problem_details_errors.go diff --git a/internal/pkg/http/http_errors/problemDetails/option_builder.go b/internal/pkg/http/httperrors/problemdetails/option_builder.go similarity index 100% rename from internal/pkg/http/http_errors/problemDetails/option_builder.go rename to internal/pkg/http/httperrors/problemdetails/option_builder.go diff --git a/internal/pkg/http/http_errors/problemDetails/problem_detail_parser.go b/internal/pkg/http/httperrors/problemdetails/problem_detail_parser.go similarity index 97% rename from internal/pkg/http/http_errors/problemDetails/problem_detail_parser.go rename to internal/pkg/http/httperrors/problemdetails/problem_detail_parser.go index 1f6ce148..f4b86b61 100644 --- a/internal/pkg/http/http_errors/problemDetails/problem_detail_parser.go +++ b/internal/pkg/http/httperrors/problemdetails/problem_detail_parser.go @@ -7,9 +7,9 @@ import ( "reflect" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/constants" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" typeMapper "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/reflection/typemapper" - errorUtils "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils/error_utils" + errorUtils "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils/errorutils" "emperror.dev/errors" "github.com/go-playground/validator" diff --git a/internal/pkg/http/http_errors/problemDetails/problem_details.go b/internal/pkg/http/httperrors/problemdetails/problem_details.go similarity index 99% rename from internal/pkg/http/http_errors/problemDetails/problem_details.go rename to internal/pkg/http/httperrors/problemdetails/problem_details.go index b67c499d..f2c7f66b 100644 --- a/internal/pkg/http/http_errors/problemDetails/problem_details.go +++ b/internal/pkg/http/httperrors/problemdetails/problem_details.go @@ -7,7 +7,7 @@ import ( "reflect" "time" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/contracts" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/contracts" defaultLogger "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger/defaultlogger" typeMapper "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/reflection/typemapper" diff --git a/internal/pkg/http/http_errors/problemDetails/problem_details_test.go b/internal/pkg/http/httperrors/problemdetails/problem_details_test.go similarity index 98% rename from internal/pkg/http/http_errors/problemDetails/problem_details_test.go rename to internal/pkg/http/httperrors/problemdetails/problem_details_test.go index 0f618e7a..25a05d11 100644 --- a/internal/pkg/http/http_errors/problemDetails/problem_details_test.go +++ b/internal/pkg/http/httperrors/problemdetails/problem_details_test.go @@ -4,7 +4,7 @@ import ( "net/http" "testing" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "emperror.dev/errors" "github.com/stretchr/testify/assert" diff --git a/internal/pkg/mongodb/repository/mongo_generic_repository.go b/internal/pkg/mongodb/repository/mongo_generic_repository.go index 2142dc4d..13f7464d 100644 --- a/internal/pkg/mongodb/repository/mongo_generic_repository.go +++ b/internal/pkg/mongodb/repository/mongo_generic_repository.go @@ -6,7 +6,7 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/data" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/data/specification" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mongodb" reflectionHelper "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/reflection/reflectionhelper" diff --git a/internal/pkg/mongodb/repository/mongo_generic_repository_test.go b/internal/pkg/mongodb/repository/mongo_generic_repository_test.go index 1ded1163..96b75adf 100644 --- a/internal/pkg/mongodb/repository/mongo_generic_repository_test.go +++ b/internal/pkg/mongodb/repository/mongo_generic_repository_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/data" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" defaultLogger "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger/defaultlogger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mongodb" diff --git a/internal/pkg/otel/metrics/metrics.go b/internal/pkg/otel/metrics/metrics.go index a2344bb4..06b9dded 100644 --- a/internal/pkg/otel/metrics/metrics.go +++ b/internal/pkg/otel/metrics/metrics.go @@ -9,7 +9,7 @@ import ( "time" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/config/environment" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/contracts" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/contracts" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "emperror.dev/errors" diff --git a/internal/pkg/otel/metrics/metrics_fx.go b/internal/pkg/otel/metrics/metrics_fx.go index 903059ca..0a07fc69 100644 --- a/internal/pkg/otel/metrics/metrics_fx.go +++ b/internal/pkg/otel/metrics/metrics_fx.go @@ -3,7 +3,7 @@ package metrics import ( "context" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/contracts" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/contracts" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "go.opentelemetry.io/contrib/instrumentation/host" diff --git a/internal/pkg/otel/metrics/metrics_test.go b/internal/pkg/otel/metrics/metrics_test.go index c4b7e21f..89aea69f 100644 --- a/internal/pkg/otel/metrics/metrics_test.go +++ b/internal/pkg/otel/metrics/metrics_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/config" - customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo" + customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger/external/fxlog" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger/zap" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/metrics" diff --git a/internal/pkg/otel/tracing/utils/utils.go b/internal/pkg/otel/tracing/utils/utils.go index ff03dfb9..4d64caa7 100644 --- a/internal/pkg/otel/tracing/utils/utils.go +++ b/internal/pkg/otel/tracing/utils/utils.go @@ -6,11 +6,10 @@ import ( "reflect" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/metadata" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/grpc/grpcErrors" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/problemDetails" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/grpc/grpcerrors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/constants/telemetrytags" - errorUtils "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils/error_utils" + errorUtils "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils/errorutils" "github.com/ahmetb/go-linq/v3" "go.opentelemetry.io/otel/attribute" @@ -198,7 +197,7 @@ func GrpcTraceErrFromSpan(span trace.Span, err error) error { ) if customErrors.IsCustomError(err) { - grpcErr := grpcErrors.ParseError(err) + grpcErr := grpcerrors.ParseError(err) span.SetAttributes( semconv.RPCGRPCStatusCodeKey.Int(int(grpcErr.GetStatus())), ) diff --git a/internal/pkg/postgresgorm/db.go b/internal/pkg/postgresgorm/db.go index 6e4afe5e..24638ef0 100644 --- a/internal/pkg/postgresgorm/db.go +++ b/internal/pkg/postgresgorm/db.go @@ -19,17 +19,24 @@ func NewGorm(cfg *GormOptions) (*gorm.DB, error) { return nil, errors.New("DBName is required in the config.") } - err := createDB(cfg) - if err != nil { - return nil, err + if cfg.UseSQLLite { + db, err := createSQLLiteDB(cfg.Dns()) + + return db, err } + // InMemory doesn't work correctly with transactions - seems when we `Begin` a transaction on gorm.DB (with SQLLite in-memory) our previous gormDB before transaction will remove and the new gormDB with tx will go on the memory if cfg.UseInMemory { db, err := createInMemoryDB() return db, err } + err := createPostgresDB(cfg) + if err != nil { + return nil, err + } + dataSourceName := fmt.Sprintf( "host=%s port=%d user=%s dbname=%s password=%s", cfg.Host, @@ -70,9 +77,22 @@ func createInMemoryDB() (*gorm.DB, error) { return db, err } +func createSQLLiteDB(dbFilePath string) (*gorm.DB, error) { + // https://gorm.io/docs/connecting_to_the_database.html#SQLite + // https://github.com/glebarez/sqlite + // https://www.connectionstrings.com/sqlite/ + gormSQLLiteDB, err := gorm.Open( + sqlite.Open(dbFilePath), + &gorm.Config{ + Logger: gromlog.NewGormCustomLogger(defaultlogger.GetLogger()), + }) + + return gormSQLLiteDB, err +} + func NewSQLDB(orm *gorm.DB) (*sql.DB, error) { return orm.DB() } -func createDB(cfg *GormOptions) error { +func createPostgresDB(cfg *GormOptions) error { var db *sql.DB // we should choose a default database in the connection, but because we don't have a database yet we specify postgres default database 'postgres' diff --git a/internal/pkg/postgresgorm/gorm_options.go b/internal/pkg/postgresgorm/gorm_options.go index e7e33907..00d8c8be 100644 --- a/internal/pkg/postgresgorm/gorm_options.go +++ b/internal/pkg/postgresgorm/gorm_options.go @@ -2,6 +2,7 @@ package postgresgorm import ( "fmt" + "path/filepath" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/config" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/config/environment" @@ -14,6 +15,7 @@ var optionName = strcase.ToLowerCamel(typeMapper.GetTypeNameByT[GormOptions]()) type GormOptions struct { UseInMemory bool `mapstructure:"useInMemory"` + UseSQLLite bool `mapstructure:"useSqlLite"` Host string `mapstructure:"host"` Port int `mapstructure:"port"` User string `mapstructure:"user"` @@ -24,6 +26,17 @@ type GormOptions struct { } func (h *GormOptions) Dns() string { + if h.UseInMemory { + return "" + } + + if h.UseSQLLite { + projectRootDir := environment.GetProjectRootWorkingDirectory() + dbFilePath := filepath.Join(projectRootDir, fmt.Sprintf("%s.db", h.DBName)) + + return dbFilePath + } + datasource := fmt.Sprintf("postgres://%s:%s@%s:%d/%s?sslmode=disable", h.User, h.Password, diff --git a/internal/pkg/postgresgorm/helpers.go b/internal/pkg/postgresgorm/helpers.go deleted file mode 100644 index bd4e0d90..00000000 --- a/internal/pkg/postgresgorm/helpers.go +++ /dev/null @@ -1,70 +0,0 @@ -package postgresgorm - -import ( - "context" - "fmt" - "strings" - - typeMapper "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/reflection/typemapper" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" - - "emperror.dev/errors" - "gorm.io/gorm" -) - -// Ref: https://dev.to/rafaelgfirmino/pagination-using-gorm-scopes-3k5f - -func Paginate[TDataModel any, TEntity any]( - ctx context.Context, - listQuery *utils.ListQuery, - db *gorm.DB, -) (*utils.ListResult[TEntity], error) { - var ( - items []TEntity - totalRows int64 - ) - - dataModel := typeMapper.GenericInstanceByT[TDataModel]() - // https://gorm.io/docs/advanced_query.html - db.WithContext(ctx).Model(dataModel).Count(&totalRows) - - // generate where query - query := db.WithContext(ctx). - Model(dataModel). - Offset(listQuery.GetOffset()). - Limit(listQuery.GetLimit()). - Order(listQuery.GetOrderBy()) - - if listQuery.Filters != nil { - for _, filter := range listQuery.Filters { - column := filter.Field - action := filter.Comparison - value := filter.Value - - switch action { - case "equals": - whereQuery := fmt.Sprintf("%s = ?", column) - query = query.Where(whereQuery, value) - case "contains": - whereQuery := fmt.Sprintf("%s LIKE ?", column) - query = query.Where(whereQuery, "%"+value+"%") - case "in": - whereQuery := fmt.Sprintf("%s IN (?)", column) - queryArray := strings.Split(value, ",") - query = query.Where(whereQuery, queryArray) - } - } - } - - // https://gorm.io/docs/advanced_query.html#Smart-Select-Fields - if err := query.Find(&items).Error; err != nil { - return nil, errors.WrapIf(err, "error in finding products.") - } - - return utils.NewListResult[TEntity]( - items, - listQuery.GetSize(), - listQuery.GetPage(), - totalRows, - ), nil -} diff --git a/internal/pkg/postgresgorm/helpers/helpers.go b/internal/pkg/postgresgorm/helpers/helpers.go index 55afcf00..888877d8 100644 --- a/internal/pkg/postgresgorm/helpers/helpers.go +++ b/internal/pkg/postgresgorm/helpers/helpers.go @@ -5,6 +5,8 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm/constants" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm/contracts" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm/scopes" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" "emperror.dev/errors" "gorm.io/gorm" @@ -39,8 +41,34 @@ func GetTxFromContextIfExists(ctx context.Context) *gorm.DB { } func SetTxToContext(ctx context.Context, tx *gorm.DB) *contracts.GormContext { - ctx = context.WithValue(ctx, constants.TxKey, tx) - gormContext := &contracts.GormContext{Tx: tx, Context: ctx} + newCtx := context.WithValue(ctx, constants.TxKey, tx) + gormContext := &contracts.GormContext{Tx: tx, Context: newCtx} + ctx = gormContext return gormContext } + +// Ref: https://dev.to/rafaelgfirmino/pagination-using-gorm-scopes-3k5f + +func Paginate[TDataModel any, TEntity any]( + ctx context.Context, + listQuery *utils.ListQuery, + db *gorm.DB, +) (*utils.ListResult[TEntity], error) { + var ( + items []TEntity + totalRows int64 + ) + + // https://gorm.io/docs/advanced_query.html#Smart-Select-Fields + if err := db.Scopes(scopes.FilterPaginate[TDataModel](ctx, listQuery)).Find(&items).Error; err != nil { + return nil, errors.WrapIf(err, "error in finding products.") + } + + return utils.NewListResult[TEntity]( + items, + listQuery.GetSize(), + listQuery.GetPage(), + totalRows, + ), nil +} diff --git a/internal/pkg/postgresgorm/repository/gorm_generic_repository.go b/internal/pkg/postgresgorm/repository/gorm_generic_repository.go index 39bcf499..2f5c8b77 100644 --- a/internal/pkg/postgresgorm/repository/gorm_generic_repository.go +++ b/internal/pkg/postgresgorm/repository/gorm_generic_repository.go @@ -8,9 +8,9 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/data" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/data/specification" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" - gormPostgres "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm" + gormPostgres "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm/helpers" reflectionHelper "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/reflection/reflectionhelper" typeMapper "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/reflection/typemapper" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" diff --git a/internal/pkg/postgresgorm/repository/gorm_generic_repository_test.go b/internal/pkg/postgresgorm/repository/gorm_generic_repository_test.go index a723aa6e..aa89b6a3 100644 --- a/internal/pkg/postgresgorm/repository/gorm_generic_repository_test.go +++ b/internal/pkg/postgresgorm/repository/gorm_generic_repository_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/data" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" defaultLogger "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger/defaultlogger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm" diff --git a/internal/pkg/postgresgorm/scopes/scopes.go b/internal/pkg/postgresgorm/scopes/scopes.go new file mode 100644 index 00000000..0f7620f0 --- /dev/null +++ b/internal/pkg/postgresgorm/scopes/scopes.go @@ -0,0 +1,88 @@ +package scopes + +import ( + "context" + "fmt" + "strings" + + typeMapper "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/reflection/typemapper" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" + + uuid "github.com/satori/go.uuid" + "gorm.io/gorm" +) + +// https://gorm.io/docs/advanced_query.html#Scopes +// https://gorm.io/docs/scopes.html + +// After scopes, we should have a runner function like Find, Update, Delete + +func AmountGreaterThan1000(db *gorm.DB) *gorm.DB { + return db.Where("amount > ?", 1000) +} + +// FilterAllItemsWithSoftDeleted returns soft-deleted and none soft-deleted items +func FilterAllItemsWithSoftDeleted(db *gorm.DB) *gorm.DB { + // https://gorm.io/docs/delete.html#Find-soft-deleted-records + return db.Unscoped() +} + +// SoftDeleted returns only soft-deleted items +func SoftDeleted(db *gorm.DB) *gorm.DB { + return db.Unscoped().Where("deleted_at IS NOT NULL") +} + +func FilterByTitle(title string) func(db *gorm.DB) *gorm.DB { + return func(db *gorm.DB) *gorm.DB { + return db.Where("title = ?", title) + } +} + +func FilterByID(id uuid.UUID) func(db *gorm.DB) *gorm.DB { + return func(db *gorm.DB) *gorm.DB { + return db.Where("id = ?", id) + } +} + +func FilterPaginate[TDataModel any]( + ctx context.Context, + listQuery *utils.ListQuery, +) func(db *gorm.DB) *gorm.DB { + return func(db *gorm.DB) *gorm.DB { + var totalRows int64 + + dataModel := typeMapper.GenericInstanceByT[TDataModel]() + // https://gorm.io/docs/advanced_query.html + db.WithContext(ctx).Model(dataModel).Count(&totalRows) + + // generate where query + query := db.WithContext(ctx). + Model(dataModel). + Offset(listQuery.GetOffset()). + Limit(listQuery.GetLimit()). + Order(listQuery.GetOrderBy()) + + if listQuery.Filters != nil { + for _, filter := range listQuery.Filters { + column := filter.Field + action := filter.Comparison + value := filter.Value + + switch action { + case "equals": + whereQuery := fmt.Sprintf("%s = ?", column) + query = query.Where(whereQuery, value) + case "contains": + whereQuery := fmt.Sprintf("%s LIKE ?", column) + query = query.Where(whereQuery, "%"+value+"%") + case "in": + whereQuery := fmt.Sprintf("%s IN (?)", column) + queryArray := strings.Split(value, ",") + query = query.Where(whereQuery, queryArray) + } + } + } + + return query + } +} diff --git a/internal/pkg/postgresmessaging/messagepersistence/message_persistence_dbcontext.go b/internal/pkg/postgresmessaging/messagepersistence/message_persistence_dbcontext.go index 3e4d0264..16de7c6e 100644 --- a/internal/pkg/postgresmessaging/messagepersistence/message_persistence_dbcontext.go +++ b/internal/pkg/postgresmessaging/messagepersistence/message_persistence_dbcontext.go @@ -22,6 +22,18 @@ func NewPostgresMessagePersistenceDBContext( return c } +// WithTx creates a transactional DBContext with getting tx-gorm from the ctx. This will throw an error if the transaction does not exist. +func (c *PostgresMessagePersistenceDBContext) WithTx( + ctx context.Context, +) (*PostgresMessagePersistenceDBContext, error) { + tx, err := helpers.GetTxFromContext(ctx) + if err != nil { + return nil, err + } + + return NewPostgresMessagePersistenceDBContext(tx), nil +} + // WithTxIfExists creates a transactional DBContext with getting tx-gorm from the ctx. not throw an error if the transaction is not existing and returns an existing database. func (c *PostgresMessagePersistenceDBContext) WithTxIfExists( ctx context.Context, diff --git a/internal/pkg/postgresmessaging/messagepersistence/message_persistence_repository.go b/internal/pkg/postgresmessaging/messagepersistence/postgres_message_service.go similarity index 66% rename from internal/pkg/postgresmessaging/messagepersistence/message_persistence_repository.go rename to internal/pkg/postgresmessaging/messagepersistence/postgres_message_service.go index 3735511a..ff38f9f5 100644 --- a/internal/pkg/postgresmessaging/messagepersistence/message_persistence_repository.go +++ b/internal/pkg/postgresmessaging/messagepersistence/postgres_message_service.go @@ -2,31 +2,101 @@ package messagepersistence import ( "context" + "errors" "fmt" + "reflect" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/persistmessage" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/types" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer/contratcs" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" uuid "github.com/satori/go.uuid" ) -type postgresMessagePersistenceRepository struct { +type postgresMessageService struct { messagingDBContext *PostgresMessagePersistenceDBContext + messageSerializer contratcs.MessageSerializer logger logger.Logger } -func NewMessagePersistenceRepository( +func (m *postgresMessageService) Process(messageID string, ctx context.Context) error { + // TODO implement me + panic("implement me") +} + +func (m *postgresMessageService) ProcessAll(ctx context.Context) error { + // TODO implement me + panic("implement me") +} + +func (m *postgresMessageService) AddPublishMessage( + messageEnvelope types.MessageEnvelopeTMessage, + ctx context.Context, +) error { + // TODO implement me + panic("implement me") +} + +func (m *postgresMessageService) AddReceivedMessage(messageEnvelope types.MessageEnvelope, ctx context.Context) error { + // TODO implement me + panic("implement me") +} + +func AddMessageCore( + ctx context.Context, + messageEnvelope types.MessageEnvelope, + deliveryType persistmessage.MessageDeliveryType, +) error { + if messageEnvelope.Message == nil { + return errors.New("messageEnvelope.Message is nil") + } + + var id string + switch message := messageEnvelope.Message.(type) { + case types.IMessage: + id = message.GeMessageId() + // case IInternalCommand: + // id = message.InternalCommandId + default: + id = uuid.NewV4().String() + } + + storeMessage := persistmessage.NewStoreMessage() + + persistmessage.StoreMessage{ + ID: id, + TypeName: reflect.TypeOf(messageEnvelope.Message).Name(), + Serialized: _messageSerializer.Serialize(messageEnvelope), + DeliveryType: deliveryType, + } + + err := _messagePersistenceRepository.AddAsync(storeMessage, cancellationToken) + if err != nil { + return err + } + + _logger.LogInformation( + "Message with id: %v and delivery type: %v saved in persistence message store", + id, + deliveryType, + ) + + return nil +} + +func NewPostgresMessageService( postgresMessagePersistenceDBContext *PostgresMessagePersistenceDBContext, l logger.Logger, -) persistmessage.MessagePersistenceRepository { - return &postgresMessagePersistenceRepository{ +) persistmessage.MessageService { + return &postgresMessageService{ messagingDBContext: postgresMessagePersistenceDBContext, logger: l, } } -func (m *postgresMessagePersistenceRepository) Add( +func (m *postgresMessageService) Add( ctx context.Context, storeMessage *persistmessage.StoreMessage, ) error { @@ -46,7 +116,7 @@ func (m *postgresMessagePersistenceRepository) Add( return nil } -func (m *postgresMessagePersistenceRepository) Update( +func (m *postgresMessageService) Update( ctx context.Context, storeMessage *persistmessage.StoreMessage, ) error { @@ -66,7 +136,7 @@ func (m *postgresMessagePersistenceRepository) Update( return nil } -func (m *postgresMessagePersistenceRepository) ChangeState( +func (m *postgresMessageService) ChangeState( ctx context.Context, messageID uuid.UUID, status persistmessage.MessageStatus, @@ -88,7 +158,7 @@ func (m *postgresMessagePersistenceRepository) ChangeState( return err } -func (m *postgresMessagePersistenceRepository) GetAllActive( +func (m *postgresMessageService) GetAllActive( ctx context.Context, ) ([]*persistmessage.StoreMessage, error) { var storeMessages []*persistmessage.StoreMessage @@ -106,7 +176,7 @@ func (m *postgresMessagePersistenceRepository) GetAllActive( return storeMessages, nil } -func (m *postgresMessagePersistenceRepository) GetByFilter( +func (m *postgresMessageService) GetByFilter( ctx context.Context, predicate func(*persistmessage.StoreMessage) bool, ) ([]*persistmessage.StoreMessage, error) { @@ -122,7 +192,7 @@ func (m *postgresMessagePersistenceRepository) GetByFilter( return storeMessages, nil } -func (m *postgresMessagePersistenceRepository) GetById( +func (m *postgresMessageService) GetById( ctx context.Context, id uuid.UUID, ) (*persistmessage.StoreMessage, error) { @@ -149,7 +219,7 @@ func (m *postgresMessagePersistenceRepository) GetById( return storeMessage, nil } -func (m *postgresMessagePersistenceRepository) Remove( +func (m *postgresMessageService) Remove( ctx context.Context, storeMessage *persistmessage.StoreMessage, ) (bool, error) { @@ -184,7 +254,7 @@ func (m *postgresMessagePersistenceRepository) Remove( return true, nil } -func (m *postgresMessagePersistenceRepository) CleanupMessages( +func (m *postgresMessageService) CleanupMessages( ctx context.Context, ) error { predicate := func(sm *persistmessage.StoreMessage) bool { diff --git a/internal/pkg/postgresmessaging/messagepersistence/message_persistence_repository_test.go b/internal/pkg/postgresmessaging/messagepersistence/postgres_message_service_test.go similarity index 82% rename from internal/pkg/postgresmessaging/messagepersistence/message_persistence_repository_test.go rename to internal/pkg/postgresmessaging/messagepersistence/postgres_message_service_test.go index 16401686..fd0680ec 100644 --- a/internal/pkg/postgresmessaging/messagepersistence/message_persistence_repository_test.go +++ b/internal/pkg/postgresmessaging/messagepersistence/postgres_message_service_test.go @@ -17,24 +17,24 @@ import ( "gorm.io/gorm" ) -type messagePersistenceRepositoryTest struct { +type postgresMessageServiceTest struct { suite.Suite DB *gorm.DB logger logger.Logger - messagingRepository persistmessage.MessagePersistenceRepository + messagingRepository persistmessage.MessageService dbContext *PostgresMessagePersistenceDBContext storeMessages []*persistmessage.StoreMessage ctx context.Context } -func TestMessagePersistenceRepository(t *testing.T) { +func TestPostgresMessageService(t *testing.T) { suite.Run( t, - &messagePersistenceRepositoryTest{logger: defaultLogger.GetLogger()}, + &postgresMessageServiceTest{logger: defaultLogger.GetLogger()}, ) } -func (c *messagePersistenceRepositoryTest) SetupSuite() { +func (c *postgresMessageServiceTest) SetupSuite() { opts, err := gorm2.NewGormTestContainers(defaultLogger.GetLogger()). PopulateContainerOptions(context.Background(), c.T()) c.Require().NoError(err) @@ -47,13 +47,13 @@ func (c *messagePersistenceRepositoryTest) SetupSuite() { c.Require().NoError(err) c.dbContext = NewPostgresMessagePersistenceDBContext(gormDB) - c.messagingRepository = NewMessagePersistenceRepository( + c.messagingRepository = NewPostgresMessageService( c.dbContext, defaultLogger.GetLogger(), ) } -func (c *messagePersistenceRepositoryTest) SetupTest() { +func (c *postgresMessageServiceTest) SetupTest() { ctx := context.Background() c.ctx = ctx p, err := seedData(context.Background(), c.DB) @@ -61,19 +61,19 @@ func (c *messagePersistenceRepositoryTest) SetupTest() { c.storeMessages = p } -func (c *messagePersistenceRepositoryTest) TearDownTest() { +func (c *postgresMessageServiceTest) TearDownTest() { err := c.cleanupPostgresData() c.Require().NoError(err) } -func (c *messagePersistenceRepositoryTest) BeginTx() { +func (c *postgresMessageServiceTest) BeginTx() { c.logger.Info("starting transaction") tx := c.dbContext.Begin() gormContext := helpers.SetTxToContext(c.ctx, tx) c.ctx = gormContext } -func (c *messagePersistenceRepositoryTest) CommitTx() { +func (c *postgresMessageServiceTest) CommitTx() { tx := helpers.GetTxFromContextIfExists(c.ctx) if tx != nil { c.logger.Info("committing transaction") @@ -81,7 +81,7 @@ func (c *messagePersistenceRepositoryTest) CommitTx() { } } -func (c *messagePersistenceRepositoryTest) Test_Add() { +func (c *postgresMessageServiceTest) Test_Add() { message := &persistmessage.StoreMessage{ ID: uuid.NewV4(), MessageStatus: persistmessage.Processed, @@ -146,7 +146,7 @@ func seedData( return messages, nil } -func (c *messagePersistenceRepositoryTest) cleanupPostgresData() error { +func (c *postgresMessageServiceTest) cleanupPostgresData() error { tables := []string{"store_messages"} // Iterate over the tables and delete all records for _, table := range tables { diff --git a/internal/pkg/postgresmessaging/postgres_messaging_fx.go b/internal/pkg/postgresmessaging/postgres_messaging_fx.go index 16e50948..b62b33fa 100644 --- a/internal/pkg/postgresmessaging/postgres_messaging_fx.go +++ b/internal/pkg/postgresmessaging/postgres_messaging_fx.go @@ -12,7 +12,7 @@ var Module = fx.Module( "postgresmessagingfx", fx.Provide( messagepersistence.NewPostgresMessagePersistenceDBContext, - messagepersistence.NewMessagePersistenceRepository, + messagepersistence.NewPostgresMessageService, ), fx.Invoke(migrateMessaging), ) diff --git a/internal/pkg/rabbitmq/bus/rabbitmq_bus_test.go b/internal/pkg/rabbitmq/bus/rabbitmq_bus_test.go index 5699d3c6..17d83af8 100644 --- a/internal/pkg/rabbitmq/bus/rabbitmq_bus_test.go +++ b/internal/pkg/rabbitmq/bus/rabbitmq_bus_test.go @@ -8,14 +8,16 @@ import ( messageConsumer "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/consumer" pipeline2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/pipeline" types3 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/types" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer/json" - defaultLogger2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger/defaultlogger" + defaultlogger "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger/defaultlogger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/config" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/configurations" consumerConfigurations "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/consumer/configurations" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/consumer/factory" + producerfactory "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/producer" producerConfigurations "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/producer/configurations" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/types" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/test/containers/testcontainer/rabbitmq" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/test/messaging/consumer" testUtils "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/test/utils" @@ -26,30 +28,52 @@ import ( func Test_AddRabbitMQ(t *testing.T) { testUtils.SkipCI(t) + ctx := context.Background() fakeConsumer2 := consumer.NewRabbitMQFakeTestConsumerHandler[*ProducerConsumerMessage]() fakeConsumer3 := consumer.NewRabbitMQFakeTestConsumerHandler[*ProducerConsumerMessage]() - serializer := serializer.NewDefaultEventSerializer( - json.NewDefaultSerializer(), + serializer := json.NewDefaultEventJsonSerializer( + json.NewDefaultJsonSerializer(), ) - rabbitmqOptions := &config.RabbitmqOptions{ - RabbitmqHostOptions: &config.RabbitmqHostOptions{ - UserName: "guest", - Password: "guest", - HostName: "localhost", - Port: 5672, - }, + //rabbitmqOptions := &config.RabbitmqOptions{ + // RabbitmqHostOptions: &config.RabbitmqHostOptions{ + // UserName: "guest", + // Password: "guest", + // HostName: "localhost", + // Port: 5672, + // }, + //} + + rabbitmqHostOption, err := rabbitmq.NewRabbitMQTestContainers(defaultlogger.GetLogger()). + PopulateContainerOptions(ctx, t) + require.NoError(t, err) + + options := &config.RabbitmqOptions{ + RabbitmqHostOptions: rabbitmqHostOption, } - conn, err := types.NewRabbitMQConnection(rabbitmqOptions) + + conn, err := types.NewRabbitMQConnection(options) require.NoError(t, err) - b, err := NewRabbitmqBus( - rabbitmqOptions, + consumerFactory := factory.NewConsumerFactory( + options, + conn, serializer, - defaultLogger2.GetLogger(), + defaultlogger.GetLogger(), + ) + producerFactory := producerfactory.NewProducerFactory( + options, conn, + serializer, + defaultlogger.GetLogger(), + ) + + b, err := NewRabbitmqBus( + defaultlogger.GetLogger(), + consumerFactory, + producerFactory, func(builder configurations.RabbitMQConfigurationBuilder) { builder.AddProducer( ProducerConsumerMessage{}, @@ -90,7 +114,6 @@ func Test_AddRabbitMQ(t *testing.T) { err = b.ConnectConsumerHandler(&ProducerConsumerMessage{}, fakeConsumer3) require.NoError(t, err) - ctx := context.Background() err = b.Start(ctx) require.NoError(t, err) @@ -176,7 +199,7 @@ func (p *Pipeline1) Handle( consumerContext.Message().GeMessageId(), ) - err := next() + err := next(ctx) if err != nil { return err } diff --git a/internal/pkg/rabbitmq/consumer/rabbitmq_consumer.go b/internal/pkg/rabbitmq/consumer/rabbitmq_consumer.go index 6ea9a771..fe37142f 100644 --- a/internal/pkg/rabbitmq/consumer/rabbitmq_consumer.go +++ b/internal/pkg/rabbitmq/consumer/rabbitmq_consumer.go @@ -6,19 +6,19 @@ import ( "reflect" "time" - consumer3 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/consumer" - consumer2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/otel/tracing/consumer" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/consumer" + consumertracing "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/otel/tracing/consumer" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/pipeline" - types2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/types" + messagingTypes "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/types" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/utils" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/metadata" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer/contratcs" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/config" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/consumer/configurations" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/rabbitmqErrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/types" - errorUtils "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils/error_utils" + errorutils "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils/errorutils" "emperror.dev/errors" "github.com/ahmetb/go-linq/v3" @@ -42,16 +42,16 @@ var retryOptions = []retry.Option{ type rabbitMQConsumer struct { rabbitmqConsumerOptions *configurations.RabbitMQConsumerConfiguration connection types.IConnection - handlerDefault consumer3.ConsumerHandler + handlerDefault consumer.ConsumerHandler channel *amqp091.Channel deliveryRoutines chan struct{} // chan should init before using channel - eventSerializer serializer.EventSerializer + messageSerializer contratcs.MessageSerializer logger logger.Logger rabbitmqOptions *config.RabbitmqOptions ErrChan chan error - handlers []consumer3.ConsumerHandler + handlers []consumer.ConsumerHandler pipelines []pipeline.ConsumerPipeline - isConsumedNotifications []func(message types2.IMessage) + isConsumedNotifications []func(message messagingTypes.IMessage) } // NewRabbitMQConsumer create a new generic RabbitMQ consumer @@ -59,10 +59,10 @@ func NewRabbitMQConsumer( rabbitmqOptions *config.RabbitmqOptions, connection types.IConnection, consumerConfiguration *configurations.RabbitMQConsumerConfiguration, - eventSerializer serializer.EventSerializer, + messageSerializer contratcs.MessageSerializer, logger logger.Logger, - isConsumedNotifications ...func(message types2.IMessage), -) (consumer3.Consumer, error) { + isConsumedNotifications ...func(message messagingTypes.IMessage), +) (consumer.Consumer, error) { if consumerConfiguration == nil { return nil, errors.New("consumer configuration is required") } @@ -78,7 +78,7 @@ func NewRabbitMQConsumer( consumerConfiguration.ConcurrencyLimit, ) cons := &rabbitMQConsumer{ - eventSerializer: eventSerializer, + messageSerializer: messageSerializer, rabbitmqOptions: rabbitmqOptions, logger: logger, rabbitmqConsumerOptions: consumerConfiguration, @@ -94,7 +94,7 @@ func NewRabbitMQConsumer( return cons, nil } -func (r *rabbitMQConsumer) IsConsumed(h func(message types2.IMessage)) { +func (r *rabbitMQConsumer) IsConsumed(h func(message messagingTypes.IMessage)) { r.isConsumedNotifications = append(r.isConsumedNotifications, h) } @@ -253,7 +253,7 @@ func (r *rabbitMQConsumer) Stop() error { } } -func (r *rabbitMQConsumer) ConnectHandler(handler consumer3.ConsumerHandler) { +func (r *rabbitMQConsumer) ConnectHandler(handler consumer.ConsumerHandler) { r.handlers = append(r.handlers, handler) } @@ -263,7 +263,7 @@ func (r *rabbitMQConsumer) GetName() string { func (r *rabbitMQConsumer) reConsumeOnDropConnection(ctx context.Context) { go func() { - defer errorUtils.HandlePanic() + defer errorutils.HandlePanic() for { select { case reconnect := <-r.connection.ReconnectedChannel(): @@ -301,7 +301,7 @@ func (r *rabbitMQConsumer) handleReceived( meta = metadata.MapToMetadata(delivery.Headers) } - consumerTraceOption := &consumer2.ConsumerTracingOptions{ + consumerTraceOption := &consumertracing.ConsumerTracingOptions{ MessagingSystem: "rabbitmq", DestinationKind: "queue", Destination: r.rabbitmqConsumerOptions.QueueOptions.Name, @@ -309,7 +309,7 @@ func (r *rabbitMQConsumer) handleReceived( semconv.MessagingRabbitmqDestinationRoutingKey(delivery.RoutingKey), }, } - ctx, beforeConsumeSpan := consumer2.StartConsumerSpan( + ctx, beforeConsumeSpan := consumertracing.StartConsumerSpan( ctx, &meta, string(delivery.Body), @@ -319,7 +319,7 @@ func (r *rabbitMQConsumer) handleReceived( consumeContext, err := r.createConsumeContext(delivery) if err != nil { r.logger.Error( - consumer2.FinishConsumerSpan(beforeConsumeSpan, err), + consumertracing.FinishConsumerSpan(beforeConsumeSpan, err), ) return } @@ -333,11 +333,11 @@ func (r *rabbitMQConsumer) handleReceived( if err := delivery.Ack(false); err != nil { r.logger.Error( "error sending ACK to RabbitMQ consumer: %v", - consumer2.FinishConsumerSpan(beforeConsumeSpan, err), + consumertracing.FinishConsumerSpan(beforeConsumeSpan, err), ) return } - _ = consumer2.FinishConsumerSpan(beforeConsumeSpan, nil) + _ = consumertracing.FinishConsumerSpan(beforeConsumeSpan, nil) if len(r.isConsumedNotifications) > 0 { for _, notification := range r.isConsumedNotifications { if notification != nil { @@ -351,11 +351,11 @@ func (r *rabbitMQConsumer) handleReceived( if err := delivery.Nack(false, true); err != nil { r.logger.Error( "error in sending Nack to RabbitMQ consumer: %v", - consumer2.FinishConsumerSpan(beforeConsumeSpan, err), + consumertracing.FinishConsumerSpan(beforeConsumeSpan, err), ) return } - _ = consumer2.FinishConsumerSpan(beforeConsumeSpan, nil) + _ = consumertracing.FinishConsumerSpan(beforeConsumeSpan, nil) } } @@ -366,7 +366,7 @@ func (r *rabbitMQConsumer) handle( ctx context.Context, ack func(), nack func(), - messageConsumeContext types2.MessageConsumeContext, + messageConsumeContext messagingTypes.MessageConsumeContext, ) { var err error for _, handler := range r.handlers { @@ -390,8 +390,8 @@ func (r *rabbitMQConsumer) handle( func (r *rabbitMQConsumer) runHandlersWithRetry( ctx context.Context, - handler consumer3.ConsumerHandler, - messageConsumeContext types2.MessageConsumeContext, + handler consumer.ConsumerHandler, + messageConsumeContext messagingTypes.MessageConsumeContext, ) error { err := retry.Do(func() error { var lastHandler pipeline.ConsumerHandlerFunc @@ -399,7 +399,7 @@ func (r *rabbitMQConsumer) runHandlersWithRetry( if r.pipelines != nil && len(r.pipelines) > 0 { reversPipes := r.reversOrder(r.pipelines) lastHandler = func(ctx context.Context) error { - handler := handler.(consumer3.ConsumerHandler) + handler := handler.(consumer.ConsumerHandler) return handler.Handle(ctx, messageConsumeContext) } @@ -409,7 +409,7 @@ func (r *rabbitMQConsumer) runHandlersWithRetry( nexValue := next var handlerFunc pipeline.ConsumerHandlerFunc = func(ctx context.Context) error { - genericContext, ok := messageConsumeContext.(types2.MessageConsumeContext) + genericContext, ok := messageConsumeContext.(messagingTypes.MessageConsumeContext) if ok { return pipeValue.Handle( ctx, @@ -419,7 +419,7 @@ func (r *rabbitMQConsumer) runHandlersWithRetry( } return pipeValue.Handle( ctx, - messageConsumeContext.(types2.MessageConsumeContext), + messageConsumeContext.(messagingTypes.MessageConsumeContext), nexValue, ) } @@ -436,7 +436,7 @@ func (r *rabbitMQConsumer) runHandlersWithRetry( } return nil } else { - err := handler.Handle(ctx, messageConsumeContext.(types2.MessageConsumeContext)) + err := handler.Handle(ctx, messageConsumeContext.(messagingTypes.MessageConsumeContext)) if err != nil { return err } @@ -449,34 +449,20 @@ func (r *rabbitMQConsumer) runHandlersWithRetry( func (r *rabbitMQConsumer) createConsumeContext( delivery amqp091.Delivery, -) (types2.MessageConsumeContext, error) { +) (messagingTypes.MessageConsumeContext, error) { message := r.deserializeData( delivery.ContentType, delivery.Type, delivery.Body, ) - if reflect.ValueOf(message).IsZero() || reflect.ValueOf(message).IsNil() { - return *new(types2.MessageConsumeContext), errors.New( - "error in deserialization of payload", - ) - } - m, ok := message.(types2.IMessage) - if !ok || m.IsMessage() == false { - return nil, errors.New( - fmt.Sprintf( - "message %s is not a message type or message property is nil", - utils.GetMessageBaseReflectType(message), - ), - ) - } var meta metadata.Metadata if delivery.Headers != nil { meta = metadata.MapToMetadata(delivery.Headers) } - consumeContext := types2.NewMessageConsumeContext( - message.(types2.IMessage), + consumeContext := messagingTypes.NewMessageConsumeContext( + message, meta, delivery.ContentType, delivery.Type, @@ -492,7 +478,7 @@ func (r *rabbitMQConsumer) deserializeData( contentType string, eventType string, body []byte, -) interface{} { +) messagingTypes.IMessage { if contentType == "" { contentType = "application/json" } @@ -504,8 +490,8 @@ func (r *rabbitMQConsumer) deserializeData( if contentType == "application/json" { // r.rabbitmqConsumerOptions.ConsumerMessageType --> actual type - // deserialize, err := r.eventSerializer.DeserializeType(body, r.rabbitmqConsumerOptions.ConsumerMessageType, contentType) - deserialize, err := r.eventSerializer.DeserializeMessage( + // deserialize, err := r.messageSerializer.DeserializeType(body, r.rabbitmqConsumerOptions.ConsumerMessageType, contentType) + deserialize, err := r.messageSerializer.Deserialize( body, eventType, contentType, diff --git a/internal/pkg/rabbitmq/consumer/rabbitmq_consumer_test.go b/internal/pkg/rabbitmq/consumer/rabbitmq_consumer_test.go index cab253b7..c04b068f 100644 --- a/internal/pkg/rabbitmq/consumer/rabbitmq_consumer_test.go +++ b/internal/pkg/rabbitmq/consumer/rabbitmq_consumer_test.go @@ -9,7 +9,6 @@ import ( messageConsumer "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/consumer" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/pipeline" types3 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/types" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer/json" defaultLogger2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger/defaultlogger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/bus" @@ -52,8 +51,8 @@ func Test_Consumer_With_Fake_Message(t *testing.T) { conn, err := types.NewRabbitMQConnection(options) require.NoError(t, err) - eventSerializer := serializer.NewDefaultEventSerializer( - json.NewDefaultSerializer(), + eventSerializer := json.NewDefaultEventJsonSerializer( + json.NewDefaultJsonSerializer(), ) consumerFactory := factory.NewConsumerFactory( options, diff --git a/internal/pkg/rabbitmq/producer/rabbitmq_producer.go b/internal/pkg/rabbitmq/producer/rabbitmq_producer.go index 380c320a..530fb436 100644 --- a/internal/pkg/rabbitmq/producer/rabbitmq_producer.go +++ b/internal/pkg/rabbitmq/producer/rabbitmq_producer.go @@ -2,7 +2,6 @@ package producer import ( "context" - "fmt" "time" messageHeader "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/messageheader" @@ -11,12 +10,11 @@ import ( types2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/types" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/utils" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/metadata" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer/contratcs" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/config" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/producer/configurations" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/types" - typeMapper "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/reflection/typemapper" "emperror.dev/errors" "github.com/rabbitmq/amqp091-go" @@ -29,7 +27,7 @@ type rabbitMQProducer struct { logger logger.Logger rabbitmqOptions *config.RabbitmqOptions connection types.IConnection - eventSerializer serializer.EventSerializer + messageSerializer contratcs.MessageSerializer producersConfigurations map[string]*configurations.RabbitMQProducerConfiguration isProducedNotifications []func(message types2.IMessage) } @@ -39,14 +37,14 @@ func NewRabbitMQProducer( connection types.IConnection, rabbitmqProducersConfiguration map[string]*configurations.RabbitMQProducerConfiguration, logger logger.Logger, - eventSerializer serializer.EventSerializer, + eventSerializer contratcs.MessageSerializer, isProducedNotifications ...func(message types2.IMessage), ) (producer.Producer, error) { p := &rabbitMQProducer{ logger: logger, rabbitmqOptions: cfg, connection: connection, - eventSerializer: eventSerializer, + messageSerializer: eventSerializer, producersConfigurations: rabbitmqProducersConfiguration, } @@ -80,15 +78,6 @@ func (r *rabbitMQProducer) PublishMessageWithTopicName( meta metadata.Metadata, topicOrExchangeName string, ) error { - if message.IsMessage() == false { - return errors.New( - fmt.Sprintf( - "message %s is not a message type or message property is nil", - utils.GetMessageBaseReflectType(message), - ), - ) - } - producerConfiguration := r.getProducerConfigurationByMessage(message) if producerConfiguration == nil { @@ -125,7 +114,7 @@ func (r *rabbitMQProducer) PublishMessageWithTopicName( }, } - serializedObj, err := r.eventSerializer.Serialize(message) + serializedObj, err := r.messageSerializer.Serialize(message) if err != nil { return err } @@ -177,7 +166,7 @@ func (r *rabbitMQProducer) PublishMessageWithTopicName( MessageId: message.GeMessageId(), Timestamp: time.Now(), Headers: metadata.MetadataToMap(meta), - Type: message.GetEventTypeName(), // typeMapper.GetTypeName(message) - just message type name not full type name because in other side package name for type could be different + Type: message.GetMessageTypeName(), // typeMapper.GetTypeName(message) - just message type name not full type name because in other side package name for type could be different ContentType: serializedObj.ContentType, Body: serializedObj.Data, DeliveryMode: producerConfiguration.DeliveryMode, @@ -224,13 +213,9 @@ func (r *rabbitMQProducer) getMetadata( ) metadata.Metadata { meta = metadata.FromMetadata(meta) - if message.GetEventTypeName() == "" { - message.SetEventTypeName( - typeMapper.GetTypeName(message), - ) // just message type name not full type name because in other side package name for type could be different) - } - messageHeader.SetMessageType(meta, message.GetEventTypeName()) - messageHeader.SetMessageContentType(meta, r.eventSerializer.ContentType()) + // just message type name not full type name because in other side package name for type could be different + messageHeader.SetMessageType(meta, message.GetMessageTypeName()) + messageHeader.SetMessageContentType(meta, r.messageSerializer.ContentType()) if messageHeader.GetMessageId(meta) == "" { messageHeader.SetMessageId(meta, message.GeMessageId()) diff --git a/internal/pkg/rabbitmq/producer/rabbitmq_producer_test.go b/internal/pkg/rabbitmq/producer/rabbitmq_producer_test.go index 8920bd34..ea3b367f 100644 --- a/internal/pkg/rabbitmq/producer/rabbitmq_producer_test.go +++ b/internal/pkg/rabbitmq/producer/rabbitmq_producer_test.go @@ -6,12 +6,12 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/config/environment" types2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/types" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/serializer/json" defaultLogger "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger/defaultlogger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/config" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/types" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/test/containers/testcontainer/rabbitmq" testUtils "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/test/utils" uuid "github.com/satori/go.uuid" @@ -21,8 +21,8 @@ import ( func Test_Publish_Message(t *testing.T) { testUtils.SkipCI(t) - eventSerializer := serializer.NewDefaultEventSerializer( - json.NewDefaultSerializer(), + eventSerializer := json.NewDefaultEventJsonSerializer( + json.NewDefaultJsonSerializer(), ) ctx := context.Background() @@ -42,23 +42,21 @@ func Test_Publish_Message(t *testing.T) { } defer tp.Shutdown(ctx) - //conn, err := types.NewRabbitMQConnection(&config.RabbitmqOptions{ + //options := &config.RabbitmqOptions{ // RabbitmqHostOptions: &config.RabbitmqHostOptions{ // UserName: "guest", // Password: "guest", // HostName: "localhost", // Port: 5672, // }, - //}) - //require.NoError(t, err) + //} + + rabbitmqHostOption, err := rabbitmq.NewRabbitMQTestContainers(defaultLogger.GetLogger()). + PopulateContainerOptions(ctx, t) + require.NoError(t, err) options := &config.RabbitmqOptions{ - RabbitmqHostOptions: &config.RabbitmqHostOptions{ - UserName: "guest", - Password: "guest", - HostName: "localhost", - Port: 5672, - }, + RabbitmqHostOptions: rabbitmqHostOption, } conn, err := types.NewRabbitMQConnection(options) diff --git a/internal/pkg/rabbitmq/rabbitmq_fx.go b/internal/pkg/rabbitmq/rabbitmq_fx.go index 81ffc4ff..ae594718 100644 --- a/internal/pkg/rabbitmq/rabbitmq_fx.go +++ b/internal/pkg/rabbitmq/rabbitmq_fx.go @@ -33,9 +33,8 @@ var ( // - order is not important in provide // - provide can have parameter and will resolve if registered // - execute its func only if it requested - rabbitmqProviders = fx.Options(fx.Provide( //nolint:gochecknoglobals - config.ProvideConfig, - ), + rabbitmqProviders = fx.Options( + fx.Provide(config.ProvideConfig), fx.Provide(types.NewRabbitMQConnection), fx.Provide(fx.Annotate( bus.NewRabbitmqBus, diff --git a/internal/pkg/rabbitmq/types/connection.go b/internal/pkg/rabbitmq/types/connection.go index f7e3a645..0c0194ac 100644 --- a/internal/pkg/rabbitmq/types/connection.go +++ b/internal/pkg/rabbitmq/types/connection.go @@ -5,7 +5,7 @@ import ( defaultLogger "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger/defaultlogger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/config" - errorUtils "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils/error_utils" + errorUtils "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils/errorutils" "emperror.dev/errors" "github.com/rabbitmq/amqp091-go" diff --git a/internal/pkg/reflection/typemapper/type_mapper.go b/internal/pkg/reflection/typemapper/type_mapper.go index 3e9ee222..e380a262 100644 --- a/internal/pkg/reflection/typemapper/type_mapper.go +++ b/internal/pkg/reflection/typemapper/type_mapper.go @@ -120,6 +120,7 @@ func TypeByNameAndImplementedInterface[TInterface interface{}]( } } } + return nil } @@ -322,7 +323,7 @@ func InstanceByTypeName(name string) interface{} { return getInstanceFromType(typ) } -func InstanceByTypeNameAndImplementedInterface[TInterface interface{}]( +func EmptyInstanceByTypeNameAndImplementedInterface[TInterface interface{}]( name string, ) interface{} { typ := TypeByNameAndImplementedInterface[TInterface](name) @@ -330,6 +331,15 @@ func InstanceByTypeNameAndImplementedInterface[TInterface interface{}]( return getInstanceFromType(typ) } +func EmptyInstanceByTypeAndImplementedInterface[TInterface interface{}]( + typ reflect.Type, +) interface{} { + // we use short type name instead of full type name because this typ in other receiver packages could have different package name + typeName := GetTypeName(typ) + + return EmptyInstanceByTypeNameAndImplementedInterface[TInterface](typeName) +} + // InstancePointerByTypeName return an empty pointer instance of the type by its name // If the type is a pointer type, it will return a pointer instance of the type and // if the type is a struct type, it will return a pointer to the struct diff --git a/internal/pkg/reflection/typemapper/type_mapper_test.go b/internal/pkg/reflection/typemapper/type_mapper_test.go index d204ddeb..6a9d515a 100644 --- a/internal/pkg/reflection/typemapper/type_mapper_test.go +++ b/internal/pkg/reflection/typemapper/type_mapper_test.go @@ -14,7 +14,7 @@ func TestTypes(t *testing.T) { q22 := InstanceByTypeName("*typeMapper.Test").(*Test) q222 := InstancePointerByTypeName("*typeMapper.Test").(*Test) q3 := TypeByNameAndImplementedInterface[ITest]("*typeMapper.Test") - q4 := InstanceByTypeNameAndImplementedInterface[ITest]("*typeMapper.Test") + q4 := EmptyInstanceByTypeNameAndImplementedInterface[ITest]("*typeMapper.Test") c1 := GetTypeFromGeneric[Test]() c2 := GetTypeFromGeneric[*Test]() diff --git a/internal/pkg/utils/error_utils/errors.go b/internal/pkg/utils/errorutils/errors.go similarity index 98% rename from internal/pkg/utils/error_utils/errors.go rename to internal/pkg/utils/errorutils/errors.go index 308ef2e0..0ee26503 100644 --- a/internal/pkg/utils/error_utils/errors.go +++ b/internal/pkg/utils/errorutils/errors.go @@ -5,7 +5,7 @@ import ( "runtime/debug" "strings" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/contracts" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/contracts" defaultLogger "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger/defaultlogger" "emperror.dev/errors" diff --git a/internal/pkg/utils/error_utils/errors_test.go b/internal/pkg/utils/errorutils/errors_test.go similarity index 100% rename from internal/pkg/utils/error_utils/errors_test.go rename to internal/pkg/utils/errorutils/errors_test.go diff --git a/internal/services/catalog_read_service/.env b/internal/services/catalog_read_service/.env deleted file mode 100644 index c307987a..00000000 --- a/internal/services/catalog_read_service/.env +++ /dev/null @@ -1 +0,0 @@ -PROJECT_NAME=catalog_read_service diff --git a/internal/services/catalog_write_service/.env b/internal/services/catalog_write_service/.env deleted file mode 100644 index aa77c30f..00000000 --- a/internal/services/catalog_write_service/.env +++ /dev/null @@ -1 +0,0 @@ -PROJECT_NAME=catalog_write_service diff --git a/internal/services/catalog_read_service/.air.toml b/internal/services/catalogreadservice/.air.toml similarity index 100% rename from internal/services/catalog_read_service/.air.toml rename to internal/services/catalogreadservice/.air.toml diff --git a/internal/services/catalog_read_service/.dockerignore b/internal/services/catalogreadservice/.dockerignore similarity index 100% rename from internal/services/catalog_read_service/.dockerignore rename to internal/services/catalogreadservice/.dockerignore diff --git a/internal/services/catalogreadservice/.env b/internal/services/catalogreadservice/.env new file mode 100644 index 00000000..e19f4d52 --- /dev/null +++ b/internal/services/catalogreadservice/.env @@ -0,0 +1 @@ +PROJECT_NAME=catalogreadservice diff --git a/internal/services/catalog_read_service/.gitignore b/internal/services/catalogreadservice/.gitignore similarity index 100% rename from internal/services/catalog_read_service/.gitignore rename to internal/services/catalogreadservice/.gitignore diff --git a/internal/services/catalog_read_service/.golangci.yml b/internal/services/catalogreadservice/.golangci.yml similarity index 100% rename from internal/services/catalog_read_service/.golangci.yml rename to internal/services/catalogreadservice/.golangci.yml diff --git a/internal/services/catalog_read_service/Dockerfile b/internal/services/catalogreadservice/Dockerfile similarity index 100% rename from internal/services/catalog_read_service/Dockerfile rename to internal/services/catalogreadservice/Dockerfile diff --git a/internal/services/catalog_read_service/Makefile b/internal/services/catalogreadservice/Makefile similarity index 100% rename from internal/services/catalog_read_service/Makefile rename to internal/services/catalogreadservice/Makefile diff --git a/internal/services/catalog_read_service/arch-go.yml b/internal/services/catalogreadservice/arch-go.yml similarity index 100% rename from internal/services/catalog_read_service/arch-go.yml rename to internal/services/catalogreadservice/arch-go.yml diff --git a/internal/services/catalog_read_service/client.http b/internal/services/catalogreadservice/client.http similarity index 100% rename from internal/services/catalog_read_service/client.http rename to internal/services/catalogreadservice/client.http diff --git a/internal/services/catalog_read_service/cmd/app/main.go b/internal/services/catalogreadservice/cmd/app/main.go similarity index 100% rename from internal/services/catalog_read_service/cmd/app/main.go rename to internal/services/catalogreadservice/cmd/app/main.go diff --git a/internal/services/catalog_read_service/cmd/migration/.gitkeep b/internal/services/catalogreadservice/cmd/migration/.gitkeep similarity index 100% rename from internal/services/catalog_read_service/cmd/migration/.gitkeep rename to internal/services/catalogreadservice/cmd/migration/.gitkeep diff --git a/internal/services/catalog_read_service/config/config.development.json b/internal/services/catalogreadservice/config/config.development.json similarity index 95% rename from internal/services/catalog_read_service/config/config.development.json rename to internal/services/catalogreadservice/config/config.development.json index b8f8f6fc..6b988ae3 100644 --- a/internal/services/catalog_read_service/config/config.development.json +++ b/internal/services/catalogreadservice/config/config.development.json @@ -1,16 +1,16 @@ { "appOptions": { - "serviceName": "catalogs_read_service", + "serviceName": "catalogreadservice", "deliveryType": "http" }, "grpcOptions": { - "name": "catalogs_read_service", + "name": "catalogreadservice", "port": ":6004", "host": "localhost", "development": true }, "echoHttpOptions": { - "name": "catalogs_read_service", + "name": "catalogreadservice", "port": ":7001", "development": true, "timeout": 30, diff --git a/internal/services/catalog_read_service/config/config.go b/internal/services/catalogreadservice/config/config.go similarity index 100% rename from internal/services/catalog_read_service/config/config.go rename to internal/services/catalogreadservice/config/config.go diff --git a/internal/services/catalog_read_service/config/config.test.json b/internal/services/catalogreadservice/config/config.test.json similarity index 95% rename from internal/services/catalog_read_service/config/config.test.json rename to internal/services/catalogreadservice/config/config.test.json index 0fa84110..5038d505 100644 --- a/internal/services/catalog_read_service/config/config.test.json +++ b/internal/services/catalogreadservice/config/config.test.json @@ -1,16 +1,16 @@ { "appOptions": { - "serviceName": "catalogs_read_service", + "serviceName": "catalogreadservice", "deliveryType": "http" }, "grpcOptions": { - "name": "catalogs_read_service", + "name": "catalogsreadservice", "port": ":3300", "host": "localhost", "development": true }, "echoHttpOptions": { - "name": "catalogs_read_service", + "name": "catalogreadservice", "port": ":6000", "development": true, "timeout": 30, diff --git a/internal/services/catalog_read_service/config/confix_fx.go b/internal/services/catalogreadservice/config/confix_fx.go similarity index 100% rename from internal/services/catalog_read_service/config/confix_fx.go rename to internal/services/catalogreadservice/config/confix_fx.go diff --git a/internal/services/catalog_read_service/docs/docs.go b/internal/services/catalogreadservice/docs/docs.go similarity index 100% rename from internal/services/catalog_read_service/docs/docs.go rename to internal/services/catalogreadservice/docs/docs.go diff --git a/internal/services/catalog_read_service/docs/swagger.json b/internal/services/catalogreadservice/docs/swagger.json similarity index 100% rename from internal/services/catalog_read_service/docs/swagger.json rename to internal/services/catalogreadservice/docs/swagger.json diff --git a/internal/services/catalog_read_service/docs/swagger.yaml b/internal/services/catalogreadservice/docs/swagger.yaml similarity index 100% rename from internal/services/catalog_read_service/docs/swagger.yaml rename to internal/services/catalogreadservice/docs/swagger.yaml diff --git a/internal/services/catalog_read_service/go.mod b/internal/services/catalogreadservice/go.mod similarity index 95% rename from internal/services/catalog_read_service/go.mod rename to internal/services/catalogreadservice/go.mod index 989903f6..31438437 100644 --- a/internal/services/catalog_read_service/go.mod +++ b/internal/services/catalogreadservice/go.mod @@ -7,7 +7,7 @@ replace github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg => ../../ require ( emperror.dev/errors v0.8.1 - github.com/brianvoe/gofakeit/v6 v6.23.2 + github.com/brianvoe/gofakeit/v6 v6.25.0 github.com/gavv/httpexpect/v2 v2.3.1 github.com/go-ozzo/ozzo-validation v3.6.0+incompatible github.com/go-playground/validator v9.31.0+incompatible @@ -28,6 +28,7 @@ require ( go.opentelemetry.io/otel/metric v1.19.0 go.opentelemetry.io/otel/trace v1.19.0 go.uber.org/fx v1.20.0 + gorm.io/gorm v1.25.5 ) require ( @@ -36,7 +37,6 @@ require ( atomicgo.dev/schedule v0.1.0 // indirect dario.cat/mergo v1.0.0 // indirect github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect - github.com/EventStore/EventStore-Client-Go v1.0.2 // indirect github.com/KyleBanks/depth v1.2.1 // indirect github.com/Masterminds/squirrel v1.5.4 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect @@ -61,10 +61,13 @@ require ( github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/doug-martin/goqu/v9 v9.18.0 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect github.com/fatih/color v1.15.0 // indirect github.com/fatih/structs v1.0.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect + github.com/glebarez/go-sqlite v1.21.2 // indirect + github.com/glebarez/sqlite v1.10.0 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -76,11 +79,9 @@ require ( github.com/go-playground/universal-translator v0.18.1 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/goccy/go-reflect v1.2.0 // indirect - github.com/gofrs/uuid v4.4.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/golang-migrate/migrate/v4 v4.16.2 // indirect - github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/go-querystring v1.1.0 // indirect @@ -147,6 +148,7 @@ require ( github.com/rabbitmq/amqp091-go v1.8.1 // indirect github.com/redis/go-redis/extra/rediscmd/v9 v9.0.5 // indirect github.com/redis/go-redis/extra/redisotel/v9 v9.0.5 // indirect + github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/samber/lo v1.38.1 // indirect github.com/sergi/go-diff v1.2.0 // indirect @@ -166,13 +168,14 @@ require ( github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect + github.com/ulule/limiter/v3 v3.11.2 // indirect github.com/uptrace/bun v1.1.16 // indirect github.com/uptrace/bun/driver/pgdriver v1.1.16 // indirect github.com/uptrace/opentelemetry-go-extra/otellogrus v0.2.3 // indirect github.com/uptrace/opentelemetry-go-extra/otelutil v0.2.3 // indirect github.com/uptrace/opentelemetry-go-extra/otelzap v0.2.3 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect - github.com/valyala/fasthttp v1.27.0 // indirect + github.com/valyala/fasthttp v1.47.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect github.com/vmihailenco/msgpack/v5 v5.4.0 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect @@ -224,8 +227,11 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gorm.io/driver/postgres v1.5.2 // indirect - gorm.io/gorm v1.25.4 // indirect gorm.io/plugin/opentelemetry v0.1.4 // indirect mellium.im/sasl v0.3.1 // indirect + modernc.org/libc v1.24.1 // indirect + modernc.org/mathutil v1.6.0 // indirect + modernc.org/memory v1.6.0 // indirect + modernc.org/sqlite v1.25.0 // indirect moul.io/http2curl v1.0.1-0.20190925090545-5cd742060b0e // indirect ) diff --git a/internal/services/catalog_read_service/go.sum b/internal/services/catalogreadservice/go.sum similarity index 92% rename from internal/services/catalog_read_service/go.sum rename to internal/services/catalogreadservice/go.sum index 024e0f77..58dd0c77 100644 --- a/internal/services/catalog_read_service/go.sum +++ b/internal/services/catalogreadservice/go.sum @@ -6,7 +6,6 @@ atomicgo.dev/keyboard v0.2.9 h1:tOsIid3nlPLZ3lwgG8KZMp/SFmr7P0ssEN5JUsm78K8= atomicgo.dev/keyboard v0.2.9/go.mod h1:BC4w9g00XkxH/f1HXhW2sXmJFOCWbKn9xrOunSFtExQ= atomicgo.dev/schedule v0.1.0 h1:nTthAbhZS5YZmgYbb2+DH8uQIZcTlIrd4eYr3UQxEjs= atomicgo.dev/schedule v0.1.0/go.mod h1:xeUa3oAkiuHYh8bKiQBRojqAMq3PXXbJujjb0hw8pEU= -bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -56,15 +55,12 @@ emperror.dev/errors v0.8.1 h1:UavXZ5cSX/4u9iyvH6aDcuGkVjeexUGJ7Ij7G4VfQT0= emperror.dev/errors v0.8.1/go.mod h1:YcRvLPh626Ubn2xqtoprejnA5nFha+TJ+2vew48kWuE= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= -github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= -github.com/EventStore/EventStore-Client-Go v1.0.2 h1:onM2TIInLhWUJwUQ/5a/8blNrrbhwrtm7Tpmg13ohiw= -github.com/EventStore/EventStore-Client-Go v1.0.2/go.mod h1:NOqSOtNxqGizr1Qnf7joGGLK6OkeoLV/QEI893A43H0= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/MarvinJWendt/testza v0.1.0/go.mod h1:7AxNvlfeHP7Z/hDQ5JtE3OKYT3XFUeLCDE2DQninSqs= @@ -80,13 +76,10 @@ github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030I github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM= github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= -github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Microsoft/hcsshim v0.11.1 h1:hJ3s7GbWlGK4YVV92sO88BQSyF4ZLVy7/awqOlPxFbA= github.com/Microsoft/hcsshim v0.11.1/go.mod h1:nFJmaO4Zr5Y7eADdFOpYswDDlNVbvcIJJNJLECr5JQg= -github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= -github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/TylerBrock/colorjson v0.0.0-20200706003622-8a50f05110d2 h1:ZBbLwSJqkHBuFDA6DUhhse0IGJ7T5bemHyNILUjvOq4= github.com/TylerBrock/colorjson v0.0.0-20200706003622-8a50f05110d2/go.mod h1:VSw57q4QFiWDbRnjdX8Cb3Ow0SFncRw+bA/ofY6Q83w= github.com/ahmetb/go-linq/v3 v3.2.0 h1:BEuMfp+b59io8g5wYzNoFe9pWPalRklhlhbiU3hYZDE= @@ -106,8 +99,8 @@ github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/brianvoe/gofakeit/v6 v6.23.2 h1:lVde18uhad5wII/f5RMVFLtdQNE0HaGFuBUXmYKk8i8= -github.com/brianvoe/gofakeit/v6 v6.23.2/go.mod h1:Ow6qC71xtwm79anlwKRlWZW6zVq9D2XHE4QSSMP/rU8= +github.com/brianvoe/gofakeit/v6 v6.25.0 h1:ZpFjktOpLZUeF8q223o0rUuXtA+m5qW5srjvVi+JkXk= +github.com/brianvoe/gofakeit/v6 v6.25.0/go.mod h1:Xj58BMSnFqcn/fAQeSK+/PLtC5kSb7FJIq4JyGa8vEs= github.com/bsm/ginkgo/v2 v2.7.0/go.mod h1:AiKlXPm7ItEHNc/2+OkrNG4E0ITzojb9/xWzvQ9XZ9w= github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= @@ -116,17 +109,14 @@ github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/caarlos0/env/v8 v8.0.0 h1:POhxHhSpuxrLMIdvTGARuZqR4Jjm8AYmoi/JKlcScs0= github.com/caarlos0/env/v8 v8.0.0/go.mod h1:7K4wMY9bH0esiXSSHlfHLX5xKGQMnkH5Fk4TDSSSzfo= -github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/cilium/ebpf v0.5.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -135,47 +125,37 @@ github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+g github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= -github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw= github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/containerd v1.7.6 h1:oNAVsnhPoy4BTPQivLgTzI9Oleml9l/+eYIDYXRCYo8= github.com/containerd/containerd v1.7.6/go.mod h1:SY6lrkkuJT40BVNO37tlYTSnKJnP5AXBc0fhx0q+TJ4= -github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= -github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe/go.mod h1:cECdGN1O8G9bgKTlLhuPJimka6Xb/Gg7vYzCTNVxhvo= -github.com/containerd/continuity v0.4.2 h1:v3y/4Yz5jwnvqPKJJ+7Wf93fyWoCB3F5EclWG023MDM= -github.com/containerd/continuity v0.4.2/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.3.1/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/dockercfg v0.3.1 h1:/FpZ+JaygUR/lZP2NlFI2DVfrOEMAIKP5wWEJdoYe9E= github.com/cpuguy83/dockercfg v0.3.1/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= -github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisenkom/go-mssqldb v0.10.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/docker/cli v24.0.6+incompatible h1:fF+XCQCgJjjQNIMjzaSmiKJSCcfcXb3TWTcc7GAneOY= -github.com/docker/cli v24.0.6+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v24.0.6+incompatible h1:hceabKCtUgDqPu+qm0NgsaXf28Ljf4/pWFL7xjWWDgE= github.com/docker/docker v24.0.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/doug-martin/goqu/v9 v9.18.0 h1:/6bcuEtAe6nsSMVK/M+fOiXUNfyFF3yYtE07DBPFMYY= github.com/doug-martin/goqu/v9 v9.18.0/go.mod h1:nf0Wc2/hV3gYK9LiyqIrzBEVGlI8qW3GuDCEobC4wBQ= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -190,7 +170,6 @@ github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/fatih/structs v1.0.0 h1:BrX964Rv5uQ3wwS+KRUAJCBBw5PQmgJfJ6v4yly5QwU= github.com/fatih/structs v1.0.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= -github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -201,6 +180,10 @@ github.com/gavv/httpexpect/v2 v2.3.1 h1:sGLlKMn8AuHS9ztK9Sb7AJ7OxIL8v2PcLdyxfKt1 github.com/gavv/httpexpect/v2 v2.3.1/go.mod h1:yOE8m/aqFYQDNrgprMeXgq4YynfN9h1NgcE1+1suV64= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/glebarez/go-sqlite v1.21.2 h1:3a6LFC4sKahUunAmynQKLZceZCOzUthkRkEAl9gAXWo= +github.com/glebarez/go-sqlite v1.21.2/go.mod h1:sfxdZyhQjTM2Wry3gVYWaW072Ri1WMdWJi0k6+3382k= +github.com/glebarez/sqlite v1.10.0 h1:u4gt8y7OND/cCei/NMHmfbLxF6xP2wgKcT/BJf2pYkc= +github.com/glebarez/sqlite v1.10.0/go.mod h1:IJ+lfSOmiekhQsFTJRx/lHtGYmCdtAiTaf5wI9u5uHA= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -246,8 +229,6 @@ github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-reflect v1.2.0 h1:O0T8rZCuNmGXewnATuKYnkL0xm6o8UNOJZd/gOkb9ms= github.com/goccy/go-reflect v1.2.0/go.mod h1:n0oYZn8VcV2CkWTxi8B9QjkCoq6GTtCEdfmR66YhFtE= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= @@ -271,8 +252,6 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -328,8 +307,6 @@ github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20230926050212-f7f687d19a98 h1:pUa4ghanp6q4IJHwE9RwLgmVFfReJN+KbQ8ExNEUUoQ= github.com/google/pprof v0.0.0-20230926050212-f7f687d19a98/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= @@ -341,8 +318,6 @@ github.com/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQ github.com/gookit/color v1.5.0/go.mod h1:43aQb+Zerm/BWh2GnrgOQm7ffz7tvQXEKV6BFMl7wAo= github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0= github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w= -github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e h1:XmA6L9IPRdUr28a+SK/oMchGgQy159wvzXA5tJ7l+40= -github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e/go.mod h1:AFIo+02s+12CEg8Gzz9kzhCbmbq6JcKNrhHffCGA9z4= github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g= github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= @@ -366,11 +341,8 @@ github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSAS github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= -github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/imkira/go-interpol v1.0.0 h1:HrmLyvOLJyjR0YofMw8QGdCIuYOs4TJUBDNU5sJC09E= github.com/imkira/go-interpol v1.0.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= @@ -473,11 +445,9 @@ github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhR github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw= github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= -github.com/lib/pq v0.0.0-20180327071824-d34b9ff171c2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.1/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= @@ -518,10 +488,6 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zk github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mcuadros/go-defaults v1.2.0 h1:FODb8WSf0uGaY8elWJAkoLL0Ri6AlZ1bFlenk56oZtc= github.com/mcuadros/go-defaults v1.2.0/go.mod h1:WEZtHEVIGYVDqkKSWBdWKUVdRyKlMfulPaGDWIVeCWY= -github.com/mehdihadeli/go-mediatr v1.1.10 h1:NAzg4065c90lgYeb+Vzbd2WKH0tUFpxzL0mpx6hkU/A= -github.com/mehdihadeli/go-mediatr v1.1.10/go.mod h1:lwgZl7qVL/RKomObBblhG3uEte/r4nJDV95Vd+nGrMw= -github.com/mehdihadeli/go-mediatr v1.2.0 h1:XkzYF/uGfW4pwPWYAxKyY+mO6l989PbmCQWSYHuCZtU= -github.com/mehdihadeli/go-mediatr v1.2.0/go.mod h1:I9LuExxAKz6cTDJyP/SSDSmkHaPHK1/usnvEXjUY47k= github.com/mehdihadeli/go-mediatr v1.3.0 h1:hrb5Scp/nsiR3Y62mjZ0Tc5UX/dRJl4nDFkINBEIESA= github.com/mehdihadeli/go-mediatr v1.3.0/go.mod h1:lsG+hyH+pEOhmZiZl0KPO72BcZiEReF03CBk4GVJB0k= github.com/michaelklishin/rabbit-hole v1.5.0 h1:Bex27BiFDsijCM9D0ezSHqyy0kehpYHuNKaPqq/a4RM= @@ -530,10 +496,8 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= -github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= -github.com/moby/term v0.0.0-20200915141129-7f0af18e79f2/go.mod h1:TjQg8pa4iejrUrjiz0MCtMV38jdMNW4doKSiBrEvCQQ= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= @@ -541,7 +505,6 @@ github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8 github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nolleh/caption_json_formatter v0.2.2 h1:EKsOr/fCllNQF2ZoajfbSDlV73BNV1bDu1aTTSRrlN0= github.com/nolleh/caption_json_formatter v0.2.2/go.mod h1:5FYofZA8NAej/eFxa12FvyQKosU1LfyKizZPlY0JojU= @@ -560,27 +523,17 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c= github.com/onsi/gomega v1.28.0/go.mod h1:A1H2JE76sI14WIP57LMKj7FVfCHx3g3BcZVjJG8bjX8= -github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= -github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= -github.com/opencontainers/runc v1.0.0-rc95/go.mod h1:z+bZxa/+Tz/FmYVWkhUajJdzFeOqjc5vrqskhVyHGUM= github.com/opencontainers/runc v1.1.9 h1:XR0VIHTGce5eWPkaPesqTBrhW2yAcaraWfsEalNwQLM= github.com/opencontainers/runc v1.1.9/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= -github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDOCg/jA= github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= -github.com/ory/dockertest/v3 v3.6.3/go.mod h1:EFLcVUOl8qCwp9NyDAcCDtq/QviLtYswW/VbWzUnTNE= -github.com/ory/dockertest/v3 v3.10.0 h1:4K3z2VMe8Woe++invjaTB7VRyQXQy5UY+loujO4aNE4= -github.com/ory/dockertest/v3 v3.10.0/go.mod h1:nr57ZbRWMqfsdGdFNLHz5jjNdDb7VVFnzAeW1n5N1Lg= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= -github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -617,6 +570,8 @@ github.com/redis/go-redis/extra/redisotel/v9 v9.0.5/go.mod h1:WZjPDy7VNzn77AAfnA github.com/redis/go-redis/v9 v9.0.5/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk= github.com/redis/go-redis/v9 v9.2.1 h1:WlYJg71ODF0dVspZZCpYmoF1+U1Jjk9Rwd7pq6QmlCg= github.com/redis/go-redis/v9 v9.2.1/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= @@ -626,7 +581,6 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM= github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= @@ -634,7 +588,6 @@ github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/savsgio/gotils v0.0.0-20210617111740-97865ed5a873 h1:N3Af8f13ooDKcIhsmFT7Z05CStZWu4C7Md0uDEy4q6o= github.com/savsgio/gotils v0.0.0-20210617111740-97865ed5a873/go.mod h1:dmPawKuiAeG/aFYVs2i+Dyosoo7FNcm+Pi8iK6ZUrX8= -github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= @@ -648,11 +601,8 @@ github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9Nz github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smarty/assertions v1.15.0 h1:cR//PqUBUiQRakZWqBiFFQ9wb8emQGDb0HeGdqGByCY= @@ -663,13 +613,10 @@ github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= -github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= -github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= @@ -703,7 +650,6 @@ github.com/swaggo/files/v2 v2.0.0 h1:hmAt8Dkynw7Ssz46F6pn8ok6YmGZqHSVLZ+HQM7i0kw github.com/swaggo/files/v2 v2.0.0/go.mod h1:24kk2Y9NYEJ5lHuCra6iVwkMjIekMCaFq/0JQj66kyM= github.com/swaggo/swag v1.16.2 h1:28Pp+8DkQoV+HLzLx8RGJZXNGKbFqnuvSbAAtoxiY04= github.com/swaggo/swag v1.16.2/go.mod h1:6YzXnDcpr0767iOejs318CwYkCQqyGer6BizOg03f+E= -github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/testcontainers/testcontainers-go v0.25.0 h1:erH6cQjsaJrH+rJDU9qIf89KFdhK0Bft0aEZHlYC3Vs= github.com/testcontainers/testcontainers-go v0.25.0/go.mod h1:4sC9SiJyzD1XFi59q8umTQYWxnkweEc5OjVtTUlJzqQ= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= @@ -713,6 +659,8 @@ github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+F github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= +github.com/ulule/limiter/v3 v3.11.2 h1:P4yOrxoEMJbOTfRJR2OzjL90oflzYPPmWg+dvwN2tHA= +github.com/ulule/limiter/v3 v3.11.2/go.mod h1:QG5GnFOCV+k7lrL5Y8kgEeeflPH3+Cviqlqa8SVSQxI= github.com/uptrace/bun v1.1.16 h1:cn9cgEMFwcyYRsQLfxCRMUxyK1WaHwOVrR3TvzEFZ/A= github.com/uptrace/bun v1.1.16/go.mod h1:7HnsMRRvpLFUcquJxp22JO8PsWKpFQO/gNXqqsuGWg8= github.com/uptrace/bun/driver/pgdriver v1.1.16 h1:b/NiSXk6Ldw7KLfMLbOqIkm4odHd7QiNOCPLqPFJjK4= @@ -723,22 +671,19 @@ github.com/uptrace/opentelemetry-go-extra/otelutil v0.2.3 h1:LyGS9cIZV0YVhE81zwf github.com/uptrace/opentelemetry-go-extra/otelutil v0.2.3/go.mod h1:RvCYhPchLhvQ9l9C9goblbgO7BaKt597kBMf5mgKyo0= github.com/uptrace/opentelemetry-go-extra/otelzap v0.2.3 h1:2na5W81H38Z4qXCQCuzlcdSMiTWgPJ6XeZIArq6VIJE= github.com/uptrace/opentelemetry-go-extra/otelzap v0.2.3/go.mod h1:9IVEh9mPv3NwFf99dVLX15FqVgdpZJ8RMDo/Cr0vK74= -github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.27.0 h1:gDefRDL9aqSiwXV6aRW8aSBPs82y4KizSzHrBLf4NDI= github.com/valyala/fasthttp v1.27.0/go.mod h1:cmWIqlu99AO/RKcp1HWaViTqc57FswJOfYYdPJBl8BA= +github.com/valyala/fasthttp v1.47.0 h1:y7moDoxYzMooFpT5aHgNgVOQDrS3qlkfiP9mDtGGK9c= +github.com/valyala/fasthttp v1.47.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= -github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= -github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= github.com/vmihailenco/msgpack/v5 v5.4.0 h1:hRM0digJwyR6vll33NNAwCFguy5JuBD6jxDmQP3l608= github.com/vmihailenco/msgpack/v5 v5.4.0/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= @@ -773,7 +718,6 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= @@ -850,7 +794,6 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= -golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= @@ -907,7 +850,6 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= @@ -926,7 +868,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191003171128-d98b1b443823/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -947,7 +888,6 @@ golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -975,7 +915,6 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= @@ -992,7 +931,6 @@ golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1001,7 +939,6 @@ golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1019,9 +956,7 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1034,8 +969,6 @@ golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1097,7 +1030,6 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1142,7 +1074,6 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= @@ -1209,7 +1140,6 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200815001618-f69a88009b70/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -1254,10 +1184,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1266,7 +1194,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= @@ -1277,7 +1204,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= @@ -1291,11 +1217,10 @@ gorm.io/driver/postgres v1.5.2 h1:ytTDxxEv+MplXOfFe3Lzm7SjG09fcdb3Z/c056DTBx0= gorm.io/driver/postgres v1.5.2/go.mod h1:fmpX0m2I1PKuR7mKZiEluwrP3hbs+ps7JIGMUBpCgl8= gorm.io/driver/sqlite v1.5.0 h1:zKYbzRCpBrT1bNijRnxLDJWPjVfImGEn0lSnUY5gZ+c= gorm.io/driver/sqlite v1.5.0/go.mod h1:kDMDfntV9u/vuMmz8APHtHF0b4nyBB7sfCieC6G8k8I= -gorm.io/gorm v1.25.4 h1:iyNd8fNAe8W9dvtlgeRI5zSVZPsq3OpcTu37cYcpCmw= -gorm.io/gorm v1.25.4/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls= +gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= gorm.io/plugin/opentelemetry v0.1.4 h1:7p0ocWELjSSRI7NCKPW2mVe6h43YPini99sNJcbsTuc= gorm.io/plugin/opentelemetry v0.1.4/go.mod h1:tndJHOdvPT0pyGhOb8E2209eXJCUxhC5UpKw7bGVWeI= -gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1307,6 +1232,14 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= mellium.im/sasl v0.3.1 h1:wE0LW6g7U83vhvxjC1IY8DnXM+EU095yeo8XClvCdfo= mellium.im/sasl v0.3.1/go.mod h1:xm59PUYpZHhgQ9ZqoJ5QaCqzWMi8IeS49dhp6plPCzw= +modernc.org/libc v1.24.1 h1:uvJSeCKL/AgzBo2yYIPPTy82v21KgGnizcGYfBHaNuM= +modernc.org/libc v1.24.1/go.mod h1:FmfO1RLrU3MHJfyi9eYYmZBfi/R+tqZ6+hQ3yQQUkak= +modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= +modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= +modernc.org/memory v1.6.0 h1:i6mzavxrE9a30whzMfwf7XWVODx2r5OYXvU46cirX7o= +modernc.org/memory v1.6.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= +modernc.org/sqlite v1.25.0 h1:AFweiwPNd/b3BoKnBOfFm+Y260guGMF+0UFk0savqeA= +modernc.org/sqlite v1.25.0/go.mod h1:FL3pVXie73rg3Rii6V/u5BoHlSoyeZeIgKZEgHARyCU= moul.io/http2curl v1.0.1-0.20190925090545-5cd742060b0e h1:C7q+e9M5nggAvWfVg9Nl66kebKeuJlP3FD58V4RR5wo= moul.io/http2curl v1.0.1-0.20190925090545-5cd742060b0e/go.mod h1:nejbQVfXh96n9dSF6cH3Jsk/QI1Z2oEL7sSI2ifXFNA= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/internal/services/catalog_read_service/internal/products/configurations/mappings/mapping_profile.go b/internal/services/catalogreadservice/internal/products/configurations/mappings/mapping_profile.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/configurations/mappings/mapping_profile.go rename to internal/services/catalogreadservice/internal/products/configurations/mappings/mapping_profile.go diff --git a/internal/services/catalog_read_service/internal/products/configurations/mediator/mediator_configurations.go b/internal/services/catalogreadservice/internal/products/configurations/mediator/mediator_configurations.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/configurations/mediator/mediator_configurations.go rename to internal/services/catalogreadservice/internal/products/configurations/mediator/mediator_configurations.go diff --git a/internal/services/catalog_read_service/internal/products/configurations/products_module_configurator.go b/internal/services/catalogreadservice/internal/products/configurations/products_module_configurator.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/configurations/products_module_configurator.go rename to internal/services/catalogreadservice/internal/products/configurations/products_module_configurator.go diff --git a/internal/services/catalog_read_service/internal/products/configurations/rabbitmq/rabbitmq_configuration.go b/internal/services/catalogreadservice/internal/products/configurations/rabbitmq/rabbitmq_configuration.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/configurations/rabbitmq/rabbitmq_configuration.go rename to internal/services/catalogreadservice/internal/products/configurations/rabbitmq/rabbitmq_configuration.go diff --git a/internal/services/catalog_read_service/internal/products/consts/consts.go b/internal/services/catalogreadservice/internal/products/consts/consts.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/consts/consts.go rename to internal/services/catalogreadservice/internal/products/consts/consts.go diff --git a/internal/services/catalog_read_service/internal/products/contracts/data/product_cache_repository.go b/internal/services/catalogreadservice/internal/products/contracts/data/product_cache_repository.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/contracts/data/product_cache_repository.go rename to internal/services/catalogreadservice/internal/products/contracts/data/product_cache_repository.go diff --git a/internal/services/catalog_read_service/internal/products/contracts/data/product_repository.go b/internal/services/catalogreadservice/internal/products/contracts/data/product_repository.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/contracts/data/product_repository.go rename to internal/services/catalogreadservice/internal/products/contracts/data/product_repository.go diff --git a/internal/services/catalog_read_service/internal/products/contracts/params/product_route_params.go b/internal/services/catalogreadservice/internal/products/contracts/params/product_route_params.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/contracts/params/product_route_params.go rename to internal/services/catalogreadservice/internal/products/contracts/params/product_route_params.go diff --git a/internal/services/catalog_read_service/internal/products/data/repositories/mongo_product_repository.go b/internal/services/catalogreadservice/internal/products/data/repositories/mongo_product_repository.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/data/repositories/mongo_product_repository.go rename to internal/services/catalogreadservice/internal/products/data/repositories/mongo_product_repository.go diff --git a/internal/services/catalog_read_service/internal/products/data/repositories/redis_product_repository.go b/internal/services/catalogreadservice/internal/products/data/repositories/redis_product_repository.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/data/repositories/redis_product_repository.go rename to internal/services/catalogreadservice/internal/products/data/repositories/redis_product_repository.go diff --git a/internal/services/catalog_read_service/internal/products/dto/product_dto.go b/internal/services/catalogreadservice/internal/products/dto/product_dto.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/dto/product_dto.go rename to internal/services/catalogreadservice/internal/products/dto/product_dto.go diff --git a/internal/services/catalog_read_service/internal/products/features/creating_product/v1/create_product.go b/internal/services/catalogreadservice/internal/products/features/creating_product/v1/create_product.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/features/creating_product/v1/create_product.go rename to internal/services/catalogreadservice/internal/products/features/creating_product/v1/create_product.go diff --git a/internal/services/catalog_read_service/internal/products/features/creating_product/v1/create_product_handler.go b/internal/services/catalogreadservice/internal/products/features/creating_product/v1/create_product_handler.go similarity index 98% rename from internal/services/catalog_read_service/internal/products/features/creating_product/v1/create_product_handler.go rename to internal/services/catalogreadservice/internal/products/features/creating_product/v1/create_product_handler.go index b8eb7309..fa59ec4b 100644 --- a/internal/services/catalog_read_service/internal/products/features/creating_product/v1/create_product_handler.go +++ b/internal/services/catalogreadservice/internal/products/features/creating_product/v1/create_product_handler.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/data" diff --git a/internal/services/catalog_read_service/internal/products/features/creating_product/v1/dtos/create_product_response_dto.go b/internal/services/catalogreadservice/internal/products/features/creating_product/v1/dtos/create_product_response_dto.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/features/creating_product/v1/dtos/create_product_response_dto.go rename to internal/services/catalogreadservice/internal/products/features/creating_product/v1/dtos/create_product_response_dto.go diff --git a/internal/services/catalog_read_service/internal/products/features/creating_product/v1/events/integrationevents/externalevents/product_created.go b/internal/services/catalogreadservice/internal/products/features/creating_product/v1/events/integrationevents/externalevents/product_created.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/features/creating_product/v1/events/integrationevents/externalevents/product_created.go rename to internal/services/catalogreadservice/internal/products/features/creating_product/v1/events/integrationevents/externalevents/product_created.go diff --git a/internal/services/catalog_read_service/internal/products/features/creating_product/v1/events/integrationevents/externalevents/product_created_consumer.go b/internal/services/catalogreadservice/internal/products/features/creating_product/v1/events/integrationevents/externalevents/product_created_consumer.go similarity index 97% rename from internal/services/catalog_read_service/internal/products/features/creating_product/v1/events/integrationevents/externalevents/product_created_consumer.go rename to internal/services/catalogreadservice/internal/products/features/creating_product/v1/events/integrationevents/externalevents/product_created_consumer.go index c47b9738..479f39b0 100644 --- a/internal/services/catalog_read_service/internal/products/features/creating_product/v1/events/integrationevents/externalevents/product_created_consumer.go +++ b/internal/services/catalogreadservice/internal/products/features/creating_product/v1/events/integrationevents/externalevents/product_created_consumer.go @@ -6,7 +6,7 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/consumer" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/types" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" v1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/creating_product/v1" diff --git a/internal/services/catalog_read_service/internal/products/features/deleting_products/v1/commands/delete_product.go b/internal/services/catalogreadservice/internal/products/features/deleting_products/v1/commands/delete_product.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/features/deleting_products/v1/commands/delete_product.go rename to internal/services/catalogreadservice/internal/products/features/deleting_products/v1/commands/delete_product.go diff --git a/internal/services/catalog_read_service/internal/products/features/deleting_products/v1/commands/delete_product_handler.go b/internal/services/catalogreadservice/internal/products/features/deleting_products/v1/commands/delete_product_handler.go similarity index 97% rename from internal/services/catalog_read_service/internal/products/features/deleting_products/v1/commands/delete_product_handler.go rename to internal/services/catalogreadservice/internal/products/features/deleting_products/v1/commands/delete_product_handler.go index 68a8711b..bfe4f51e 100644 --- a/internal/services/catalog_read_service/internal/products/features/deleting_products/v1/commands/delete_product_handler.go +++ b/internal/services/catalogreadservice/internal/products/features/deleting_products/v1/commands/delete_product_handler.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/data" diff --git a/internal/services/catalog_read_service/internal/products/features/deleting_products/v1/events/integration_events/external_events/product_deleted.go b/internal/services/catalogreadservice/internal/products/features/deleting_products/v1/events/integration_events/external_events/product_deleted.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/features/deleting_products/v1/events/integration_events/external_events/product_deleted.go rename to internal/services/catalogreadservice/internal/products/features/deleting_products/v1/events/integration_events/external_events/product_deleted.go diff --git a/internal/services/catalog_read_service/internal/products/features/deleting_products/v1/events/integration_events/external_events/product_deleted_consumer.go b/internal/services/catalogreadservice/internal/products/features/deleting_products/v1/events/integration_events/external_events/product_deleted_consumer.go similarity index 97% rename from internal/services/catalog_read_service/internal/products/features/deleting_products/v1/events/integration_events/external_events/product_deleted_consumer.go rename to internal/services/catalogreadservice/internal/products/features/deleting_products/v1/events/integration_events/external_events/product_deleted_consumer.go index 7b91c075..378b1188 100644 --- a/internal/services/catalog_read_service/internal/products/features/deleting_products/v1/events/integration_events/external_events/product_deleted_consumer.go +++ b/internal/services/catalogreadservice/internal/products/features/deleting_products/v1/events/integration_events/external_events/product_deleted_consumer.go @@ -5,7 +5,7 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/consumer" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/types" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/deleting_products/v1/commands" diff --git a/internal/services/catalog_read_service/internal/products/features/get_product_by_id/v1/dtos/get_product_by_id_request_dto.go b/internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/dtos/get_product_by_id_request_dto.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/features/get_product_by_id/v1/dtos/get_product_by_id_request_dto.go rename to internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/dtos/get_product_by_id_request_dto.go diff --git a/internal/services/catalog_read_service/internal/products/features/get_product_by_id/v1/dtos/get_product_by_id_response_dto.go b/internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/dtos/get_product_by_id_response_dto.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/features/get_product_by_id/v1/dtos/get_product_by_id_response_dto.go rename to internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/dtos/get_product_by_id_response_dto.go diff --git a/internal/services/catalog_read_service/internal/products/features/get_product_by_id/v1/endpoints/get_product_by_id_endpoint.go b/internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/endpoints/get_product_by_id_endpoint.go similarity index 97% rename from internal/services/catalog_read_service/internal/products/features/get_product_by_id/v1/endpoints/get_product_by_id_endpoint.go rename to internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/endpoints/get_product_by_id_endpoint.go index da5a4c16..63659962 100644 --- a/internal/services/catalog_read_service/internal/products/features/get_product_by_id/v1/endpoints/get_product_by_id_endpoint.go +++ b/internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/endpoints/get_product_by_id_endpoint.go @@ -4,7 +4,7 @@ import ( "net/http" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/web/route" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/params" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/dtos" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/queries" diff --git a/internal/services/catalog_read_service/internal/products/features/get_product_by_id/v1/queries/get_product_by_id.go b/internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/queries/get_product_by_id.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/features/get_product_by_id/v1/queries/get_product_by_id.go rename to internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/queries/get_product_by_id.go diff --git a/internal/services/catalog_read_service/internal/products/features/get_product_by_id/v1/queries/get_product_by_id_handler.go b/internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/queries/get_product_by_id_handler.go similarity index 98% rename from internal/services/catalog_read_service/internal/products/features/get_product_by_id/v1/queries/get_product_by_id_handler.go rename to internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/queries/get_product_by_id_handler.go index 58b4b2ff..fabf678c 100644 --- a/internal/services/catalog_read_service/internal/products/features/get_product_by_id/v1/queries/get_product_by_id_handler.go +++ b/internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/queries/get_product_by_id_handler.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" diff --git a/internal/services/catalog_read_service/internal/products/features/getting_products/v1/dtos/get_products_request_dto.go b/internal/services/catalogreadservice/internal/products/features/getting_products/v1/dtos/get_products_request_dto.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/features/getting_products/v1/dtos/get_products_request_dto.go rename to internal/services/catalogreadservice/internal/products/features/getting_products/v1/dtos/get_products_request_dto.go diff --git a/internal/services/catalog_read_service/internal/products/features/getting_products/v1/dtos/get_products_response_dto.go b/internal/services/catalogreadservice/internal/products/features/getting_products/v1/dtos/get_products_response_dto.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/features/getting_products/v1/dtos/get_products_response_dto.go rename to internal/services/catalogreadservice/internal/products/features/getting_products/v1/dtos/get_products_response_dto.go diff --git a/internal/services/catalog_read_service/internal/products/features/getting_products/v1/endpoints/get_products_endpoint.go b/internal/services/catalogreadservice/internal/products/features/getting_products/v1/endpoints/get_products_endpoint.go similarity index 98% rename from internal/services/catalog_read_service/internal/products/features/getting_products/v1/endpoints/get_products_endpoint.go rename to internal/services/catalogreadservice/internal/products/features/getting_products/v1/endpoints/get_products_endpoint.go index 1ecf134c..2369558b 100644 --- a/internal/services/catalog_read_service/internal/products/features/getting_products/v1/endpoints/get_products_endpoint.go +++ b/internal/services/catalogreadservice/internal/products/features/getting_products/v1/endpoints/get_products_endpoint.go @@ -4,7 +4,7 @@ import ( "net/http" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/web/route" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/params" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/getting_products/v1/dtos" diff --git a/internal/services/catalog_read_service/internal/products/features/getting_products/v1/queries/get_products.go b/internal/services/catalogreadservice/internal/products/features/getting_products/v1/queries/get_products.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/features/getting_products/v1/queries/get_products.go rename to internal/services/catalogreadservice/internal/products/features/getting_products/v1/queries/get_products.go diff --git a/internal/services/catalog_read_service/internal/products/features/getting_products/v1/queries/get_products_handler.go b/internal/services/catalogreadservice/internal/products/features/getting_products/v1/queries/get_products_handler.go similarity index 97% rename from internal/services/catalog_read_service/internal/products/features/getting_products/v1/queries/get_products_handler.go rename to internal/services/catalogreadservice/internal/products/features/getting_products/v1/queries/get_products_handler.go index 1cba0c1c..3fd0a93c 100644 --- a/internal/services/catalog_read_service/internal/products/features/getting_products/v1/queries/get_products_handler.go +++ b/internal/services/catalogreadservice/internal/products/features/getting_products/v1/queries/get_products_handler.go @@ -3,7 +3,7 @@ package queries import ( "context" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" diff --git a/internal/services/catalog_read_service/internal/products/features/searching_products/v1/dtos/search_products_request_dto.go b/internal/services/catalogreadservice/internal/products/features/searching_products/v1/dtos/search_products_request_dto.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/features/searching_products/v1/dtos/search_products_request_dto.go rename to internal/services/catalogreadservice/internal/products/features/searching_products/v1/dtos/search_products_request_dto.go diff --git a/internal/services/catalog_read_service/internal/products/features/searching_products/v1/dtos/search_products_response_dto.go b/internal/services/catalogreadservice/internal/products/features/searching_products/v1/dtos/search_products_response_dto.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/features/searching_products/v1/dtos/search_products_response_dto.go rename to internal/services/catalogreadservice/internal/products/features/searching_products/v1/dtos/search_products_response_dto.go diff --git a/internal/services/catalog_read_service/internal/products/features/searching_products/v1/endpoints/search_products_endpoint.go b/internal/services/catalogreadservice/internal/products/features/searching_products/v1/endpoints/search_products_endpoint.go similarity index 98% rename from internal/services/catalog_read_service/internal/products/features/searching_products/v1/endpoints/search_products_endpoint.go rename to internal/services/catalogreadservice/internal/products/features/searching_products/v1/endpoints/search_products_endpoint.go index e33447c3..2455d0d1 100644 --- a/internal/services/catalog_read_service/internal/products/features/searching_products/v1/endpoints/search_products_endpoint.go +++ b/internal/services/catalogreadservice/internal/products/features/searching_products/v1/endpoints/search_products_endpoint.go @@ -4,7 +4,7 @@ import ( "net/http" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/web/route" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/params" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/searching_products/v1/dtos" diff --git a/internal/services/catalog_read_service/internal/products/features/searching_products/v1/queries/search_products.go b/internal/services/catalogreadservice/internal/products/features/searching_products/v1/queries/search_products.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/features/searching_products/v1/queries/search_products.go rename to internal/services/catalogreadservice/internal/products/features/searching_products/v1/queries/search_products.go diff --git a/internal/services/catalog_read_service/internal/products/features/searching_products/v1/queries/search_products_handler.go b/internal/services/catalogreadservice/internal/products/features/searching_products/v1/queries/search_products_handler.go similarity index 97% rename from internal/services/catalog_read_service/internal/products/features/searching_products/v1/queries/search_products_handler.go rename to internal/services/catalogreadservice/internal/products/features/searching_products/v1/queries/search_products_handler.go index c5ba5375..81c95ccb 100644 --- a/internal/services/catalog_read_service/internal/products/features/searching_products/v1/queries/search_products_handler.go +++ b/internal/services/catalogreadservice/internal/products/features/searching_products/v1/queries/search_products_handler.go @@ -3,7 +3,7 @@ package queries import ( "context" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" diff --git a/internal/services/catalog_read_service/internal/products/features/updating_products/v1/commands/update_product.go b/internal/services/catalogreadservice/internal/products/features/updating_products/v1/commands/update_product.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/features/updating_products/v1/commands/update_product.go rename to internal/services/catalogreadservice/internal/products/features/updating_products/v1/commands/update_product.go diff --git a/internal/services/catalog_read_service/internal/products/features/updating_products/v1/commands/update_product_handler.go b/internal/services/catalogreadservice/internal/products/features/updating_products/v1/commands/update_product_handler.go similarity index 98% rename from internal/services/catalog_read_service/internal/products/features/updating_products/v1/commands/update_product_handler.go rename to internal/services/catalogreadservice/internal/products/features/updating_products/v1/commands/update_product_handler.go index 4ccb786e..702d9155 100644 --- a/internal/services/catalog_read_service/internal/products/features/updating_products/v1/commands/update_product_handler.go +++ b/internal/services/catalogreadservice/internal/products/features/updating_products/v1/commands/update_product_handler.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/contracts/data" diff --git a/internal/services/catalog_read_service/internal/products/features/updating_products/v1/events/integration_events/external_events/product_updated.go b/internal/services/catalogreadservice/internal/products/features/updating_products/v1/events/integration_events/external_events/product_updated.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/features/updating_products/v1/events/integration_events/external_events/product_updated.go rename to internal/services/catalogreadservice/internal/products/features/updating_products/v1/events/integration_events/external_events/product_updated.go diff --git a/internal/services/catalog_read_service/internal/products/features/updating_products/v1/events/integration_events/external_events/product_updated_consumer.go b/internal/services/catalogreadservice/internal/products/features/updating_products/v1/events/integration_events/external_events/product_updated_consumer.go similarity index 98% rename from internal/services/catalog_read_service/internal/products/features/updating_products/v1/events/integration_events/external_events/product_updated_consumer.go rename to internal/services/catalogreadservice/internal/products/features/updating_products/v1/events/integration_events/external_events/product_updated_consumer.go index 1defa8a6..1df5b42e 100644 --- a/internal/services/catalog_read_service/internal/products/features/updating_products/v1/events/integration_events/external_events/product_updated_consumer.go +++ b/internal/services/catalogreadservice/internal/products/features/updating_products/v1/events/integration_events/external_events/product_updated_consumer.go @@ -6,7 +6,7 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/consumer" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/types" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing/attribute" diff --git a/internal/services/catalog_read_service/internal/products/models/product.go b/internal/services/catalogreadservice/internal/products/models/product.go similarity index 100% rename from internal/services/catalog_read_service/internal/products/models/product.go rename to internal/services/catalogreadservice/internal/products/models/product.go diff --git a/internal/services/catalog_read_service/internal/products/products_fx.go b/internal/services/catalogreadservice/internal/products/products_fx.go similarity index 98% rename from internal/services/catalog_read_service/internal/products/products_fx.go rename to internal/services/catalogreadservice/internal/products/products_fx.go index 5fe53c96..732157e6 100644 --- a/internal/services/catalog_read_service/internal/products/products_fx.go +++ b/internal/services/catalogreadservice/internal/products/products_fx.go @@ -2,7 +2,7 @@ package products import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/web/route" - customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo" + customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/data/repositories" getProductByIdV1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/get_product_by_id/v1/endpoints" getProductsV1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/features/getting_products/v1/endpoints" diff --git a/internal/services/catalog_read_service/internal/shared/app/app.go b/internal/services/catalogreadservice/internal/shared/app/app.go similarity index 100% rename from internal/services/catalog_read_service/internal/shared/app/app.go rename to internal/services/catalogreadservice/internal/shared/app/app.go diff --git a/internal/services/catalog_read_service/internal/shared/app/application.go b/internal/services/catalogreadservice/internal/shared/app/application.go similarity index 100% rename from internal/services/catalog_read_service/internal/shared/app/application.go rename to internal/services/catalogreadservice/internal/shared/app/application.go diff --git a/internal/services/catalog_read_service/internal/shared/app/application_builder.go b/internal/services/catalogreadservice/internal/shared/app/application_builder.go similarity index 100% rename from internal/services/catalog_read_service/internal/shared/app/application_builder.go rename to internal/services/catalogreadservice/internal/shared/app/application_builder.go diff --git a/internal/services/catalog_read_service/internal/shared/app/test/test_app.go b/internal/services/catalogreadservice/internal/shared/app/test/test_app.go similarity index 99% rename from internal/services/catalog_read_service/internal/shared/app/test/test_app.go rename to internal/services/catalogreadservice/internal/shared/app/test/test_app.go index ca8518c1..6430781c 100644 --- a/internal/services/catalog_read_service/internal/shared/app/test/test_app.go +++ b/internal/services/catalogreadservice/internal/shared/app/test/test_app.go @@ -7,7 +7,7 @@ import ( "time" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/fxapp/contracts" - config3 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/config" + config3 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/config" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mongodb" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/bus" diff --git a/internal/services/catalog_read_service/internal/shared/app/test/test_application.go b/internal/services/catalogreadservice/internal/shared/app/test/test_application.go similarity index 100% rename from internal/services/catalog_read_service/internal/shared/app/test/test_application.go rename to internal/services/catalogreadservice/internal/shared/app/test/test_application.go diff --git a/internal/services/catalog_read_service/internal/shared/app/test/test_application_builder.go b/internal/services/catalogreadservice/internal/shared/app/test/test_application_builder.go similarity index 100% rename from internal/services/catalog_read_service/internal/shared/app/test/test_application_builder.go rename to internal/services/catalogreadservice/internal/shared/app/test/test_application_builder.go diff --git a/internal/services/catalog_read_service/internal/shared/configurations/catalogs/catalogs_configurator.go b/internal/services/catalogreadservice/internal/shared/configurations/catalogs/catalogs_configurator.go similarity index 98% rename from internal/services/catalog_read_service/internal/shared/configurations/catalogs/catalogs_configurator.go rename to internal/services/catalogreadservice/internal/shared/configurations/catalogs/catalogs_configurator.go index ccd5b53e..18682207 100644 --- a/internal/services/catalog_read_service/internal/shared/configurations/catalogs/catalogs_configurator.go +++ b/internal/services/catalogreadservice/internal/shared/configurations/catalogs/catalogs_configurator.go @@ -5,7 +5,7 @@ import ( "net/http" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/fxapp/contracts" - customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo" + customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/config" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/configurations" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/shared/configurations/catalogs/infrastructure" diff --git a/internal/services/catalog_read_service/internal/shared/configurations/catalogs/catalogs_configurator_swagger.go b/internal/services/catalogreadservice/internal/shared/configurations/catalogs/catalogs_configurator_swagger.go similarity index 94% rename from internal/services/catalog_read_service/internal/shared/configurations/catalogs/catalogs_configurator_swagger.go rename to internal/services/catalogreadservice/internal/shared/configurations/catalogs/catalogs_configurator_swagger.go index 1389e6e4..180f501a 100644 --- a/internal/services/catalog_read_service/internal/shared/configurations/catalogs/catalogs_configurator_swagger.go +++ b/internal/services/catalogreadservice/internal/shared/configurations/catalogs/catalogs_configurator_swagger.go @@ -1,7 +1,7 @@ package catalogs import ( - customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/contracts" + customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/contracts" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/docs" "github.com/labstack/echo/v4" diff --git a/internal/services/catalog_read_service/internal/shared/configurations/catalogs/catalogs_fx.go b/internal/services/catalogreadservice/internal/shared/configurations/catalogs/catalogs_fx.go similarity index 100% rename from internal/services/catalog_read_service/internal/shared/configurations/catalogs/catalogs_fx.go rename to internal/services/catalogreadservice/internal/shared/configurations/catalogs/catalogs_fx.go diff --git a/internal/services/catalog_read_service/internal/shared/configurations/catalogs/infrastructure/infrastructure_configurator.go b/internal/services/catalogreadservice/internal/shared/configurations/catalogs/infrastructure/infrastructure_configurator.go similarity index 100% rename from internal/services/catalog_read_service/internal/shared/configurations/catalogs/infrastructure/infrastructure_configurator.go rename to internal/services/catalogreadservice/internal/shared/configurations/catalogs/infrastructure/infrastructure_configurator.go diff --git a/internal/services/catalog_read_service/internal/shared/configurations/catalogs/infrastructure/infrastructure_fx.go b/internal/services/catalogreadservice/internal/shared/configurations/catalogs/infrastructure/infrastructure_fx.go similarity index 98% rename from internal/services/catalog_read_service/internal/shared/configurations/catalogs/infrastructure/infrastructure_fx.go rename to internal/services/catalogreadservice/internal/shared/configurations/catalogs/infrastructure/infrastructure_fx.go index 9e39923e..ab9682d3 100644 --- a/internal/services/catalog_read_service/internal/shared/configurations/catalogs/infrastructure/infrastructure_fx.go +++ b/internal/services/catalogreadservice/internal/shared/configurations/catalogs/infrastructure/infrastructure_fx.go @@ -4,7 +4,7 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/grpc" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/health" - customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo" + customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mongodb" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/metrics" diff --git a/internal/services/catalog_read_service/internal/shared/contracts/catalogs_metrics.go b/internal/services/catalogreadservice/internal/shared/contracts/catalogs_metrics.go similarity index 100% rename from internal/services/catalog_read_service/internal/shared/contracts/catalogs_metrics.go rename to internal/services/catalogreadservice/internal/shared/contracts/catalogs_metrics.go diff --git a/internal/services/catalog_read_service/internal/shared/testfixture/integration/integration_test_fixture.go b/internal/services/catalogreadservice/internal/shared/testfixture/integration/integration_test_fixture.go similarity index 100% rename from internal/services/catalog_read_service/internal/shared/testfixture/integration/integration_test_fixture.go rename to internal/services/catalogreadservice/internal/shared/testfixture/integration/integration_test_fixture.go diff --git a/internal/services/catalog_read_service/mocks/ProductCacheRepository.go b/internal/services/catalogreadservice/mocks/ProductCacheRepository.go similarity index 100% rename from internal/services/catalog_read_service/mocks/ProductCacheRepository.go rename to internal/services/catalogreadservice/mocks/ProductCacheRepository.go diff --git a/internal/services/catalog_read_service/mocks/ProductRepository.go b/internal/services/catalogreadservice/mocks/ProductRepository.go similarity index 100% rename from internal/services/catalog_read_service/mocks/ProductRepository.go rename to internal/services/catalogreadservice/mocks/ProductRepository.go diff --git a/internal/services/catalog_read_service/mocks/UnsafeProductsServiceServer.go b/internal/services/catalogreadservice/mocks/UnsafeProductsServiceServer.go similarity index 100% rename from internal/services/catalog_read_service/mocks/UnsafeProductsServiceServer.go rename to internal/services/catalogreadservice/mocks/UnsafeProductsServiceServer.go diff --git a/internal/services/catalog_read_service/readme.md b/internal/services/catalogreadservice/readme.md similarity index 100% rename from internal/services/catalog_read_service/readme.md rename to internal/services/catalogreadservice/readme.md diff --git a/internal/services/catalog_read_service/revive-config.toml b/internal/services/catalogreadservice/revive-config.toml similarity index 100% rename from internal/services/catalog_read_service/revive-config.toml rename to internal/services/catalogreadservice/revive-config.toml diff --git a/internal/services/catalog_read_service/staticcheck.conf b/internal/services/catalogreadservice/staticcheck.conf similarity index 100% rename from internal/services/catalog_read_service/staticcheck.conf rename to internal/services/catalogreadservice/staticcheck.conf diff --git a/internal/services/catalog_read_service/taskfile.yml b/internal/services/catalogreadservice/taskfile.yml similarity index 100% rename from internal/services/catalog_read_service/taskfile.yml rename to internal/services/catalogreadservice/taskfile.yml diff --git a/internal/services/catalog_read_service/taskfile_db.yml b/internal/services/catalogreadservice/taskfile_db.yml similarity index 100% rename from internal/services/catalog_read_service/taskfile_db.yml rename to internal/services/catalogreadservice/taskfile_db.yml diff --git a/internal/services/catalog_read_service/taskfile_test.yml b/internal/services/catalogreadservice/taskfile_test.yml similarity index 100% rename from internal/services/catalog_read_service/taskfile_test.yml rename to internal/services/catalogreadservice/taskfile_test.yml diff --git a/internal/services/catalog_read_service/test/end_to_end/products/features/getting_product_by_id/v1/get_product_by_id_test.go b/internal/services/catalogreadservice/test/end_to_end/products/features/getting_product_by_id/v1/get_product_by_id_test.go similarity index 100% rename from internal/services/catalog_read_service/test/end_to_end/products/features/getting_product_by_id/v1/get_product_by_id_test.go rename to internal/services/catalogreadservice/test/end_to_end/products/features/getting_product_by_id/v1/get_product_by_id_test.go diff --git a/internal/services/catalog_read_service/test/end_to_end/products/features/getting_products/v1/get_products_endpoint_test.go b/internal/services/catalogreadservice/test/end_to_end/products/features/getting_products/v1/get_products_endpoint_test.go similarity index 100% rename from internal/services/catalog_read_service/test/end_to_end/products/features/getting_products/v1/get_products_endpoint_test.go rename to internal/services/catalogreadservice/test/end_to_end/products/features/getting_products/v1/get_products_endpoint_test.go diff --git a/internal/services/catalog_read_service/test/integration/products/data/mongo_product_repository_test.go b/internal/services/catalogreadservice/test/integration/products/data/mongo_product_repository_test.go similarity index 99% rename from internal/services/catalog_read_service/test/integration/products/data/mongo_product_repository_test.go rename to internal/services/catalogreadservice/test/integration/products/data/mongo_product_repository_test.go index 4ec46057..e9dab242 100644 --- a/internal/services/catalog_read_service/test/integration/products/data/mongo_product_repository_test.go +++ b/internal/services/catalogreadservice/test/integration/products/data/mongo_product_repository_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/products/models" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogreadservice/internal/shared/testfixture/integration" diff --git a/internal/services/catalog_read_service/test/integration/products/features/creating_product/v1/commands/create_product_test.go b/internal/services/catalogreadservice/test/integration/products/features/creating_product/v1/commands/create_product_test.go similarity index 100% rename from internal/services/catalog_read_service/test/integration/products/features/creating_product/v1/commands/create_product_test.go rename to internal/services/catalogreadservice/test/integration/products/features/creating_product/v1/commands/create_product_test.go diff --git a/internal/services/catalog_read_service/test/integration/products/features/creating_product/v1/events/product_created_test.go b/internal/services/catalogreadservice/test/integration/products/features/creating_product/v1/events/product_created_test.go similarity index 100% rename from internal/services/catalog_read_service/test/integration/products/features/creating_product/v1/events/product_created_test.go rename to internal/services/catalogreadservice/test/integration/products/features/creating_product/v1/events/product_created_test.go diff --git a/internal/services/catalog_read_service/test/integration/products/features/deleting_product/v1/commands/delete_product_test.go b/internal/services/catalogreadservice/test/integration/products/features/deleting_product/v1/commands/delete_product_test.go similarity index 100% rename from internal/services/catalog_read_service/test/integration/products/features/deleting_product/v1/commands/delete_product_test.go rename to internal/services/catalogreadservice/test/integration/products/features/deleting_product/v1/commands/delete_product_test.go diff --git a/internal/services/catalog_read_service/test/integration/products/features/deleting_product/v1/events/product_deleted_test.go b/internal/services/catalogreadservice/test/integration/products/features/deleting_product/v1/events/product_deleted_test.go similarity index 100% rename from internal/services/catalog_read_service/test/integration/products/features/deleting_product/v1/events/product_deleted_test.go rename to internal/services/catalogreadservice/test/integration/products/features/deleting_product/v1/events/product_deleted_test.go diff --git a/internal/services/catalog_read_service/test/integration/products/features/getting_product_by_id/v1/queries/get_product_by_id_test.go b/internal/services/catalogreadservice/test/integration/products/features/getting_product_by_id/v1/queries/get_product_by_id_test.go similarity index 100% rename from internal/services/catalog_read_service/test/integration/products/features/getting_product_by_id/v1/queries/get_product_by_id_test.go rename to internal/services/catalogreadservice/test/integration/products/features/getting_product_by_id/v1/queries/get_product_by_id_test.go diff --git a/internal/services/catalog_read_service/test/integration/products/features/getting_products/v1/queries/get_products_handler_test.go b/internal/services/catalogreadservice/test/integration/products/features/getting_products/v1/queries/get_products_handler_test.go similarity index 100% rename from internal/services/catalog_read_service/test/integration/products/features/getting_products/v1/queries/get_products_handler_test.go rename to internal/services/catalogreadservice/test/integration/products/features/getting_products/v1/queries/get_products_handler_test.go diff --git a/internal/services/catalog_read_service/test/integration/products/features/updating_product/v1/commands/update_product_handler_test.go b/internal/services/catalogreadservice/test/integration/products/features/updating_product/v1/commands/update_product_handler_test.go similarity index 100% rename from internal/services/catalog_read_service/test/integration/products/features/updating_product/v1/commands/update_product_handler_test.go rename to internal/services/catalogreadservice/test/integration/products/features/updating_product/v1/commands/update_product_handler_test.go diff --git a/internal/services/catalog_read_service/test/integration/products/features/updating_product/v1/events/product_updated_test.go b/internal/services/catalogreadservice/test/integration/products/features/updating_product/v1/events/product_updated_test.go similarity index 100% rename from internal/services/catalog_read_service/test/integration/products/features/updating_product/v1/events/product_updated_test.go rename to internal/services/catalogreadservice/test/integration/products/features/updating_product/v1/events/product_updated_test.go diff --git a/internal/services/catalog_read_service/test/load_tests/.openapi-generator-ignore b/internal/services/catalogreadservice/test/load_tests/.openapi-generator-ignore similarity index 100% rename from internal/services/catalog_read_service/test/load_tests/.openapi-generator-ignore rename to internal/services/catalogreadservice/test/load_tests/.openapi-generator-ignore diff --git a/internal/services/catalog_read_service/test/load_tests/.openapi-generator/FILES b/internal/services/catalogreadservice/test/load_tests/.openapi-generator/FILES similarity index 100% rename from internal/services/catalog_read_service/test/load_tests/.openapi-generator/FILES rename to internal/services/catalogreadservice/test/load_tests/.openapi-generator/FILES diff --git a/internal/services/catalog_read_service/test/load_tests/.openapi-generator/VERSION b/internal/services/catalogreadservice/test/load_tests/.openapi-generator/VERSION similarity index 100% rename from internal/services/catalog_read_service/test/load_tests/.openapi-generator/VERSION rename to internal/services/catalogreadservice/test/load_tests/.openapi-generator/VERSION diff --git a/internal/services/catalog_read_service/test/load_tests/README.md b/internal/services/catalogreadservice/test/load_tests/README.md similarity index 100% rename from internal/services/catalog_read_service/test/load_tests/README.md rename to internal/services/catalogreadservice/test/load_tests/README.md diff --git a/internal/services/catalog_read_service/test/load_tests/script.js b/internal/services/catalogreadservice/test/load_tests/script.js similarity index 100% rename from internal/services/catalog_read_service/test/load_tests/script.js rename to internal/services/catalogreadservice/test/load_tests/script.js diff --git a/internal/services/catalog_write_service/.air.toml b/internal/services/catalogwriteservice/.air.toml similarity index 100% rename from internal/services/catalog_write_service/.air.toml rename to internal/services/catalogwriteservice/.air.toml diff --git a/internal/services/catalog_write_service/.dockerignore b/internal/services/catalogwriteservice/.dockerignore similarity index 100% rename from internal/services/catalog_write_service/.dockerignore rename to internal/services/catalogwriteservice/.dockerignore diff --git a/internal/services/catalogwriteservice/.env b/internal/services/catalogwriteservice/.env new file mode 100644 index 00000000..2e06f00a --- /dev/null +++ b/internal/services/catalogwriteservice/.env @@ -0,0 +1 @@ +PROJECT_NAME=catalogwriteservice diff --git a/internal/services/catalog_write_service/.gitignore b/internal/services/catalogwriteservice/.gitignore similarity index 100% rename from internal/services/catalog_write_service/.gitignore rename to internal/services/catalogwriteservice/.gitignore diff --git a/internal/services/catalog_write_service/.golangci.yml b/internal/services/catalogwriteservice/.golangci.yml similarity index 100% rename from internal/services/catalog_write_service/.golangci.yml rename to internal/services/catalogwriteservice/.golangci.yml diff --git a/internal/services/catalog_write_service/Dockerfile b/internal/services/catalogwriteservice/Dockerfile similarity index 100% rename from internal/services/catalog_write_service/Dockerfile rename to internal/services/catalogwriteservice/Dockerfile diff --git a/internal/services/catalog_write_service/Makefile b/internal/services/catalogwriteservice/Makefile similarity index 100% rename from internal/services/catalog_write_service/Makefile rename to internal/services/catalogwriteservice/Makefile diff --git a/internal/services/catalog_write_service/arch-go.yml b/internal/services/catalogwriteservice/arch-go.yml similarity index 100% rename from internal/services/catalog_write_service/arch-go.yml rename to internal/services/catalogwriteservice/arch-go.yml diff --git a/internal/services/catalog_write_service/atlas.hcl b/internal/services/catalogwriteservice/atlas.hcl similarity index 100% rename from internal/services/catalog_write_service/atlas.hcl rename to internal/services/catalogwriteservice/atlas.hcl diff --git a/internal/services/catalog_write_service/client.http b/internal/services/catalogwriteservice/client.http similarity index 100% rename from internal/services/catalog_write_service/client.http rename to internal/services/catalogwriteservice/client.http diff --git a/internal/services/catalog_write_service/cmd/app/main.go b/internal/services/catalogwriteservice/cmd/app/main.go similarity index 100% rename from internal/services/catalog_write_service/cmd/app/main.go rename to internal/services/catalogwriteservice/cmd/app/main.go diff --git a/internal/services/catalog_write_service/cmd/migration/main.go b/internal/services/catalogwriteservice/cmd/migration/main.go similarity index 100% rename from internal/services/catalog_write_service/cmd/migration/main.go rename to internal/services/catalogwriteservice/cmd/migration/main.go diff --git a/internal/services/catalog_write_service/config/app_options.go b/internal/services/catalogwriteservice/config/app_options.go similarity index 100% rename from internal/services/catalog_write_service/config/app_options.go rename to internal/services/catalogwriteservice/config/app_options.go diff --git a/internal/services/catalog_write_service/config/config.development.json b/internal/services/catalogwriteservice/config/config.development.json similarity index 95% rename from internal/services/catalog_write_service/config/config.development.json rename to internal/services/catalogwriteservice/config/config.development.json index f3719637..bcdc2233 100644 --- a/internal/services/catalog_write_service/config/config.development.json +++ b/internal/services/catalogwriteservice/config/config.development.json @@ -1,16 +1,16 @@ { "appOptions": { - "serviceName": "catalogs_write_service", + "serviceName": "catalogwriteservice", "deliveryType": "http" }, "grpcOptions": { - "name": "catalogs_write_service", + "name": "catalogwriteservice", "port": ":6003", "host": "localhost", "development": true }, "echoHttpOptions": { - "name": "catalogs_write_service", + "name": "catalogwriteservice", "port": ":7000", "development": true, "timeout": 30, diff --git a/internal/services/catalog_write_service/config/config.test.json b/internal/services/catalogwriteservice/config/config.test.json similarity index 94% rename from internal/services/catalog_write_service/config/config.test.json rename to internal/services/catalogwriteservice/config/config.test.json index a3bbbe20..8de7c47b 100644 --- a/internal/services/catalog_write_service/config/config.test.json +++ b/internal/services/catalogwriteservice/config/config.test.json @@ -1,16 +1,16 @@ { "appOptions": { - "serviceName": "catalogs_write_service", + "serviceName": "catalogwriteservice", "deliveryType": "http" }, "grpcOptions": { - "name": "catalogs_write_service", + "name": "catalogwriteservice", "port": ":3301", "host": "localhost", "development": true }, "echoHttpOptions": { - "name": "catalogs_write_service", + "name": "catalogwriteservice", "port": ":6001", "development": true, "timeout": 30, diff --git a/internal/services/catalog_write_service/config/config_fx.go b/internal/services/catalogwriteservice/config/config_fx.go similarity index 100% rename from internal/services/catalog_write_service/config/config_fx.go rename to internal/services/catalogwriteservice/config/config_fx.go diff --git a/internal/services/catalog_write_service/db/fixtures/products/products.yaml b/internal/services/catalogwriteservice/db/fixtures/products/products.yaml similarity index 100% rename from internal/services/catalog_write_service/db/fixtures/products/products.yaml rename to internal/services/catalogwriteservice/db/fixtures/products/products.yaml diff --git a/internal/services/catalog_write_service/db/migrations/atlas/20230919170700.sql b/internal/services/catalogwriteservice/db/migrations/atlas/20230919170700.sql similarity index 100% rename from internal/services/catalog_write_service/db/migrations/atlas/20230919170700.sql rename to internal/services/catalogwriteservice/db/migrations/atlas/20230919170700.sql diff --git a/internal/services/catalog_write_service/db/migrations/atlas/atlas.sum b/internal/services/catalogwriteservice/db/migrations/atlas/atlas.sum similarity index 100% rename from internal/services/catalog_write_service/db/migrations/atlas/atlas.sum rename to internal/services/catalogwriteservice/db/migrations/atlas/atlas.sum diff --git a/internal/services/catalog_write_service/db/migrations/atlas/goose/00001_enable_uuid_extension.sql b/internal/services/catalogwriteservice/db/migrations/atlas/goose/00001_enable_uuid_extension.sql similarity index 100% rename from internal/services/catalog_write_service/db/migrations/atlas/goose/00001_enable_uuid_extension.sql rename to internal/services/catalogwriteservice/db/migrations/atlas/goose/00001_enable_uuid_extension.sql diff --git a/internal/services/catalog_write_service/db/migrations/atlas/goose/00002_create_products_table.sql b/internal/services/catalogwriteservice/db/migrations/atlas/goose/00002_create_products_table.sql similarity index 100% rename from internal/services/catalog_write_service/db/migrations/atlas/goose/00002_create_products_table.sql rename to internal/services/catalogwriteservice/db/migrations/atlas/goose/00002_create_products_table.sql diff --git a/internal/services/catalog_write_service/db/migrations/atlas/goose/atlas.sum b/internal/services/catalogwriteservice/db/migrations/atlas/goose/atlas.sum similarity index 100% rename from internal/services/catalog_write_service/db/migrations/atlas/goose/atlas.sum rename to internal/services/catalogwriteservice/db/migrations/atlas/goose/atlas.sum diff --git a/internal/services/catalog_write_service/db/migrations/atlas/readme.md b/internal/services/catalogwriteservice/db/migrations/atlas/readme.md similarity index 100% rename from internal/services/catalog_write_service/db/migrations/atlas/readme.md rename to internal/services/catalogwriteservice/db/migrations/atlas/readme.md diff --git a/internal/services/catalog_write_service/db/migrations/go-migrate/000001_enable_uuid_extension.down.sql b/internal/services/catalogwriteservice/db/migrations/go-migrate/000001_enable_uuid_extension.down.sql similarity index 100% rename from internal/services/catalog_write_service/db/migrations/go-migrate/000001_enable_uuid_extension.down.sql rename to internal/services/catalogwriteservice/db/migrations/go-migrate/000001_enable_uuid_extension.down.sql diff --git a/internal/services/catalog_write_service/db/migrations/go-migrate/000001_enable_uuid_extension.up.sql b/internal/services/catalogwriteservice/db/migrations/go-migrate/000001_enable_uuid_extension.up.sql similarity index 100% rename from internal/services/catalog_write_service/db/migrations/go-migrate/000001_enable_uuid_extension.up.sql rename to internal/services/catalogwriteservice/db/migrations/go-migrate/000001_enable_uuid_extension.up.sql diff --git a/internal/services/catalog_write_service/db/migrations/go-migrate/000002_create_products_table.down.sql b/internal/services/catalogwriteservice/db/migrations/go-migrate/000002_create_products_table.down.sql similarity index 100% rename from internal/services/catalog_write_service/db/migrations/go-migrate/000002_create_products_table.down.sql rename to internal/services/catalogwriteservice/db/migrations/go-migrate/000002_create_products_table.down.sql diff --git a/internal/services/catalog_write_service/db/migrations/go-migrate/000002_create_products_table.up.sql b/internal/services/catalogwriteservice/db/migrations/go-migrate/000002_create_products_table.up.sql similarity index 100% rename from internal/services/catalog_write_service/db/migrations/go-migrate/000002_create_products_table.up.sql rename to internal/services/catalogwriteservice/db/migrations/go-migrate/000002_create_products_table.up.sql diff --git a/internal/services/catalog_write_service/db/migrations/go-migrate/atlas.sum b/internal/services/catalogwriteservice/db/migrations/go-migrate/atlas.sum similarity index 100% rename from internal/services/catalog_write_service/db/migrations/go-migrate/atlas.sum rename to internal/services/catalogwriteservice/db/migrations/go-migrate/atlas.sum diff --git a/internal/services/catalog_write_service/db/migrations/go-migrate/readme.md b/internal/services/catalogwriteservice/db/migrations/go-migrate/readme.md similarity index 100% rename from internal/services/catalog_write_service/db/migrations/go-migrate/readme.md rename to internal/services/catalogwriteservice/db/migrations/go-migrate/readme.md diff --git a/internal/services/catalog_write_service/db/migrations/go-migrate/schema.sql b/internal/services/catalogwriteservice/db/migrations/go-migrate/schema.sql similarity index 100% rename from internal/services/catalog_write_service/db/migrations/go-migrate/schema.sql rename to internal/services/catalogwriteservice/db/migrations/go-migrate/schema.sql diff --git a/internal/services/catalog_write_service/db/migrations/goose-migrate/00001_enable_uuid_extension.sql b/internal/services/catalogwriteservice/db/migrations/goose-migrate/00001_enable_uuid_extension.sql similarity index 100% rename from internal/services/catalog_write_service/db/migrations/goose-migrate/00001_enable_uuid_extension.sql rename to internal/services/catalogwriteservice/db/migrations/goose-migrate/00001_enable_uuid_extension.sql diff --git a/internal/services/catalog_write_service/db/migrations/goose-migrate/00002_create_products_table.sql b/internal/services/catalogwriteservice/db/migrations/goose-migrate/00002_create_products_table.sql similarity index 100% rename from internal/services/catalog_write_service/db/migrations/goose-migrate/00002_create_products_table.sql rename to internal/services/catalogwriteservice/db/migrations/goose-migrate/00002_create_products_table.sql diff --git a/internal/services/catalog_write_service/db/migrations/goose-migrate/readme.md b/internal/services/catalogwriteservice/db/migrations/goose-migrate/readme.md similarity index 100% rename from internal/services/catalog_write_service/db/migrations/goose-migrate/readme.md rename to internal/services/catalogwriteservice/db/migrations/goose-migrate/readme.md diff --git a/internal/services/catalog_write_service/docs/docs.go b/internal/services/catalogwriteservice/docs/docs.go similarity index 100% rename from internal/services/catalog_write_service/docs/docs.go rename to internal/services/catalogwriteservice/docs/docs.go diff --git a/internal/services/catalog_write_service/docs/swagger.json b/internal/services/catalogwriteservice/docs/swagger.json similarity index 100% rename from internal/services/catalog_write_service/docs/swagger.json rename to internal/services/catalogwriteservice/docs/swagger.json diff --git a/internal/services/catalog_write_service/docs/swagger.yaml b/internal/services/catalogwriteservice/docs/swagger.yaml similarity index 100% rename from internal/services/catalog_write_service/docs/swagger.yaml rename to internal/services/catalogwriteservice/docs/swagger.yaml diff --git a/internal/services/catalog_write_service/go.mod b/internal/services/catalogwriteservice/go.mod similarity index 100% rename from internal/services/catalog_write_service/go.mod rename to internal/services/catalogwriteservice/go.mod diff --git a/internal/services/catalog_write_service/go.sum b/internal/services/catalogwriteservice/go.sum similarity index 100% rename from internal/services/catalog_write_service/go.sum rename to internal/services/catalogwriteservice/go.sum diff --git a/internal/services/catalog_write_service/internal/products/configurations/endpoints/endpoints.go b/internal/services/catalogwriteservice/internal/products/configurations/endpoints/endpoints.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/configurations/endpoints/endpoints.go rename to internal/services/catalogwriteservice/internal/products/configurations/endpoints/endpoints.go diff --git a/internal/services/catalog_write_service/internal/products/configurations/mappings/mapping_profile.go b/internal/services/catalogwriteservice/internal/products/configurations/mappings/mapping_profile.go similarity index 97% rename from internal/services/catalog_write_service/internal/products/configurations/mappings/mapping_profile.go rename to internal/services/catalogwriteservice/internal/products/configurations/mappings/mapping_profile.go index 466cee39..b3f47b90 100644 --- a/internal/services/catalog_write_service/internal/products/configurations/mappings/mapping_profile.go +++ b/internal/services/catalogwriteservice/internal/products/configurations/mappings/mapping_profile.go @@ -53,7 +53,7 @@ func ConfigureProductsMappings() error { err = mapper.CreateCustomMap( func(product *models.Product) *productsService.Product { return &productsService.Product{ - ProductId: product.ProductId.String(), + ProductId: product.Id.String(), Name: product.Name, Description: product.Description, Price: product.Price, diff --git a/internal/services/catalog_write_service/internal/products/configurations/mediator/mediator.go b/internal/services/catalogwriteservice/internal/products/configurations/mediator/mediator.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/configurations/mediator/mediator.go rename to internal/services/catalogwriteservice/internal/products/configurations/mediator/mediator.go diff --git a/internal/services/catalog_write_service/internal/products/configurations/products_module_configurator.go b/internal/services/catalogwriteservice/internal/products/configurations/products_module_configurator.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/configurations/products_module_configurator.go rename to internal/services/catalogwriteservice/internal/products/configurations/products_module_configurator.go diff --git a/internal/services/catalog_write_service/internal/products/configurations/rabbitmq/rabbitmq_configurations.go b/internal/services/catalogwriteservice/internal/products/configurations/rabbitmq/rabbitmq_configurations.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/configurations/rabbitmq/rabbitmq_configurations.go rename to internal/services/catalogwriteservice/internal/products/configurations/rabbitmq/rabbitmq_configurations.go diff --git a/internal/services/catalog_write_service/internal/products/contracts/product_repository.go b/internal/services/catalogwriteservice/internal/products/contracts/product_repository.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/contracts/product_repository.go rename to internal/services/catalogwriteservice/internal/products/contracts/product_repository.go diff --git a/internal/services/catalog_write_service/internal/products/data/models/product_data_model.go b/internal/services/catalogwriteservice/internal/products/data/models/product_data_model.go similarity index 56% rename from internal/services/catalog_write_service/internal/products/data/models/product_data_model.go rename to internal/services/catalogwriteservice/internal/products/data/models/product_data_model.go index a11b22a0..5b3281c4 100644 --- a/internal/services/catalog_write_service/internal/products/data/models/product_data_model.go +++ b/internal/services/catalogwriteservice/internal/products/data/models/product_data_model.go @@ -13,17 +13,17 @@ import ( // ProductDataModel data model type ProductDataModel struct { - gorm.Model - ProductId uuid.UUID `json:"productId" gorm:"primaryKey"` - Name string `json:"name"` - Description string `json:"description"` - Price float64 `json:"price"` - CreatedAt time.Time `json:"createdAt" gorm:"default:current_timestamp"` - UpdatedAt time.Time `json:"updatedAt"` + Id uuid.UUID `gorm:"primaryKey"` + Name string + Description string + Price float64 + CreatedAt time.Time `gorm:"default:current_timestamp"` + UpdatedAt time.Time + // for soft delete - https://gorm.io/docs/delete.html#Soft-Delete + gorm.DeletedAt } -// https://gorm.io/docs/conventions.html#TableName -// TableName overrides the table name used by ProductDataModel to `products` +// TableName overrides the table name used by ProductDataModel to `products` - https://gorm.io/docs/conventions.html#TableName func (p *ProductDataModel) TableName() string { return "products" } diff --git a/internal/services/catalog_write_service/internal/products/data/repositories/pg_product_repository.go b/internal/services/catalogwriteservice/internal/products/data/repositories/pg_product_repository.go similarity index 92% rename from internal/services/catalog_write_service/internal/products/data/repositories/pg_product_repository.go rename to internal/services/catalogwriteservice/internal/products/data/repositories/pg_product_repository.go index 5c7462c7..9d3294fd 100644 --- a/internal/services/catalog_write_service/internal/products/data/repositories/pg_product_repository.go +++ b/internal/services/catalogwriteservice/internal/products/data/repositories/pg_product_repository.go @@ -107,7 +107,7 @@ func (p *postgresProductRepository) GetProductById( uuid uuid.UUID, ) (*models.Product, error) { ctx, span := p.tracer.Start(ctx, "postgresProductRepository.GetProductById") - span.SetAttributes(attribute2.String("ProductId", uuid.String())) + span.SetAttributes(attribute2.String("Id", uuid.String())) defer span.End() product, err := p.gormGenericRepository.GetById(ctx, uuid) @@ -132,7 +132,7 @@ func (p *postgresProductRepository) GetProductById( "product with id %s laoded", uuid.String(), ), - logger.Fields{"Product": product, "ProductId": uuid}, + logger.Fields{"Product": product, "Id": uuid}, ) return product, nil @@ -161,9 +161,9 @@ func (p *postgresProductRepository) CreateProduct( p.log.Infow( fmt.Sprintf( "product with id '%s' created", - product.ProductId, + product.Id, ), - logger.Fields{"Product": product, "ProductId": product.ProductId}, + logger.Fields{"Product": product, "Id": product.Id}, ) return product, nil @@ -183,7 +183,7 @@ func (p *postgresProductRepository) UpdateProduct( err, fmt.Sprintf( "error in updating product with id %s into the database.", - updateProduct.ProductId, + updateProduct.Id, ), ), ) @@ -196,11 +196,11 @@ func (p *postgresProductRepository) UpdateProduct( p.log.Infow( fmt.Sprintf( "product with id '%s' updated", - updateProduct.ProductId, + updateProduct.Id, ), logger.Fields{ - "Product": updateProduct, - "ProductId": updateProduct.ProductId, + "Product": updateProduct, + "Id": updateProduct.Id, }, ) @@ -212,7 +212,7 @@ func (p *postgresProductRepository) DeleteProductByID( uuid uuid.UUID, ) error { ctx, span := p.tracer.Start(ctx, "postgresProductRepository.UpdateProduct") - span.SetAttributes(attribute2.String("ProductId", uuid.String())) + span.SetAttributes(attribute2.String("Id", uuid.String())) defer span.End() err := p.gormGenericRepository.Delete(ctx, uuid) diff --git a/internal/services/catalog_write_service/internal/products/dtos/v1/fxparams/product_handler_params.go b/internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams/product_handler_params.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/dtos/v1/fxparams/product_handler_params.go rename to internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams/product_handler_params.go diff --git a/internal/services/catalog_write_service/internal/products/dtos/v1/fxparams/product_route_params.go b/internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams/product_route_params.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/dtos/v1/fxparams/product_route_params.go rename to internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams/product_route_params.go diff --git a/internal/services/catalog_write_service/internal/products/dtos/v1/product_dto.go b/internal/services/catalogwriteservice/internal/products/dtos/v1/product_dto.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/dtos/v1/product_dto.go rename to internal/services/catalogwriteservice/internal/products/dtos/v1/product_dto.go diff --git a/internal/services/catalog_write_service/internal/products/features/creatingproduct/v1/create_product.go b/internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/create_product.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/creatingproduct/v1/create_product.go rename to internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/create_product.go diff --git a/internal/services/catalog_write_service/internal/products/features/creatingproduct/v1/create_product_endpoint.go b/internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/create_product_endpoint.go similarity index 97% rename from internal/services/catalog_write_service/internal/products/features/creatingproduct/v1/create_product_endpoint.go rename to internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/create_product_endpoint.go index 99ebdceb..e5328a11 100644 --- a/internal/services/catalog_write_service/internal/products/features/creatingproduct/v1/create_product_endpoint.go +++ b/internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/create_product_endpoint.go @@ -4,7 +4,7 @@ import ( "net/http" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/web/route" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/dtos" diff --git a/internal/services/catalog_write_service/internal/products/features/creatingproduct/v1/create_product_handler.go b/internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/create_product_handler.go similarity index 95% rename from internal/services/catalog_write_service/internal/products/features/creatingproduct/v1/create_product_handler.go rename to internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/create_product_handler.go index 9f39d665..d562fcd1 100644 --- a/internal/services/catalog_write_service/internal/products/features/creatingproduct/v1/create_product_handler.go +++ b/internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/create_product_handler.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/cqrs" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" dtosv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1" @@ -40,7 +40,7 @@ func (c *createProductHandler) Handle( command *CreateProduct, ) (*dtos.CreateProductResponseDto, error) { product := &models.Product{ - ProductId: command.ProductID, + Id: command.ProductID, Name: command.Name, Description: command.Description, Price: command.Price, @@ -83,7 +83,7 @@ func (c *createProductHandler) Handle( ) createProductResult = &dtos.CreateProductResponseDto{ - ProductID: product.ProductId, + ProductID: product.Id, } c.Log.Infow( @@ -92,7 +92,7 @@ func (c *createProductHandler) Handle( command.ProductID, ), logger.Fields{ - "ProductId": command.ProductID, + "Id": command.ProductID, "MessageId": productCreated.MessageId, }, ) diff --git a/internal/services/catalog_write_service/internal/products/features/creatingproduct/v1/dtos/create_product_request_dto.go b/internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/dtos/create_product_request_dto.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/creatingproduct/v1/dtos/create_product_request_dto.go rename to internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/dtos/create_product_request_dto.go diff --git a/internal/services/catalog_write_service/internal/products/features/creatingproduct/v1/dtos/create_product_response_dto.go b/internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/dtos/create_product_response_dto.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/creatingproduct/v1/dtos/create_product_response_dto.go rename to internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/dtos/create_product_response_dto.go diff --git a/internal/services/catalog_write_service/internal/products/features/creatingproduct/v1/events/domainevents/.gitkeep b/internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/events/domainevents/.gitkeep similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/creatingproduct/v1/events/domainevents/.gitkeep rename to internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/events/domainevents/.gitkeep diff --git a/internal/services/catalog_write_service/internal/products/features/creatingproduct/v1/events/integrationevents/product_created.go b/internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/events/integrationevents/product_created.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/creatingproduct/v1/events/integrationevents/product_created.go rename to internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1/events/integrationevents/product_created.go diff --git a/internal/services/catalog_write_service/internal/products/features/deletingproduct/v1/delete_product.go b/internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1/delete_product.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/deletingproduct/v1/delete_product.go rename to internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1/delete_product.go diff --git a/internal/services/catalog_write_service/internal/products/features/deletingproduct/v1/delete_product_endpoint.go b/internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1/delete_product_endpoint.go similarity index 97% rename from internal/services/catalog_write_service/internal/products/features/deletingproduct/v1/delete_product_endpoint.go rename to internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1/delete_product_endpoint.go index 9fc67d00..20ea8e86 100644 --- a/internal/services/catalog_write_service/internal/products/features/deletingproduct/v1/delete_product_endpoint.go +++ b/internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1/delete_product_endpoint.go @@ -4,7 +4,7 @@ import ( "net/http" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/web/route" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1/dtos" diff --git a/internal/services/catalog_write_service/internal/products/features/deletingproduct/v1/delete_product_handler.go b/internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1/delete_product_handler.go similarity index 95% rename from internal/services/catalog_write_service/internal/products/features/deletingproduct/v1/delete_product_handler.go rename to internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1/delete_product_handler.go index 34ed91d6..716a6a85 100644 --- a/internal/services/catalog_write_service/internal/products/features/deletingproduct/v1/delete_product_handler.go +++ b/internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1/delete_product_handler.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/cqrs" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams" integrationEvents "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1/events/integrationevents" @@ -69,7 +69,7 @@ func (c *deleteProductHandler) Handle( "product with id '%s' deleted", command.ProductID, ), - logger.Fields{"ProductId": command.ProductID}, + logger.Fields{"Id": command.ProductID}, ) return &mediatr.Unit{}, err diff --git a/internal/services/catalog_write_service/internal/products/features/deletingproduct/v1/dtos/delete_product_request_dto.go b/internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1/dtos/delete_product_request_dto.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/deletingproduct/v1/dtos/delete_product_request_dto.go rename to internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1/dtos/delete_product_request_dto.go diff --git a/internal/services/catalog_write_service/internal/products/features/deletingproduct/v1/events/integrationevents/product_deleted.go b/internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1/events/integrationevents/product_deleted.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/deletingproduct/v1/events/integrationevents/product_deleted.go rename to internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1/events/integrationevents/product_deleted.go diff --git a/internal/services/catalog_write_service/internal/products/features/gettingproductbyid/v1/dtos/get_product_by_id_request_dto.go b/internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1/dtos/get_product_by_id_request_dto.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/gettingproductbyid/v1/dtos/get_product_by_id_request_dto.go rename to internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1/dtos/get_product_by_id_request_dto.go diff --git a/internal/services/catalog_write_service/internal/products/features/gettingproductbyid/v1/dtos/get_product_by_id_response_dto.go b/internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1/dtos/get_product_by_id_response_dto.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/gettingproductbyid/v1/dtos/get_product_by_id_response_dto.go rename to internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1/dtos/get_product_by_id_response_dto.go diff --git a/internal/services/catalog_write_service/internal/products/features/gettingproductbyid/v1/get_product_by_id.go b/internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1/get_product_by_id.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/gettingproductbyid/v1/get_product_by_id.go rename to internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1/get_product_by_id.go diff --git a/internal/services/catalog_write_service/internal/products/features/gettingproductbyid/v1/get_product_by_id_endpoint.go b/internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1/get_product_by_id_endpoint.go similarity index 97% rename from internal/services/catalog_write_service/internal/products/features/gettingproductbyid/v1/get_product_by_id_endpoint.go rename to internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1/get_product_by_id_endpoint.go index 32f8337b..da25eeff 100644 --- a/internal/services/catalog_write_service/internal/products/features/gettingproductbyid/v1/get_product_by_id_endpoint.go +++ b/internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1/get_product_by_id_endpoint.go @@ -4,7 +4,7 @@ import ( "net/http" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/web/route" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1/dtos" diff --git a/internal/services/catalog_write_service/internal/products/features/gettingproductbyid/v1/get_product_by_id_handler.go b/internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1/get_product_by_id_handler.go similarity index 94% rename from internal/services/catalog_write_service/internal/products/features/gettingproductbyid/v1/get_product_by_id_handler.go rename to internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1/get_product_by_id_handler.go index 36b821cb..ac915b5a 100644 --- a/internal/services/catalog_write_service/internal/products/features/gettingproductbyid/v1/get_product_by_id_handler.go +++ b/internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1/get_product_by_id_handler.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/cqrs" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" dtoV1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1" @@ -55,7 +55,7 @@ func (c *GetProductByIDHandler) Handle( "product with id: {%s} fetched", query.ProductID, ), - logger.Fields{"ProductId": query.ProductID.String()}, + logger.Fields{"Id": query.ProductID.String()}, ) return &dtos.GetProductByIdResponseDto{Product: productDto}, nil diff --git a/internal/services/catalog_write_service/internal/products/features/getting_products/v1/dtos/get_products_request_dto.go b/internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1/dtos/get_products_request_dto.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/getting_products/v1/dtos/get_products_request_dto.go rename to internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1/dtos/get_products_request_dto.go diff --git a/internal/services/catalog_write_service/internal/products/features/getting_products/v1/dtos/get_products_response_dto.go b/internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1/dtos/get_products_response_dto.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/getting_products/v1/dtos/get_products_response_dto.go rename to internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1/dtos/get_products_response_dto.go diff --git a/internal/services/catalog_write_service/internal/products/features/getting_products/v1/get_products.go b/internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1/get_products.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/getting_products/v1/get_products.go rename to internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1/get_products.go diff --git a/internal/services/catalog_write_service/internal/products/features/getting_products/v1/get_products_endpoint.go b/internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1/get_products_endpoint.go similarity index 94% rename from internal/services/catalog_write_service/internal/products/features/getting_products/v1/get_products_endpoint.go rename to internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1/get_products_endpoint.go index d1f3a701..272d0228 100644 --- a/internal/services/catalog_write_service/internal/products/features/getting_products/v1/get_products_endpoint.go +++ b/internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1/get_products_endpoint.go @@ -4,10 +4,10 @@ import ( "net/http" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/web/route" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/getting_products/v1/dtos" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1/dtos" "emperror.dev/errors" "github.com/labstack/echo/v4" diff --git a/internal/services/catalog_write_service/internal/products/features/getting_products/v1/get_products_handler.go b/internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1/get_products_handler.go similarity index 89% rename from internal/services/catalog_write_service/internal/products/features/getting_products/v1/get_products_handler.go rename to internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1/get_products_handler.go index 352498e6..5c5c2499 100644 --- a/internal/services/catalog_write_service/internal/products/features/getting_products/v1/get_products_handler.go +++ b/internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1/get_products_handler.go @@ -4,13 +4,13 @@ import ( "context" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/cqrs" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm/helpers" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" datamodel "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/data/models" dtosv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/getting_products/v1/dtos" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1/dtos" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/models" "github.com/mehdihadeli/go-mediatr" @@ -38,7 +38,7 @@ func (c *getProductsHandler) Handle( ctx context.Context, query *GetProducts, ) (*dtos.GetProductsResponseDto, error) { - products, err := postgresgorm.Paginate[*datamodel.ProductDataModel, *models.Product]( + products, err := helpers.Paginate[*datamodel.ProductDataModel, *models.Product]( ctx, query.ListQuery, c.CatalogsDBContext.DB, diff --git a/internal/services/catalog_write_service/internal/products/features/searchingproduct/v1/dtos/search_products_request_dto.go b/internal/services/catalogwriteservice/internal/products/features/searchingproduct/v1/dtos/search_products_request_dto.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/searchingproduct/v1/dtos/search_products_request_dto.go rename to internal/services/catalogwriteservice/internal/products/features/searchingproduct/v1/dtos/search_products_request_dto.go diff --git a/internal/services/catalog_write_service/internal/products/features/searchingproduct/v1/dtos/search_products_response_dto.go b/internal/services/catalogwriteservice/internal/products/features/searchingproduct/v1/dtos/search_products_response_dto.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/searchingproduct/v1/dtos/search_products_response_dto.go rename to internal/services/catalogwriteservice/internal/products/features/searchingproduct/v1/dtos/search_products_response_dto.go diff --git a/internal/services/catalog_write_service/internal/products/features/searchingproduct/v1/search_products.go b/internal/services/catalogwriteservice/internal/products/features/searchingproduct/v1/search_products.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/searchingproduct/v1/search_products.go rename to internal/services/catalogwriteservice/internal/products/features/searchingproduct/v1/search_products.go diff --git a/internal/services/catalog_write_service/internal/products/features/searchingproduct/v1/search_products_endpoint.go b/internal/services/catalogwriteservice/internal/products/features/searchingproduct/v1/search_products_endpoint.go similarity index 98% rename from internal/services/catalog_write_service/internal/products/features/searchingproduct/v1/search_products_endpoint.go rename to internal/services/catalogwriteservice/internal/products/features/searchingproduct/v1/search_products_endpoint.go index 75ffefeb..e4db7d5d 100644 --- a/internal/services/catalog_write_service/internal/products/features/searchingproduct/v1/search_products_endpoint.go +++ b/internal/services/catalogwriteservice/internal/products/features/searchingproduct/v1/search_products_endpoint.go @@ -4,7 +4,7 @@ import ( "net/http" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/web/route" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/searchingproduct/v1/dtos" diff --git a/internal/services/catalog_write_service/internal/products/features/searchingproduct/v1/search_products_handler.go b/internal/services/catalogwriteservice/internal/products/features/searchingproduct/v1/search_products_handler.go similarity index 97% rename from internal/services/catalog_write_service/internal/products/features/searchingproduct/v1/search_products_handler.go rename to internal/services/catalogwriteservice/internal/products/features/searchingproduct/v1/search_products_handler.go index 0547b99b..0970c9f7 100644 --- a/internal/services/catalog_write_service/internal/products/features/searchingproduct/v1/search_products_handler.go +++ b/internal/services/catalogwriteservice/internal/products/features/searchingproduct/v1/search_products_handler.go @@ -7,8 +7,8 @@ import ( "strings" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/cqrs" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" - gormPostgres "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" + gormPostgres "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm/helpers" reflectionHelper "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/reflection/reflectionhelper" typeMapper "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/reflection/typemapper" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" diff --git a/internal/services/catalog_write_service/internal/products/features/updatingproduct/v1/dtos/update_product_request_dto.go b/internal/services/catalogwriteservice/internal/products/features/updatingproduct/v1/dtos/update_product_request_dto.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/updatingproduct/v1/dtos/update_product_request_dto.go rename to internal/services/catalogwriteservice/internal/products/features/updatingproduct/v1/dtos/update_product_request_dto.go diff --git a/internal/services/catalog_write_service/internal/products/features/updatingproduct/v1/events/integrationevents/product_updated.go b/internal/services/catalogwriteservice/internal/products/features/updatingproduct/v1/events/integrationevents/product_updated.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/updatingproduct/v1/events/integrationevents/product_updated.go rename to internal/services/catalogwriteservice/internal/products/features/updatingproduct/v1/events/integrationevents/product_updated.go diff --git a/internal/services/catalog_write_service/internal/products/features/updatingproduct/v1/update_product.go b/internal/services/catalogwriteservice/internal/products/features/updatingproduct/v1/update_product.go similarity index 100% rename from internal/services/catalog_write_service/internal/products/features/updatingproduct/v1/update_product.go rename to internal/services/catalogwriteservice/internal/products/features/updatingproduct/v1/update_product.go diff --git a/internal/services/catalog_write_service/internal/products/features/updatingproduct/v1/update_product_endpoint.go b/internal/services/catalogwriteservice/internal/products/features/updatingproduct/v1/update_product_endpoint.go similarity index 97% rename from internal/services/catalog_write_service/internal/products/features/updatingproduct/v1/update_product_endpoint.go rename to internal/services/catalogwriteservice/internal/products/features/updatingproduct/v1/update_product_endpoint.go index 452147c7..f036de7b 100644 --- a/internal/services/catalog_write_service/internal/products/features/updatingproduct/v1/update_product_endpoint.go +++ b/internal/services/catalogwriteservice/internal/products/features/updatingproduct/v1/update_product_endpoint.go @@ -4,7 +4,7 @@ import ( "net/http" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/web/route" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/updatingproduct/v1/dtos" diff --git a/internal/services/catalog_write_service/internal/products/features/updatingproduct/v1/update_product_handler.go b/internal/services/catalogwriteservice/internal/products/features/updatingproduct/v1/update_product_handler.go similarity index 96% rename from internal/services/catalog_write_service/internal/products/features/updatingproduct/v1/update_product_handler.go rename to internal/services/catalogwriteservice/internal/products/features/updatingproduct/v1/update_product_handler.go index 3b02fcaa..b10819c1 100644 --- a/internal/services/catalog_write_service/internal/products/features/updatingproduct/v1/update_product_handler.go +++ b/internal/services/catalogwriteservice/internal/products/features/updatingproduct/v1/update_product_handler.go @@ -6,7 +6,7 @@ import ( "net/http" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/cqrs" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" dto "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1" @@ -92,7 +92,7 @@ func (c *updateProductHandler) Handle( "product with id '%s' updated", command.ProductID, ), - logger.Fields{"ProductId": command.ProductID}, + logger.Fields{"Id": command.ProductID}, ) c.Log.Infow( diff --git a/internal/services/catalog_write_service/internal/products/models/product.go b/internal/services/catalogwriteservice/internal/products/models/product.go similarity index 90% rename from internal/services/catalog_write_service/internal/products/models/product.go rename to internal/services/catalogwriteservice/internal/products/models/product.go index a7251bb9..913c5a7a 100644 --- a/internal/services/catalog_write_service/internal/products/models/product.go +++ b/internal/services/catalogwriteservice/internal/products/models/product.go @@ -8,7 +8,7 @@ import ( // Product model type Product struct { - ProductId uuid.UUID + Id uuid.UUID Name string Description string Price float64 diff --git a/internal/services/catalog_write_service/internal/products/products_fx.go b/internal/services/catalogwriteservice/internal/products/products_fx.go similarity index 98% rename from internal/services/catalog_write_service/internal/products/products_fx.go rename to internal/services/catalogwriteservice/internal/products/products_fx.go index 19839f9c..72bde291 100644 --- a/internal/services/catalog_write_service/internal/products/products_fx.go +++ b/internal/services/catalogwriteservice/internal/products/products_fx.go @@ -3,12 +3,12 @@ package products import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/cqrs" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/web/route" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/contracts" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/contracts" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/data/repositories" creatingproductv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1" deletingproductv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1" - gettingproductsv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/getting_products/v1" gettingproductbyidv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1" + gettingproductsv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1" searchingproductsv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/searchingproduct/v1" updatingoroductsv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/updatingproduct/v1" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/shared/grpc" diff --git a/internal/services/catalog_write_service/internal/shared/app/app.go b/internal/services/catalogwriteservice/internal/shared/app/app.go similarity index 100% rename from internal/services/catalog_write_service/internal/shared/app/app.go rename to internal/services/catalogwriteservice/internal/shared/app/app.go diff --git a/internal/services/catalog_write_service/internal/shared/app/application.go b/internal/services/catalogwriteservice/internal/shared/app/application.go similarity index 100% rename from internal/services/catalog_write_service/internal/shared/app/application.go rename to internal/services/catalogwriteservice/internal/shared/app/application.go diff --git a/internal/services/catalog_write_service/internal/shared/app/application_builder.go b/internal/services/catalogwriteservice/internal/shared/app/application_builder.go similarity index 100% rename from internal/services/catalog_write_service/internal/shared/app/application_builder.go rename to internal/services/catalogwriteservice/internal/shared/app/application_builder.go diff --git a/internal/services/catalog_write_service/internal/shared/app/test/test_app.go b/internal/services/catalogwriteservice/internal/shared/app/test/test_app.go similarity index 96% rename from internal/services/catalog_write_service/internal/shared/app/test/test_app.go rename to internal/services/catalogwriteservice/internal/shared/app/test/test_app.go index 7e84e89f..096cb737 100644 --- a/internal/services/catalog_write_service/internal/shared/app/test/test_app.go +++ b/internal/services/catalogwriteservice/internal/shared/app/test/test_app.go @@ -8,7 +8,7 @@ import ( fxcontracts "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/fxapp/contracts" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/grpc" - config3 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/config" + config3 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/config" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" contracts2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/migration/contracts" gormPostgres "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm" @@ -62,12 +62,12 @@ func (a *TestApp) Run(t *testing.T) (result *TestAppResult) { err := testApp.ConfigureCatalogs() if err != nil { - testApp.Logger().Fatalf("Error in ConfigureCatalogs", err) + testApp.Logger().Fatalf("Error in ConfigureCatalogs, %s", err) } err = testApp.MapCatalogsEndpoints() if err != nil { - testApp.Logger().Fatalf("Error in MapCatalogsEndpoints", err) + testApp.Logger().Fatalf("Error in MapCatalogsEndpoints, %s", err) } testApp.ResolveFunc( diff --git a/internal/services/catalog_write_service/internal/shared/app/test/test_application.go b/internal/services/catalogwriteservice/internal/shared/app/test/test_application.go similarity index 100% rename from internal/services/catalog_write_service/internal/shared/app/test/test_application.go rename to internal/services/catalogwriteservice/internal/shared/app/test/test_application.go diff --git a/internal/services/catalog_write_service/internal/shared/app/test/test_application_builder.go b/internal/services/catalogwriteservice/internal/shared/app/test/test_application_builder.go similarity index 100% rename from internal/services/catalog_write_service/internal/shared/app/test/test_application_builder.go rename to internal/services/catalogwriteservice/internal/shared/app/test/test_application_builder.go diff --git a/internal/services/catalog_write_service/internal/shared/configurations/catalogs/catalogs_configurator.go b/internal/services/catalogwriteservice/internal/shared/configurations/catalogs/catalogs_configurator.go similarity index 86% rename from internal/services/catalog_write_service/internal/shared/configurations/catalogs/catalogs_configurator.go rename to internal/services/catalogwriteservice/internal/shared/configurations/catalogs/catalogs_configurator.go index 44145d2f..5aa27dc3 100644 --- a/internal/services/catalog_write_service/internal/shared/configurations/catalogs/catalogs_configurator.go +++ b/internal/services/catalogwriteservice/internal/shared/configurations/catalogs/catalogs_configurator.go @@ -4,8 +4,9 @@ import ( "fmt" "net/http" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/config/environment" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/fxapp/contracts" - echocontracts "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/contracts" + echocontracts "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/contracts" migrationcontracts "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/migration/contracts" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/config" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/configurations" @@ -44,12 +45,19 @@ func (ic *CatalogsServiceConfigurator) ConfigureCatalogs() error { // Shared // Catalogs configurations ic.ResolveFunc( - func(gorm *gorm.DB, postgresMigrationRunner migrationcontracts.PostgresMigrationRunner) error { - err := ic.migrateCatalogs(gorm, postgresMigrationRunner) + func(db *gorm.DB, postgresMigrationRunner migrationcontracts.PostgresMigrationRunner) error { + err := ic.migrateCatalogs(postgresMigrationRunner) if err != nil { return err } + if ic.Environment() != environment.Test { + err = ic.seedCatalogs(db) + if err != nil { + return err + } + } + return nil }, ) diff --git a/internal/services/catalog_write_service/internal/shared/configurations/catalogs/catalogs_configurator_migration.go b/internal/services/catalogwriteservice/internal/shared/configurations/catalogs/catalogs_configurator_migration.go similarity index 72% rename from internal/services/catalog_write_service/internal/shared/configurations/catalogs/catalogs_configurator_migration.go rename to internal/services/catalogwriteservice/internal/shared/configurations/catalogs/catalogs_configurator_migration.go index fea9b6c4..599fcba2 100644 --- a/internal/services/catalog_write_service/internal/shared/configurations/catalogs/catalogs_configurator_migration.go +++ b/internal/services/catalogwriteservice/internal/shared/configurations/catalogs/catalogs_configurator_migration.go @@ -4,30 +4,37 @@ import ( "context" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/migration/contracts" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/models" "gorm.io/gorm" ) func (ic *CatalogsServiceConfigurator) migrateCatalogs( - gorm *gorm.DB, runner contracts.PostgresMigrationRunner, ) error { // - for complex migration and ability to back-track to specific migration revision it is better we use `goose`, but if we want to use built-in gorm migration we can also sync gorm with `atlas` integration migration versioning for getting migration history from grom changes // - here I used goose for migration, with using cmd/migration file - // https://atlasgo.io/guides/orms/gorm - //err := gorm.AutoMigrate(&models.Product{}) - //if err != nil { - // return err - //} // migration with Goorse - return ic.migrateGoose(runner) + return migrateGoose(runner) } -func (ic *CatalogsServiceConfigurator) migrateGoose( +func migrateGoose( runner contracts.PostgresMigrationRunner, ) error { err := runner.Up(context.Background(), 0) return err } + +func migrateGorm( + db *gorm.DB, +) error { + // https://atlasgo.io/guides/orms/gorm + err := db.AutoMigrate(&models.Product{}) + if err != nil { + return err + } + + return nil +} diff --git a/internal/services/catalogwriteservice/internal/shared/configurations/catalogs/catalogs_configurator_seed.go b/internal/services/catalogwriteservice/internal/shared/configurations/catalogs/catalogs_configurator_seed.go new file mode 100644 index 00000000..fec85dc7 --- /dev/null +++ b/internal/services/catalogwriteservice/internal/shared/configurations/catalogs/catalogs_configurator_seed.go @@ -0,0 +1,104 @@ +package catalogs + +import ( + "time" + + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/testfixture" + datamodel "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/data/models" + + "emperror.dev/errors" + "github.com/brianvoe/gofakeit/v6" + uuid "github.com/satori/go.uuid" + "gorm.io/gorm" +) + +func (ic *CatalogsServiceConfigurator) seedCatalogs( + db *gorm.DB, +) error { + err := seedDataManually(db) + if err != nil { + return err + } + + return nil +} + +func seedDataManually(gormDB *gorm.DB) error { + var count int64 + + // https://gorm.io/docs/advanced_query.html#Count + gormDB.Model(&datamodel.ProductDataModel{}).Count(&count) + if count > 0 { + return nil + } + + products := []*datamodel.ProductDataModel{ + { + Id: uuid.NewV4(), + Name: gofakeit.Name(), + CreatedAt: time.Now(), + Description: gofakeit.AdjectiveDescriptive(), + Price: gofakeit.Price(100, 1000), + }, + { + Id: uuid.NewV4(), + Name: gofakeit.Name(), + CreatedAt: time.Now(), + Description: gofakeit.AdjectiveDescriptive(), + Price: gofakeit.Price(100, 1000), + }, + } + + err := gormDB.CreateInBatches(products, len(products)).Error + if err != nil { + return errors.Wrap(err, "error in seed database") + } + + return nil +} + +func seedDataWithFixture(gormDB *gorm.DB) error { + var count int64 + + // https://gorm.io/docs/advanced_query.html#Count + gormDB.Model(&datamodel.ProductDataModel{}).Count(&count) + if count > 0 { + return nil + } + + db, err := gormDB.DB() + if err != nil { + return errors.WrapIf(err, "error in seed database") + } + + // https://github.com/go-testfixtures/testfixtures#templating + // seed data + var data []struct { + Name string + ProductId uuid.UUID + Description string + } + + f := []struct { + Name string + ProductId uuid.UUID + Description string + }{ + {gofakeit.Name(), uuid.NewV4(), gofakeit.AdjectiveDescriptive()}, + {gofakeit.Name(), uuid.NewV4(), gofakeit.AdjectiveDescriptive()}, + } + + data = append(data, f...) + + err = testfixture.RunPostgresFixture( + db, + []string{"db/fixtures/products"}, + map[string]interface{}{ + "Products": data, + }) + if err != nil { + return errors.WrapIf(err, "error in seed database") + } + + return nil +} diff --git a/internal/services/catalog_write_service/internal/shared/configurations/catalogs/catalogs_configurator_swagger.go b/internal/services/catalogwriteservice/internal/shared/configurations/catalogs/catalogs_configurator_swagger.go similarity index 94% rename from internal/services/catalog_write_service/internal/shared/configurations/catalogs/catalogs_configurator_swagger.go rename to internal/services/catalogwriteservice/internal/shared/configurations/catalogs/catalogs_configurator_swagger.go index e45480b9..c5ff5a76 100644 --- a/internal/services/catalog_write_service/internal/shared/configurations/catalogs/catalogs_configurator_swagger.go +++ b/internal/services/catalogwriteservice/internal/shared/configurations/catalogs/catalogs_configurator_swagger.go @@ -1,7 +1,7 @@ package catalogs import ( - customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/contracts" + customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/contracts" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/docs" "github.com/labstack/echo/v4" diff --git a/internal/services/catalog_write_service/internal/shared/configurations/catalogs/catalogs_fx.go b/internal/services/catalogwriteservice/internal/shared/configurations/catalogs/catalogs_fx.go similarity index 100% rename from internal/services/catalog_write_service/internal/shared/configurations/catalogs/catalogs_fx.go rename to internal/services/catalogwriteservice/internal/shared/configurations/catalogs/catalogs_fx.go diff --git a/internal/services/catalog_write_service/internal/shared/configurations/catalogs/infrastructure/infrastructure_configurator.go b/internal/services/catalogwriteservice/internal/shared/configurations/catalogs/infrastructure/infrastructure_configurator.go similarity index 100% rename from internal/services/catalog_write_service/internal/shared/configurations/catalogs/infrastructure/infrastructure_configurator.go rename to internal/services/catalogwriteservice/internal/shared/configurations/catalogs/infrastructure/infrastructure_configurator.go diff --git a/internal/services/catalog_write_service/internal/shared/configurations/catalogs/infrastructure/infrastructure_fx.go b/internal/services/catalogwriteservice/internal/shared/configurations/catalogs/infrastructure/infrastructure_fx.go similarity index 98% rename from internal/services/catalog_write_service/internal/shared/configurations/catalogs/infrastructure/infrastructure_fx.go rename to internal/services/catalogwriteservice/internal/shared/configurations/catalogs/infrastructure/infrastructure_fx.go index 0d234de6..b64b65d1 100644 --- a/internal/services/catalog_write_service/internal/shared/configurations/catalogs/infrastructure/infrastructure_fx.go +++ b/internal/services/catalogwriteservice/internal/shared/configurations/catalogs/infrastructure/infrastructure_fx.go @@ -4,7 +4,7 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/grpc" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/health" - customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo" + customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/migration/goose" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/metrics" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" diff --git a/internal/services/catalog_write_service/internal/shared/contracts/catalogs_metrics.go b/internal/services/catalogwriteservice/internal/shared/contracts/catalogs_metrics.go similarity index 100% rename from internal/services/catalog_write_service/internal/shared/contracts/catalogs_metrics.go rename to internal/services/catalogwriteservice/internal/shared/contracts/catalogs_metrics.go diff --git a/internal/services/catalog_write_service/internal/shared/data/data_fx.go b/internal/services/catalogwriteservice/internal/shared/data/data_fx.go similarity index 100% rename from internal/services/catalog_write_service/internal/shared/data/data_fx.go rename to internal/services/catalogwriteservice/internal/shared/data/data_fx.go diff --git a/internal/services/catalog_write_service/internal/shared/data/dbcontext/catalogs_dbcontext.go b/internal/services/catalogwriteservice/internal/shared/data/dbcontext/catalogs_dbcontext.go similarity index 85% rename from internal/services/catalog_write_service/internal/shared/data/dbcontext/catalogs_dbcontext.go rename to internal/services/catalogwriteservice/internal/shared/data/dbcontext/catalogs_dbcontext.go index 1e29da56..9b261b02 100644 --- a/internal/services/catalog_write_service/internal/shared/data/dbcontext/catalogs_dbcontext.go +++ b/internal/services/catalogwriteservice/internal/shared/data/dbcontext/catalogs_dbcontext.go @@ -4,10 +4,11 @@ import ( "context" "fmt" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm/helpers" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm/scopes" datamodel "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/data/models" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/models" @@ -101,20 +102,30 @@ func (c *CatalogsGormDBContext) RunInTx( // Extensions for shared and reusable methods. for complex and none-reusable queries we use DBContext directly +func (c *CatalogsGormDBContext) ExistsProduct( + ctx context.Context, + id uuid.UUID, +) bool { + var count int64 + + c.WithContext(ctx).Model(&datamodel.ProductDataModel{}).Scopes(scopes.FilterByID(id)).Count(&count) + + return count > 0 +} + func (c *CatalogsGormDBContext) FindProductByID( ctx context.Context, id uuid.UUID, ) (*models.Product, error) { - var productDatas []*datamodel.ProductDataModel var productData *datamodel.ProductDataModel - s := c.DB.WithContext(ctx).Find(&productDatas).Error - fmt.Println(s) - // https://gorm.io/docs/query.html#Retrieving-objects-with-primary-key // https://gorm.io/docs/query.html#Struct-amp-Map-Conditions // https://gorm.io/docs/query.html#Inline-Condition // https://gorm.io/docs/advanced_query.html + // result := c.WithContext(ctx).First(&productData, "id = ?", id) + // result := c.WithContext(ctx).First(&datamodel.ProductDataModel{Id: id}) + // result := c.WithContext(ctx).Scopes(scopes.FilterByID(id)).First(&productData) result := c.WithContext(ctx).First(&productData, id) if result.Error != nil { return nil, customErrors.NewNotFoundErrorWrap( @@ -146,26 +157,17 @@ func (c *CatalogsGormDBContext) DeleteProductByID( ) error { dbContext := c.WithTxIfExists(ctx) - product, err := dbContext.FindProductByID(ctx, id) - if err != nil { - return customErrors.NewNotFoundErrorWrap( - err, - fmt.Sprintf( - "product with id `%s` not found in the database", - id.String(), - ), - ) - } - - productDataModel, err := mapper.Map[*datamodel.ProductDataModel](product) - if err != nil { - return customErrors.NewInternalServerErrorWrap( - err, - "error in the mapping ProductDataModel", - ) + exists := c.ExistsProduct(ctx, id) + if !exists { + return customErrors.NewNotFoundError(fmt.Sprintf("product with id `%s` not found in the database", + id.String(), + )) } - result := dbContext.WithContext(ctx).Delete(productDataModel, id) + // https://gorm.io/docs/delete.html#Delete-a-Record + // https://gorm.io/docs/delete.html#Find-soft-deleted-records + // result := dbContext.WithContext(ctx).Delete(&datamodel.ProductDataModel{Id: id}) + result := dbContext.WithContext(ctx).Delete(&datamodel.ProductDataModel{}, id) if result.Error != nil { return customErrors.NewInternalServerErrorWrap( result.Error, diff --git a/internal/services/catalog_write_service/internal/shared/data/dbcontext/catalogs_dbcontext_test.go b/internal/services/catalogwriteservice/internal/shared/data/dbcontext/catalogs_dbcontext_test.go similarity index 67% rename from internal/services/catalog_write_service/internal/shared/data/dbcontext/catalogs_dbcontext_test.go rename to internal/services/catalogwriteservice/internal/shared/data/dbcontext/catalogs_dbcontext_test.go index 350e6f9e..58509af2 100644 --- a/internal/services/catalog_write_service/internal/shared/data/dbcontext/catalogs_dbcontext_test.go +++ b/internal/services/catalogwriteservice/internal/shared/data/dbcontext/catalogs_dbcontext_test.go @@ -1,17 +1,21 @@ +//go:build unit +// +build unit + package dbcontext import ( "context" + "os" "testing" "time" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/config" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/config/environment" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger/external/fxlog" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger/zap" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/migration/goose" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" gormPostgres "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm/scopes" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/configurations/mappings" datamodel "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/data/models" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/models" @@ -28,9 +32,10 @@ import ( // Define the suite type DBContextTestSuite struct { suite.Suite - items []*datamodel.ProductDataModel - dbContext *CatalogsGormDBContext - app *fxtest.App + items []*datamodel.ProductDataModel + dbContext *CatalogsGormDBContext + app *fxtest.App + dbFilePath string } // In order for 'go test' to run this suite, we need to create @@ -42,7 +47,7 @@ func TestDBContextTestSuite(t *testing.T) { func (s *DBContextTestSuite) Test_FindProductByID() { s.Require().NotNil(s.dbContext) - id := s.items[0].ProductId + id := s.items[0].Id p, err := s.dbContext.FindProductByID( context.Background(), @@ -51,13 +56,37 @@ func (s *DBContextTestSuite) Test_FindProductByID() { s.Require().NoError(err) s.Require().NotNil(p) - s.Assert().Equal(p.ProductId, id) + s.Assert().Equal(p.Id, id) +} + +func (s *DBContextTestSuite) Test_ExistsProductByID() { + s.Require().NotNil(s.dbContext) + + id := s.items[0].Id + + exist := s.dbContext.ExistsProduct( + context.Background(), + id, + ) + s.Require().True(exist) +} + +func (s *DBContextTestSuite) Test_NoneExistsProductByID() { + s.Require().NotNil(s.dbContext) + + id := uuid.NewV4() + + exist := s.dbContext.ExistsProduct( + context.Background(), + id, + ) + s.Require().False(exist) } func (s *DBContextTestSuite) Test_DeleteProductByID() { s.Require().NotNil(s.dbContext) - id := s.items[0].ProductId + id := s.items[0].Id err := s.dbContext.DeleteProductByID( context.Background(), @@ -69,16 +98,30 @@ func (s *DBContextTestSuite) Test_DeleteProductByID() { context.Background(), id, ) - - s.Require().Nil(p) s.Require().Error(err) + s.Require().Nil(p) + + // https://gorm.io/docs/delete.html#Find-soft-deleted-records + var softDeletedProduct *datamodel.ProductDataModel + s.dbContext.Scopes(scopes.FilterAllItemsWithSoftDeleted).First(&softDeletedProduct, id) + s.Require().NotNil(softDeletedProduct) + + var deletedCount int64 + var allCount int64 + + // https://gorm.io/docs/advanced_query.html#Count + s.dbContext.Model(&datamodel.ProductDataModel{}).Scopes(scopes.FilterAllItemsWithSoftDeleted).Count(&allCount) + s.Equal(allCount, int64(2)) + + s.dbContext.Model(&datamodel.ProductDataModel{}).Scopes(scopes.SoftDeleted).Count(&deletedCount) + s.Equal(deletedCount, int64(1)) } func (s *DBContextTestSuite) Test_CreateProduct() { s.Require().NotNil(s.dbContext) item := &models.Product{ - ProductId: uuid.NewV4(), + Id: uuid.NewV4(), Name: gofakeit.Name(), Description: gofakeit.AdjectiveDescriptive(), Price: gofakeit.Price(100, 1000), @@ -89,19 +132,19 @@ func (s *DBContextTestSuite) Test_CreateProduct() { p, err := s.dbContext.FindProductByID( context.Background(), - item.ProductId, + item.Id, ) s.Require().NoError(err) s.Require().NotNil(p) - s.Assert().Equal(p.ProductId, item.ProductId) - s.Assert().Equal(p.ProductId, res.ProductId) + s.Assert().Equal(p.Id, item.Id) + s.Assert().Equal(p.Id, res.Id) } func (s *DBContextTestSuite) Test_UpdateProduct() { s.Require().NotNil(s.dbContext) - id := s.items[0].ProductId + id := s.items[0].Id p, err := s.dbContext.FindProductByID( context.Background(), @@ -127,51 +170,66 @@ func (s *DBContextTestSuite) Test_UpdateProduct() { } // TestSuite Hooks + func (s *DBContextTestSuite) SetupTest() { + err := mappings.ConfigureProductsMappings() + s.Require().NoError(err) + var gormDBContext *CatalogsGormDBContext + var gormOptions *gormPostgres.GormOptions app := fxtest.New( s.T(), config.ModuleFunc(environment.Test), zap.Module, fxlog.FxLogger, - core.Module, gormPostgres.Module, - goose.Module, fx.Decorate( func(cfg *gormPostgres.GormOptions) (*gormPostgres.GormOptions, error) { - // using sql-lite in-memory - cfg.UseInMemory = true + // using sql-lite with a database file + cfg.UseSQLLite = true return cfg, nil }, ), - fx.Provide( - NewCatalogsDBContext, - ), + fx.Provide(NewCatalogsDBContext), fx.Populate(&gormDBContext), + fx.Populate(&gormOptions), ).RequireStart() + s.app = app s.dbContext = gormDBContext - products := s.setupInMemoryContext() + s.dbFilePath = gormOptions.Dns() - s.app = app - s.items = products + s.initDB() } -func (s *DBContextTestSuite) SetupSuite() { - err := mappings.ConfigureProductsMappings() +func (s *DBContextTestSuite) TearDownTest() { + err := s.cleanupDB() s.Require().NoError(err) + + mapper.ClearMappings() } -func (s *DBContextTestSuite) setupInMemoryContext() []*datamodel.ProductDataModel { +func (s *DBContextTestSuite) initDB() { err := migrateGorm(s.dbContext.DB) s.Require().NoError(err) - res, err := seedData(s.dbContext.DB) - s.Require().NoError(errors.WrapIf(err, "error in seeding data in postgres")) + products, err := seedData(s.dbContext.DB) + s.Require().NoError(err) + + s.items = products +} + +func (s *DBContextTestSuite) cleanupDB() error { + sqldb, _ := s.dbContext.DB.DB() + e := sqldb.Close() + s.Require().NoError(e) + + // removing sql-lite file + err := os.Remove(s.dbFilePath) - return res + return err } func migrateGorm(db *gorm.DB) error { @@ -186,14 +244,14 @@ func migrateGorm(db *gorm.DB) error { func seedData(gormDB *gorm.DB) ([]*datamodel.ProductDataModel, error) { products := []*datamodel.ProductDataModel{ { - ProductId: uuid.NewV4(), + Id: uuid.NewV4(), Name: gofakeit.Name(), CreatedAt: time.Now(), Description: gofakeit.AdjectiveDescriptive(), Price: gofakeit.Price(100, 1000), }, { - ProductId: uuid.NewV4(), + Id: uuid.NewV4(), Name: gofakeit.Name(), CreatedAt: time.Now(), Description: gofakeit.AdjectiveDescriptive(), diff --git a/internal/services/catalogwriteservice/internal/shared/data/scopes/scopes.go b/internal/services/catalogwriteservice/internal/shared/data/scopes/scopes.go new file mode 100644 index 00000000..76877700 --- /dev/null +++ b/internal/services/catalogwriteservice/internal/shared/data/scopes/scopes.go @@ -0,0 +1,3 @@ +package scopes + +// After scopes, we should have a runner function like Find, Update, Delete diff --git a/internal/services/catalog_write_service/internal/shared/grpc/genproto/products.pb.go b/internal/services/catalogwriteservice/internal/shared/grpc/genproto/products.pb.go similarity index 95% rename from internal/services/catalog_write_service/internal/shared/grpc/genproto/products.pb.go rename to internal/services/catalogwriteservice/internal/shared/grpc/genproto/products.pb.go index 78f454d3..7129f4a8 100644 --- a/internal/services/catalog_write_service/internal/shared/grpc/genproto/products.pb.go +++ b/internal/services/catalogwriteservice/internal/shared/grpc/genproto/products.pb.go @@ -2,16 +2,17 @@ // versions: // protoc-gen-go v1.26.0 // protoc v4.23.4 -// source: catalog_write_service/products.proto +// source: catalogwriteservice/products.proto package products_service import ( + reflect "reflect" + sync "sync" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" timestamppb "google.golang.org/protobuf/types/known/timestamppb" - reflect "reflect" - sync "sync" ) const ( @@ -26,7 +27,7 @@ type Product struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ProductId string `protobuf:"bytes,1,opt,name=ProductId,proto3" json:"ProductId,omitempty"` + ProductId string `protobuf:"bytes,1,opt,name=Id,proto3" json:"Id,omitempty"` Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` Description string `protobuf:"bytes,3,opt,name=Description,proto3" json:"Description,omitempty"` Price float64 `protobuf:"fixed64,4,opt,name=Price,proto3" json:"Price,omitempty"` @@ -176,7 +177,7 @@ type CreateProductRes struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ProductId string `protobuf:"bytes,1,opt,name=ProductId,proto3" json:"ProductId,omitempty"` + ProductId string `protobuf:"bytes,1,opt,name=Id,proto3" json:"Id,omitempty"` } func (x *CreateProductRes) Reset() { @@ -223,7 +224,7 @@ type UpdateProductReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ProductId string `protobuf:"bytes,1,opt,name=ProductId,proto3" json:"ProductId,omitempty"` + ProductId string `protobuf:"bytes,1,opt,name=Id,proto3" json:"Id,omitempty"` Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` Description string `protobuf:"bytes,3,opt,name=Description,proto3" json:"Description,omitempty"` Price float64 `protobuf:"fixed64,4,opt,name=Price,proto3" json:"Price,omitempty"` @@ -332,7 +333,7 @@ type GetProductByIdReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ProductId string `protobuf:"bytes,1,opt,name=ProductId,proto3" json:"ProductId,omitempty"` + ProductId string `protobuf:"bytes,1,opt,name=Id,proto3" json:"Id,omitempty"` } func (x *GetProductByIdReq) Reset() { @@ -505,17 +506,19 @@ func file_catalog_write_service_products_proto_rawDescGZIP() []byte { return file_catalog_write_service_products_proto_rawDescData } -var file_catalog_write_service_products_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_catalog_write_service_products_proto_goTypes = []interface{}{ - (*Product)(nil), // 0: products_service.Product - (*CreateProductReq)(nil), // 1: products_service.CreateProductReq - (*CreateProductRes)(nil), // 2: products_service.CreateProductRes - (*UpdateProductReq)(nil), // 3: products_service.UpdateProductReq - (*UpdateProductRes)(nil), // 4: products_service.UpdateProductRes - (*GetProductByIdReq)(nil), // 5: products_service.GetProductByIdReq - (*GetProductByIdRes)(nil), // 6: products_service.GetProductByIdRes - (*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp -} +var ( + file_catalog_write_service_products_proto_msgTypes = make([]protoimpl.MessageInfo, 7) + file_catalog_write_service_products_proto_goTypes = []interface{}{ + (*Product)(nil), // 0: products_service.Product + (*CreateProductReq)(nil), // 1: products_service.CreateProductReq + (*CreateProductRes)(nil), // 2: products_service.CreateProductRes + (*UpdateProductReq)(nil), // 3: products_service.UpdateProductReq + (*UpdateProductRes)(nil), // 4: products_service.UpdateProductRes + (*GetProductByIdReq)(nil), // 5: products_service.GetProductByIdReq + (*GetProductByIdRes)(nil), // 6: products_service.GetProductByIdRes + (*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp + } +) var file_catalog_write_service_products_proto_depIdxs = []int32{ 7, // 0: products_service.Product.CreatedAt:type_name -> google.protobuf.Timestamp 7, // 1: products_service.Product.UpdatedAt:type_name -> google.protobuf.Timestamp diff --git a/internal/services/catalog_write_service/internal/shared/grpc/genproto/products_grpc.pb.go b/internal/services/catalogwriteservice/internal/shared/grpc/genproto/products_grpc.pb.go similarity index 98% rename from internal/services/catalog_write_service/internal/shared/grpc/genproto/products_grpc.pb.go rename to internal/services/catalogwriteservice/internal/shared/grpc/genproto/products_grpc.pb.go index e8174210..e509ba2d 100644 --- a/internal/services/catalog_write_service/internal/shared/grpc/genproto/products_grpc.pb.go +++ b/internal/services/catalogwriteservice/internal/shared/grpc/genproto/products_grpc.pb.go @@ -2,7 +2,7 @@ // versions: // - protoc-gen-go-grpc v1.3.0 // - protoc v4.23.4 -// source: catalog_write_service/products.proto +// source: catalogwriteservice/products.proto package products_service @@ -177,5 +177,5 @@ var ProductsService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "catalog_write_service/products.proto", + Metadata: "catalogwriteservice/products.proto", } diff --git a/internal/services/catalog_write_service/internal/shared/grpc/product_grpc_service_server.go b/internal/services/catalogwriteservice/internal/shared/grpc/product_grpc_service_server.go similarity index 97% rename from internal/services/catalog_write_service/internal/shared/grpc/product_grpc_service_server.go rename to internal/services/catalogwriteservice/internal/shared/grpc/product_grpc_service_server.go index 094d7c98..4531b406 100644 --- a/internal/services/catalog_write_service/internal/shared/grpc/product_grpc_service_server.go +++ b/internal/services/catalogwriteservice/internal/shared/grpc/product_grpc_service_server.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing/attribute" @@ -87,7 +87,7 @@ func (s *ProductGrpcServiceServer) CreateProduct( command.ProductID, err, ), - logger.Fields{"ProductId": command.ProductID}, + logger.Fields{"Id": command.ProductID}, ) return nil, err } @@ -151,7 +151,7 @@ func (s *ProductGrpcServiceServer) UpdateProduct( command.ProductID, err, ), - logger.Fields{"ProductId": command.ProductID}, + logger.Fields{"Id": command.ProductID}, ) return nil, err } @@ -216,7 +216,7 @@ func (s *ProductGrpcServiceServer) GetProductById( query.ProductID, err, ), - logger.Fields{"ProductId": query.ProductID}, + logger.Fields{"Id": query.ProductID}, ) return nil, err } diff --git a/internal/services/catalog_write_service/internal/shared/testfixtures/integration/integration_test_fixture.go b/internal/services/catalogwriteservice/internal/shared/testfixtures/integration/integration_test_fixture.go similarity index 92% rename from internal/services/catalog_write_service/internal/shared/testfixtures/integration/integration_test_fixture.go rename to internal/services/catalogwriteservice/internal/shared/testfixtures/integration/integration_test_fixture.go index c2f72913..4bf67f8c 100644 --- a/internal/services/catalog_write_service/internal/shared/testfixtures/integration/integration_test_fixture.go +++ b/internal/services/catalogwriteservice/internal/shared/testfixtures/integration/integration_test_fixture.go @@ -8,7 +8,7 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/bus" fxcontracts "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/fxapp/contracts" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" - gormPostgres "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm" + gormPostgres "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/postgresgorm/helpers" config2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/config" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/testfixture" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" @@ -78,8 +78,9 @@ func NewIntegrationTestSharedFixture( func (i *IntegrationTestSharedFixture) SetupTest() { i.Log.Info("SetupTest started") - // seed data in each test - res, err := seedData(i.Gorm) + // migration will do in app configuration + // seed data for our tests - app seed doesn't run in test environment + res, err := seedDataManually(i.Gorm) if err != nil { i.Log.Error(errors.WrapIf(err, "error in seeding data in postgres")) } @@ -135,17 +136,17 @@ func (i *IntegrationTestSharedFixture) cleanupPostgresData() error { return nil } -func seedData(gormDB *gorm.DB) ([]*datamodel.ProductDataModel, error) { +func seedDataManually(gormDB *gorm.DB) ([]*datamodel.ProductDataModel, error) { products := []*datamodel.ProductDataModel{ { - ProductId: uuid.NewV4(), + Id: uuid.NewV4(), Name: gofakeit.Name(), CreatedAt: time.Now(), Description: gofakeit.AdjectiveDescriptive(), Price: gofakeit.Price(100, 1000), }, { - ProductId: uuid.NewV4(), + Id: uuid.NewV4(), Name: gofakeit.Name(), CreatedAt: time.Now(), Description: gofakeit.AdjectiveDescriptive(), @@ -153,8 +154,6 @@ func seedData(gormDB *gorm.DB) ([]*datamodel.ProductDataModel, error) { }, } - // migration will do in app configuration - // seed data err := gormDB.CreateInBatches(products, len(products)).Error if err != nil { return nil, errors.Wrap(err, "error in seed database") @@ -163,13 +162,7 @@ func seedData(gormDB *gorm.DB) ([]*datamodel.ProductDataModel, error) { return products, nil } -func seedAndMigration(gormDB *gorm.DB) ([]*datamodel.ProductDataModel, error) { - // migration - err := gormDB.AutoMigrate(datamodel.ProductDataModel{}) - if err != nil { - return nil, errors.WrapIf(err, "error in seed database") - } - +func seedDataWithFixture(gormDB *gorm.DB) ([]*datamodel.ProductDataModel, error) { db, err := gormDB.DB() if err != nil { return nil, errors.WrapIf(err, "error in seed database") @@ -209,5 +202,6 @@ func seedAndMigration(gormDB *gorm.DB) ([]*datamodel.ProductDataModel, error) { utils.NewListQuery(10, 1), gormDB, ) + return result.Items, nil } diff --git a/internal/services/catalog_write_service/internal/shared/testfixtures/unittest/unit_test_fixture.go b/internal/services/catalogwriteservice/internal/shared/testfixtures/unittest/unit_test_fixture.go similarity index 71% rename from internal/services/catalog_write_service/internal/shared/testfixtures/unittest/unit_test_fixture.go rename to internal/services/catalogwriteservice/internal/shared/testfixtures/unittest/unit_test_fixture.go index 32778f03..17ec3d71 100644 --- a/internal/services/catalog_write_service/internal/shared/testfixtures/unittest/unit_test_fixture.go +++ b/internal/services/catalogwriteservice/internal/shared/testfixtures/unittest/unit_test_fixture.go @@ -2,14 +2,13 @@ package unittest import ( "context" - "fmt" "os" "path/filepath" "testing" "time" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/config/environment" - mocks3 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/mocks" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/mocks" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" defaultLogger "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger/defaultlogger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger/external/gromlog" @@ -35,11 +34,11 @@ type UnitTestSharedFixture struct { Log logger.Logger suite.Suite Products []*datamodel.ProductDataModel - Bus *mocks3.Bus + Bus *mocks.Bus Tracer trace.Tracer CatalogDBContext *dbcontext.CatalogsGormDBContext Ctx context.Context - projectRootDir string + dbFilePath string dbFileName string } @@ -62,104 +61,114 @@ func NewUnitTestSharedFixture(t *testing.T) *UnitTestSharedFixture { return unit } -// Shared Hooks +func (c *UnitTestSharedFixture) BeginTx() { + c.Log.Info("starting transaction") + // seems when we `Begin` a transaction on gorm.DB (with SQLLite in-memory) our previous gormDB before transaction will remove and the new gormDB with tx will go on the memory + tx := c.CatalogDBContext.Begin() + gormContext := helpers.SetTxToContext(c.Ctx, tx) + c.Ctx = gormContext + + //// works on both transaction and none-transactional dbcontext + //var productData []*datamodel.ProductDataModel + //var productData2 []*datamodel.ProductDataModel + // + //s := c.CatalogDBContext.Find(&productData).Error + //s2 := tx.Find(&productData2).Error +} + +func (c *UnitTestSharedFixture) CommitTx() { + tx := helpers.GetTxFromContextIfExists(c.Ctx) + if tx != nil { + c.Log.Info("committing transaction") + tx.Commit() + } +} + +/// Shared Hooks + +func (c *UnitTestSharedFixture) SetupSuite() { + // this fix root working directory problem in our test environment inner our fixture + environment.FixProjectRootWorkingDirectoryPath() + projectRootDir := environment.GetProjectRootWorkingDirectory() + + c.dbFilePath = filepath.Join(projectRootDir, c.dbFileName) +} + +func (c *UnitTestSharedFixture) TearDownSuite() { +} func (c *UnitTestSharedFixture) SetupTest() { ctx := context.Background() c.Ctx = ctx - // create new mocks - bus := &mocks3.Bus{} + c.setupBus() - bus.On("PublishMessage", mock.Anything, mock.Anything, mock.Anything). - Return(nil) - - dbContext, products := c.createSQLLiteDBContext() - - c.Bus = bus - c.CatalogDBContext = dbContext - c.Products = products + c.setupDB() err := mappings.ConfigureProductsMappings() c.Require().NoError(err) } func (c *UnitTestSharedFixture) TearDownTest() { - err := c.dropSQLLiteDB() + err := c.cleanupDB() c.Require().NoError(err) + mapper.ClearMappings() } -func (c *UnitTestSharedFixture) SetupSuite() { - environment.FixProjectRootWorkingDirectoryPath() - c.projectRootDir = environment.GetProjectRootWorkingDirectory() -} +func (c *UnitTestSharedFixture) setupBus() { + // create new mocks + bus := &mocks.Bus{} -func (c *UnitTestSharedFixture) TearDownSuite() { + bus.On("PublishMessage", mock.Anything, mock.Anything, mock.Anything). + Return(nil) + c.Bus = bus } -func (c *UnitTestSharedFixture) createSQLLiteDBContext() (*dbcontext.CatalogsGormDBContext, []*datamodel.ProductDataModel) { - sqlLiteGormDB, err := c.createSQLLiteDB() - c.Require().NoError(err) +func (c *UnitTestSharedFixture) setupDB() { + dbContext := c.createSQLLiteDBContext() + c.CatalogDBContext = dbContext - dbContext := dbcontext.NewCatalogsDBContext(sqlLiteGormDB, c.Log) + c.initDB(dbContext) +} - err = migrateGorm(dbContext) +func (c *UnitTestSharedFixture) initDB(dbContext *dbcontext.CatalogsGormDBContext) { + // migrations for our database + err := migrateGorm(dbContext) c.Require().NoError(err) - items, err := seedData(dbContext) + // seed data for our tests + items, err := seedDataManually(dbContext) c.Require().NoError(err) - return dbContext, items + c.Products = items } -func (c *UnitTestSharedFixture) BeginTx() { - c.Log.Info("starting transaction") - tx := c.CatalogDBContext.Begin() - gormContext := helpers.SetTxToContext(c.Ctx, tx) - c.Ctx = gormContext - - var productData []*datamodel.ProductDataModel - var productData2 []*datamodel.ProductDataModel +func (c *UnitTestSharedFixture) cleanupDB() error { + sqldb, _ := c.CatalogDBContext.DB.DB() + e := sqldb.Close() + c.Require().NoError(e) - s := c.CatalogDBContext.Find(&productData).Error - s2 := tx.Find(&productData2).Error - fmt.Println(s) - fmt.Println(s2) -} + // removing sql-lite file + err := os.Remove(c.dbFilePath) -func (c *UnitTestSharedFixture) CommitTx() { - tx := helpers.GetTxFromContextIfExists(c.Ctx) - if tx != nil { - c.Log.Info("committing transaction") - tx.Commit() - } + return err } -func (c *UnitTestSharedFixture) createSQLLiteDB() (*gorm.DB, error) { - dbFilePath := filepath.Join(c.projectRootDir, c.dbFileName) - +func (c *UnitTestSharedFixture) createSQLLiteDBContext() *dbcontext.CatalogsGormDBContext { // https://gorm.io/docs/connecting_to_the_database.html#SQLite // https://github.com/glebarez/sqlite // https://www.connectionstrings.com/sqlite/ - gormDB, err := gorm.Open( - sqlite.Open(dbFilePath), + gormSQLLiteDB, err := gorm.Open( + sqlite.Open(c.dbFilePath), &gorm.Config{ Logger: gromlog.NewGormCustomLogger(defaultLogger.GetLogger()), }) + c.Require().NoError(err) - return gormDB, err -} - -func (c *UnitTestSharedFixture) dropSQLLiteDB() error { - sqldb, _ := c.CatalogDBContext.DB.DB() - e := sqldb.Close() - c.Require().NoError(e) - - dbFilePath := filepath.Join(c.projectRootDir, c.dbFileName) - err := os.Remove(dbFilePath) + dbContext := dbcontext.NewCatalogsDBContext(gormSQLLiteDB, c.Log) - return err + return dbContext } func migrateGorm(dbContext *dbcontext.CatalogsGormDBContext) error { @@ -171,19 +180,19 @@ func migrateGorm(dbContext *dbcontext.CatalogsGormDBContext) error { return nil } -func seedData( +func seedDataManually( dbContext *dbcontext.CatalogsGormDBContext, ) ([]*datamodel.ProductDataModel, error) { products := []*datamodel.ProductDataModel{ { - ProductId: uuid.NewV4(), + Id: uuid.NewV4(), Name: gofakeit.Name(), CreatedAt: time.Now(), Description: gofakeit.AdjectiveDescriptive(), Price: gofakeit.Price(100, 1000), }, { - ProductId: uuid.NewV4(), + Id: uuid.NewV4(), Name: gofakeit.Name(), CreatedAt: time.Now(), Description: gofakeit.AdjectiveDescriptive(), @@ -191,7 +200,6 @@ func seedData( }, } - // migration will do in app configuration // seed data err := dbContext.DB.CreateInBatches(products, len(products)).Error if err != nil { diff --git a/internal/services/catalog_write_service/mocks/CatalogContext.go b/internal/services/catalogwriteservice/mocks/CatalogContext.go similarity index 100% rename from internal/services/catalog_write_service/mocks/CatalogContext.go rename to internal/services/catalogwriteservice/mocks/CatalogContext.go diff --git a/internal/services/catalog_write_service/mocks/ProductRepository.go b/internal/services/catalogwriteservice/mocks/ProductRepository.go similarity index 100% rename from internal/services/catalog_write_service/mocks/ProductRepository.go rename to internal/services/catalogwriteservice/mocks/ProductRepository.go diff --git a/internal/services/catalog_write_service/mocks/ProductsServiceClient.go b/internal/services/catalogwriteservice/mocks/ProductsServiceClient.go similarity index 100% rename from internal/services/catalog_write_service/mocks/ProductsServiceClient.go rename to internal/services/catalogwriteservice/mocks/ProductsServiceClient.go diff --git a/internal/services/catalog_write_service/mocks/ProductsServiceServer.go b/internal/services/catalogwriteservice/mocks/ProductsServiceServer.go similarity index 100% rename from internal/services/catalog_write_service/mocks/ProductsServiceServer.go rename to internal/services/catalogwriteservice/mocks/ProductsServiceServer.go diff --git a/internal/services/catalog_write_service/mocks/UnsafeProductsServiceServer.go b/internal/services/catalogwriteservice/mocks/UnsafeProductsServiceServer.go similarity index 100% rename from internal/services/catalog_write_service/mocks/UnsafeProductsServiceServer.go rename to internal/services/catalogwriteservice/mocks/UnsafeProductsServiceServer.go diff --git a/internal/services/catalog_write_service/readme.md b/internal/services/catalogwriteservice/readme.md similarity index 100% rename from internal/services/catalog_write_service/readme.md rename to internal/services/catalogwriteservice/readme.md diff --git a/internal/services/catalog_write_service/revive-config.toml b/internal/services/catalogwriteservice/revive-config.toml similarity index 100% rename from internal/services/catalog_write_service/revive-config.toml rename to internal/services/catalogwriteservice/revive-config.toml diff --git a/internal/services/catalog_write_service/taskfile.yml b/internal/services/catalogwriteservice/taskfile.yml similarity index 100% rename from internal/services/catalog_write_service/taskfile.yml rename to internal/services/catalogwriteservice/taskfile.yml diff --git a/internal/services/catalog_write_service/taskfile_db.yml b/internal/services/catalogwriteservice/taskfile_db.yml similarity index 100% rename from internal/services/catalog_write_service/taskfile_db.yml rename to internal/services/catalogwriteservice/taskfile_db.yml diff --git a/internal/services/catalog_write_service/taskfile_test.yml b/internal/services/catalogwriteservice/taskfile_test.yml similarity index 100% rename from internal/services/catalog_write_service/taskfile_test.yml rename to internal/services/catalogwriteservice/taskfile_test.yml diff --git a/internal/services/catalog_write_service/test/endtoend/products/features/creatingproduct/v1/create_product_test.go b/internal/services/catalogwriteservice/test/endtoend/products/features/creatingproduct/v1/create_product_test.go similarity index 100% rename from internal/services/catalog_write_service/test/endtoend/products/features/creatingproduct/v1/create_product_test.go rename to internal/services/catalogwriteservice/test/endtoend/products/features/creatingproduct/v1/create_product_test.go diff --git a/internal/services/catalog_write_service/test/endtoend/products/features/deletingproduct/v1/delete_product_test.go b/internal/services/catalogwriteservice/test/endtoend/products/features/deletingproduct/v1/delete_product_test.go similarity index 97% rename from internal/services/catalog_write_service/test/endtoend/products/features/deletingproduct/v1/delete_product_test.go rename to internal/services/catalogwriteservice/test/endtoend/products/features/deletingproduct/v1/delete_product_test.go index 1f9a52c3..42d3f788 100644 --- a/internal/services/catalog_write_service/test/endtoend/products/features/deletingproduct/v1/delete_product_test.go +++ b/internal/services/catalogwriteservice/test/endtoend/products/features/deletingproduct/v1/delete_product_test.go @@ -37,7 +37,7 @@ var _ = Describe("Delete Product Feature", func() { By("Seeding the required data") integrationFixture.SetupTest() - id = integrationFixture.Items[0].ProductId + id = integrationFixture.Items[0].Id }) _ = AfterEach(func() { diff --git a/internal/services/catalog_write_service/test/endtoend/products/features/gettingproductbyid/v1/get_product_by_id_test.go b/internal/services/catalogwriteservice/test/endtoend/products/features/gettingproductbyid/v1/get_product_by_id_test.go similarity index 97% rename from internal/services/catalog_write_service/test/endtoend/products/features/gettingproductbyid/v1/get_product_by_id_test.go rename to internal/services/catalogwriteservice/test/endtoend/products/features/gettingproductbyid/v1/get_product_by_id_test.go index dc035dea..256ca88c 100644 --- a/internal/services/catalog_write_service/test/endtoend/products/features/gettingproductbyid/v1/get_product_by_id_test.go +++ b/internal/services/catalogwriteservice/test/endtoend/products/features/gettingproductbyid/v1/get_product_by_id_test.go @@ -37,7 +37,7 @@ var _ = Describe("Get Product By Id Feature", func() { By("Seeding the required data") integrationFixture.SetupTest() - id = integrationFixture.Items[0].ProductId + id = integrationFixture.Items[0].Id }) _ = AfterEach(func() { diff --git a/internal/services/catalog_write_service/test/endtoend/products/features/gettingproducts/v1/get_products_test.go b/internal/services/catalogwriteservice/test/endtoend/products/features/gettingproducts/v1/get_products_test.go similarity index 100% rename from internal/services/catalog_write_service/test/endtoend/products/features/gettingproducts/v1/get_products_test.go rename to internal/services/catalogwriteservice/test/endtoend/products/features/gettingproducts/v1/get_products_test.go diff --git a/internal/services/catalog_write_service/test/endtoend/products/features/searchingproduct/v1/search_products_test.go b/internal/services/catalogwriteservice/test/endtoend/products/features/searchingproduct/v1/search_products_test.go similarity index 100% rename from internal/services/catalog_write_service/test/endtoend/products/features/searchingproduct/v1/search_products_test.go rename to internal/services/catalogwriteservice/test/endtoend/products/features/searchingproduct/v1/search_products_test.go diff --git a/internal/services/catalog_write_service/test/endtoend/products/features/updatingproduct/v1/update_product_test.go b/internal/services/catalogwriteservice/test/endtoend/products/features/updatingproduct/v1/update_product_test.go similarity index 98% rename from internal/services/catalog_write_service/test/endtoend/products/features/updatingproduct/v1/update_product_test.go rename to internal/services/catalogwriteservice/test/endtoend/products/features/updatingproduct/v1/update_product_test.go index fc66699a..41d46e15 100644 --- a/internal/services/catalog_write_service/test/endtoend/products/features/updatingproduct/v1/update_product_test.go +++ b/internal/services/catalogwriteservice/test/endtoend/products/features/updatingproduct/v1/update_product_test.go @@ -39,7 +39,7 @@ var _ = Describe("UpdateProductE2ETest Suite", func() { By("Seeding the required data") integrationFixture.SetupTest() - id = integrationFixture.Items[0].ProductId + id = integrationFixture.Items[0].Id }) _ = AfterEach(func() { diff --git a/internal/services/catalog_write_service/test/endtoend/products/grpc/product_grpc_service_server_test.go b/internal/services/catalogwriteservice/test/endtoend/products/grpc/product_grpc_service_server_test.go similarity index 93% rename from internal/services/catalog_write_service/test/endtoend/products/grpc/product_grpc_service_server_test.go rename to internal/services/catalogwriteservice/test/endtoend/products/grpc/product_grpc_service_server_test.go index 6bc06f19..0bc9e32f 100644 --- a/internal/services/catalog_write_service/test/endtoend/products/grpc/product_grpc_service_server_test.go +++ b/internal/services/catalogwriteservice/test/endtoend/products/grpc/product_grpc_service_server_test.go @@ -37,7 +37,7 @@ var _ = Describe("Product Grpc Service Feature", func() { By("Seeding the required data") integrationFixture.SetupTest() - id = integrationFixture.Items[0].ProductId + id = integrationFixture.Items[0].Id }) _ = AfterEach(func() { @@ -50,7 +50,7 @@ var _ = Describe("Product Grpc Service Feature", func() { // "When" step When("A request is made to create a product with valid data", func() { // "Then" step - It("Should return a non-empty ProductId", func() { + It("Should return a non-empty Id", func() { // Create a gRPC request with valid data request := &productService.CreateProductReq{ Price: gofakeit.Price(100, 1000), @@ -72,7 +72,7 @@ var _ = Describe("Product Grpc Service Feature", func() { // "When" step When("A request is made to retrieve data with a valid ID", func() { // "Then" step - It("Should return data with a matching ProductId", func() { + It("Should return data with a matching Id", func() { // Make the gRPC request to retrieve data by ID res, err := integrationFixture.ProductServiceClient.GetProductById( ctx, diff --git a/internal/services/catalog_write_service/test/integration/products/data/repositories/pg_product_repository_integration_test.go b/internal/services/catalogwriteservice/test/integration/products/data/repositories/pg_product_repository_integration_test.go similarity index 94% rename from internal/services/catalog_write_service/test/integration/products/data/repositories/pg_product_repository_integration_test.go rename to internal/services/catalogwriteservice/test/integration/products/data/repositories/pg_product_repository_integration_test.go index b8b8fa4b..58d5fc0e 100644 --- a/internal/services/catalog_write_service/test/integration/products/data/repositories/pg_product_repository_integration_test.go +++ b/internal/services/catalogwriteservice/test/integration/products/data/repositories/pg_product_repository_integration_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/models" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/shared/testfixtures/integration" @@ -44,7 +44,7 @@ var _ = Describe("Product Repository Suite", func() { By("Seeding the required data") integrationFixture.SetupTest() - id = integrationFixture.Items[0].ProductId + id = integrationFixture.Items[0].Id }) _ = AfterEach(func() { @@ -76,7 +76,7 @@ var _ = Describe("Product Repository Suite", func() { product = &models.Product{ Name: gofakeit.Name(), Description: gofakeit.AdjectiveDescriptive(), - ProductId: uuid.NewV4(), + Id: uuid.NewV4(), Price: gofakeit.Price(100, 1000), CreatedAt: time.Now(), } @@ -97,18 +97,18 @@ var _ = Describe("Product Repository Suite", func() { Expect(createdProduct).NotTo(BeNil()) }) - It("Should have the same ProductId as the input product", func() { - Expect(createdProduct.ProductId).To(Equal(product.ProductId)) + It("Should have the same Id as the input product", func() { + Expect(createdProduct.Id).To(Equal(product.Id)) }) It("Should be able to retrieve the created product from the database", func() { retrievedProduct, err := integrationFixture.ProductRepository.GetProductById( ctx, - createdProduct.ProductId, + createdProduct.Id, ) Expect(err).NotTo(HaveOccurred()) Expect(retrievedProduct).NotTo(BeNil()) - Expect(retrievedProduct.ProductId).To(Equal(createdProduct.ProductId)) + Expect(retrievedProduct.ProductId).To(Equal(createdProduct.Id)) }) }) }) @@ -137,7 +137,7 @@ var _ = Describe("Product Repository Suite", func() { It("Should be able to retrieve the updated product from the database", func() { updatedProduct, err = integrationFixture.ProductRepository.GetProductById( ctx, - existingProduct.ProductId, + existingProduct.Id, ) Expect(err).To(BeNil()) Expect(updatedProduct).NotTo(BeNil()) @@ -196,7 +196,7 @@ var _ = Describe("Product Repository Suite", func() { }) It("should retrieve correct data from database by Id", func() { - Expect(existingProduct.ProductId).To(Equal(id)) + Expect(existingProduct.Id).To(Equal(id)) }) }) }) diff --git a/internal/services/catalog_write_service/test/integration/products/data/uow/catalogs_unit_of_work_integration_test.go b/internal/services/catalogwriteservice/test/integration/products/data/uow/catalogs_unit_of_work_integration_test.go similarity index 97% rename from internal/services/catalog_write_service/test/integration/products/data/uow/catalogs_unit_of_work_integration_test.go rename to internal/services/catalogwriteservice/test/integration/products/data/uow/catalogs_unit_of_work_integration_test.go index d4045033..5853b6a9 100644 --- a/internal/services/catalog_write_service/test/integration/products/data/uow/catalogs_unit_of_work_integration_test.go +++ b/internal/services/catalogwriteservice/test/integration/products/data/uow/catalogs_unit_of_work_integration_test.go @@ -58,7 +58,7 @@ var _ = Describe("CatalogsUnitOfWork Feature", func() { &models.Product{ Name: gofakeit.Name(), Description: gofakeit.AdjectiveDescriptive(), - ProductId: uuid.NewV4(), + Id: uuid.NewV4(), Price: gofakeit.Price(100, 1000), CreatedAt: time.Now(), }) @@ -87,7 +87,7 @@ var _ = Describe("CatalogsUnitOfWork Feature", func() { &models.Product{ Name: gofakeit.Name(), Description: gofakeit.AdjectiveDescriptive(), - ProductId: uuid.NewV4(), + Id: uuid.NewV4(), Price: gofakeit.Price(100, 1000), CreatedAt: time.Now(), }) @@ -119,7 +119,7 @@ var _ = Describe("CatalogsUnitOfWork Feature", func() { &models.Product{ Name: gofakeit.Name(), Description: gofakeit.AdjectiveDescriptive(), - ProductId: uuid.NewV4(), + Id: uuid.NewV4(), Price: gofakeit.Price(100, 1000), CreatedAt: time.Now(), }) @@ -129,7 +129,7 @@ var _ = Describe("CatalogsUnitOfWork Feature", func() { &models.Product{ Name: gofakeit.Name(), Description: gofakeit.AdjectiveDescriptive(), - ProductId: uuid.NewV4(), + Id: uuid.NewV4(), Price: gofakeit.Price(100, 1000), CreatedAt: time.Now(), }) @@ -160,7 +160,7 @@ var _ = Describe("CatalogsUnitOfWork Feature", func() { &models.Product{ Name: gofakeit.Name(), Description: gofakeit.AdjectiveDescriptive(), - ProductId: uuid.NewV4(), + Id: uuid.NewV4(), Price: gofakeit.Price(100, 1000), CreatedAt: time.Now(), }) diff --git a/internal/services/catalog_write_service/test/integration/products/features/creatingproduct/v1/create_product_test.go b/internal/services/catalogwriteservice/test/integration/products/features/creatingproduct/v1/create_product_test.go similarity index 98% rename from internal/services/catalog_write_service/test/integration/products/features/creatingproduct/v1/create_product_test.go rename to internal/services/catalogwriteservice/test/integration/products/features/creatingproduct/v1/create_product_test.go index 88748d75..c561502b 100644 --- a/internal/services/catalog_write_service/test/integration/products/features/creatingproduct/v1/create_product_test.go +++ b/internal/services/catalogwriteservice/test/integration/products/features/creatingproduct/v1/create_product_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/test/hypothesis" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/test/messaging" createProductCommand "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1" @@ -52,7 +52,7 @@ var _ = Describe("Creating Product Feature", func() { integrationFixture.SetupTest() // child hook codes should be here - id = integrationFixture.Items[0].ProductId + id = integrationFixture.Items[0].Id }) _ = AfterEach(func() { diff --git a/internal/services/catalog_write_service/test/integration/products/features/deletingproduct/v1/delete_product_test.go b/internal/services/catalogwriteservice/test/integration/products/features/deletingproduct/v1/delete_product_test.go similarity index 98% rename from internal/services/catalog_write_service/test/integration/products/features/deletingproduct/v1/delete_product_test.go rename to internal/services/catalogwriteservice/test/integration/products/features/deletingproduct/v1/delete_product_test.go index 80d20531..759b8a23 100644 --- a/internal/services/catalog_write_service/test/integration/products/features/deletingproduct/v1/delete_product_test.go +++ b/internal/services/catalogwriteservice/test/integration/products/features/deletingproduct/v1/delete_product_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/test/hypothesis" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/test/messaging" v1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1" @@ -50,7 +50,7 @@ var _ = Describe("Delete Product Feature", func() { integrationFixture.SetupTest() // child hook codes should be here - id = integrationFixture.Items[0].ProductId + id = integrationFixture.Items[0].Id }) _ = AfterEach(func() { diff --git a/internal/services/catalog_write_service/test/integration/products/features/gettingproductbyid/v1/get_product_by_id_test.go b/internal/services/catalogwriteservice/test/integration/products/features/gettingproductbyid/v1/get_product_by_id_test.go similarity index 98% rename from internal/services/catalog_write_service/test/integration/products/features/gettingproductbyid/v1/get_product_by_id_test.go rename to internal/services/catalogwriteservice/test/integration/products/features/gettingproductbyid/v1/get_product_by_id_test.go index 1d1cdbca..b92e0ceb 100644 --- a/internal/services/catalog_write_service/test/integration/products/features/gettingproductbyid/v1/get_product_by_id_test.go +++ b/internal/services/catalogwriteservice/test/integration/products/features/gettingproductbyid/v1/get_product_by_id_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" getProductByIdQuery "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1/dtos" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/shared/testfixtures/integration" @@ -44,7 +44,7 @@ var _ = Describe("Get Product by ID Feature", func() { integrationFixture.SetupTest() // child hook codes should be here - id = integrationFixture.Items[0].ProductId + id = integrationFixture.Items[0].Id }) _ = AfterEach(func() { diff --git a/internal/services/catalog_write_service/test/integration/products/features/gettingproducts/v1/get_products_test.go b/internal/services/catalogwriteservice/test/integration/products/features/gettingproducts/v1/get_products_test.go similarity index 97% rename from internal/services/catalog_write_service/test/integration/products/features/gettingproducts/v1/get_products_test.go rename to internal/services/catalogwriteservice/test/integration/products/features/gettingproducts/v1/get_products_test.go index 34b00d42..c5e2193c 100644 --- a/internal/services/catalog_write_service/test/integration/products/features/gettingproducts/v1/get_products_test.go +++ b/internal/services/catalogwriteservice/test/integration/products/features/gettingproducts/v1/get_products_test.go @@ -9,8 +9,8 @@ import ( "time" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" - gettingproductsv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/getting_products/v1" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/getting_products/v1/dtos" + gettingproductsv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1/dtos" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/shared/testfixtures/integration" "github.com/mehdihadeli/go-mediatr" diff --git a/internal/services/catalog_write_service/test/integration/products/features/updatingproduct/v1/update_product_test.go b/internal/services/catalogwriteservice/test/integration/products/features/updatingproduct/v1/update_product_test.go similarity index 96% rename from internal/services/catalog_write_service/test/integration/products/features/updatingproduct/v1/update_product_test.go rename to internal/services/catalogwriteservice/test/integration/products/features/updatingproduct/v1/update_product_test.go index f97365c2..c3fd60db 100644 --- a/internal/services/catalog_write_service/test/integration/products/features/updatingproduct/v1/update_product_test.go +++ b/internal/services/catalogwriteservice/test/integration/products/features/updatingproduct/v1/update_product_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/test/hypothesis" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/test/messaging" datamodel "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/data/models" @@ -80,7 +80,7 @@ var _ = Describe("Update Product Feature", func() { Context("Given product exists in the database", func() { BeforeEach(func() { command, err = v1.NewUpdateProduct( - existingProduct.ProductId, + existingProduct.Id, "Updated Product Name", existingProduct.Description, existingProduct.Price, @@ -112,13 +112,13 @@ var _ = Describe("Update Product Feature", func() { func() { updatedProduct, err := integrationFixture.CatalogsDBContext.FindProductByID( ctx, - existingProduct.ProductId, + existingProduct.Id, ) Expect(err).To(BeNil()) Expect(updatedProduct).NotTo(BeNil()) Expect( - updatedProduct.ProductId, - ).To(Equal(existingProduct.ProductId)) + updatedProduct.Id, + ).To(Equal(existingProduct.Id)) Expect( updatedProduct.Price, ).To(Equal(existingProduct.Price)) @@ -192,7 +192,7 @@ var _ = Describe("Update Product Feature", func() { Context("Given product exists in the database", func() { BeforeEach(func() { command, err = v1.NewUpdateProduct( - existingProduct.ProductId, + existingProduct.Id, "Updated Product Name", existingProduct.Description, existingProduct.Price, diff --git a/internal/services/catalog_write_service/test/load/.openapi-generator-ignore b/internal/services/catalogwriteservice/test/load/.openapi-generator-ignore similarity index 100% rename from internal/services/catalog_write_service/test/load/.openapi-generator-ignore rename to internal/services/catalogwriteservice/test/load/.openapi-generator-ignore diff --git a/internal/services/catalog_write_service/test/load/.openapi-generator/FILES b/internal/services/catalogwriteservice/test/load/.openapi-generator/FILES similarity index 100% rename from internal/services/catalog_write_service/test/load/.openapi-generator/FILES rename to internal/services/catalogwriteservice/test/load/.openapi-generator/FILES diff --git a/internal/services/catalog_write_service/test/load/.openapi-generator/VERSION b/internal/services/catalogwriteservice/test/load/.openapi-generator/VERSION similarity index 100% rename from internal/services/catalog_write_service/test/load/.openapi-generator/VERSION rename to internal/services/catalogwriteservice/test/load/.openapi-generator/VERSION diff --git a/internal/services/catalog_write_service/test/load/README.md b/internal/services/catalogwriteservice/test/load/README.md similarity index 100% rename from internal/services/catalog_write_service/test/load/README.md rename to internal/services/catalogwriteservice/test/load/README.md diff --git a/internal/services/catalog_write_service/test/load/script.js b/internal/services/catalogwriteservice/test/load/script.js similarity index 100% rename from internal/services/catalog_write_service/test/load/script.js rename to internal/services/catalogwriteservice/test/load/script.js diff --git a/internal/services/catalog_write_service/test/unit/products/features/creatingproduct/v1/create_product_handler_unit_test.go b/internal/services/catalogwriteservice/test/unit/products/features/creatingproduct/v1/create_product_handler_unit_test.go similarity index 98% rename from internal/services/catalog_write_service/test/unit/products/features/creatingproduct/v1/create_product_handler_unit_test.go rename to internal/services/catalogwriteservice/test/unit/products/features/creatingproduct/v1/create_product_handler_unit_test.go index a2cd30f6..af38d30e 100644 --- a/internal/services/catalog_write_service/test/unit/products/features/creatingproduct/v1/create_product_handler_unit_test.go +++ b/internal/services/catalogwriteservice/test/unit/products/features/creatingproduct/v1/create_product_handler_unit_test.go @@ -8,7 +8,7 @@ import ( "time" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/cqrs" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams" creatingproductv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/creatingproduct/v1" @@ -74,7 +74,7 @@ func (c *createProductHandlerUnitTests) Test_Handle_Should_Create_New_Product_Wi res, err := c.CatalogDBContext.FindProductByID(c.Ctx, id) c.Require().NoError(err) - c.Assert().Equal(res.ProductId, id) + c.Assert().Equal(res.Id, id) } func (c *createProductHandlerUnitTests) Test_Handle_Should_Return_Error_For_Duplicate_Item() { diff --git a/internal/services/catalog_write_service/test/unit/products/features/creatingproduct/v1/create_product_unit_test.go b/internal/services/catalogwriteservice/test/unit/products/features/creatingproduct/v1/create_product_unit_test.go similarity index 100% rename from internal/services/catalog_write_service/test/unit/products/features/creatingproduct/v1/create_product_unit_test.go rename to internal/services/catalogwriteservice/test/unit/products/features/creatingproduct/v1/create_product_unit_test.go diff --git a/internal/services/catalog_write_service/test/unit/products/features/deletingproduct/v1/delete_product_handler_unit_test.go b/internal/services/catalogwriteservice/test/unit/products/features/deletingproduct/v1/delete_product_handler_unit_test.go similarity index 96% rename from internal/services/catalog_write_service/test/unit/products/features/deletingproduct/v1/delete_product_handler_unit_test.go rename to internal/services/catalogwriteservice/test/unit/products/features/deletingproduct/v1/delete_product_handler_unit_test.go index 7a551929..ad12a250 100644 --- a/internal/services/catalog_write_service/test/unit/products/features/deletingproduct/v1/delete_product_handler_unit_test.go +++ b/internal/services/catalogwriteservice/test/unit/products/features/deletingproduct/v1/delete_product_handler_unit_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/cqrs" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams" deletingproductv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/deletingproduct/v1" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/shared/testfixtures/unittest" @@ -53,7 +53,7 @@ func (c *deleteProductHandlerUnitTests) TearDownTest() { } func (c *deleteProductHandlerUnitTests) Test_Handle_Should_Delete_Product_With_Valid_Id() { - id := c.Products[0].ProductId + id := c.Products[0].Id deleteProduct := &deletingproductv1.DeleteProduct{ ProductID: id, @@ -92,7 +92,7 @@ func (c *deleteProductHandlerUnitTests) Test_Handle_Should_Return_NotFound_Error } func (c *deleteProductHandlerUnitTests) Test_Handle_Should_Return_Error_For_Error_In_Bus() { - id := c.Products[0].ProductId + id := c.Products[0].Id deleteProduct := &deletingproductv1.DeleteProduct{ ProductID: id, diff --git a/internal/services/catalog_write_service/test/unit/products/features/deletingproduct/v1/delete_product_unit_test.go b/internal/services/catalogwriteservice/test/unit/products/features/deletingproduct/v1/delete_product_unit_test.go similarity index 100% rename from internal/services/catalog_write_service/test/unit/products/features/deletingproduct/v1/delete_product_unit_test.go rename to internal/services/catalogwriteservice/test/unit/products/features/deletingproduct/v1/delete_product_unit_test.go diff --git a/internal/services/catalog_write_service/test/unit/products/features/gettingproductbyid/v1/get_product_by_Id_unit_test.go b/internal/services/catalogwriteservice/test/unit/products/features/gettingproductbyid/v1/get_product_by_Id_unit_test.go similarity index 100% rename from internal/services/catalog_write_service/test/unit/products/features/gettingproductbyid/v1/get_product_by_Id_unit_test.go rename to internal/services/catalogwriteservice/test/unit/products/features/gettingproductbyid/v1/get_product_by_Id_unit_test.go diff --git a/internal/services/catalog_write_service/test/unit/products/features/gettingproductbyid/v1/get_product_by_id_handler_unit_test.go b/internal/services/catalogwriteservice/test/unit/products/features/gettingproductbyid/v1/get_product_by_id_handler_unit_test.go similarity index 92% rename from internal/services/catalog_write_service/test/unit/products/features/gettingproductbyid/v1/get_product_by_id_handler_unit_test.go rename to internal/services/catalogwriteservice/test/unit/products/features/gettingproductbyid/v1/get_product_by_id_handler_unit_test.go index 7daf7d12..24912f25 100644 --- a/internal/services/catalog_write_service/test/unit/products/features/gettingproductbyid/v1/get_product_by_id_handler_unit_test.go +++ b/internal/services/catalogwriteservice/test/unit/products/features/gettingproductbyid/v1/get_product_by_id_handler_unit_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/cqrs" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams" gettingproductbyidv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/gettingproductbyid/v1" @@ -50,14 +50,14 @@ func (c *getProductByIdHandlerTest) TearDownTest() { func (c *getProductByIdHandlerTest) Test_Handle_Should_Return_Correct_Product_By_ID() { product := c.Products[0] - query, err := gettingproductbyidv1.NewGetProductById(product.ProductId) + query, err := gettingproductbyidv1.NewGetProductById(product.Id) c.Require().NoError(err) dto, err := c.handler.Handle(c.Ctx, query) c.Require().NoError(err) c.Assert().NotNil(dto) c.Assert().NotNil(dto.Product) - c.Assert().Equal(dto.Product.ProductId, product.ProductId) + c.Assert().Equal(dto.Product.ProductId, product.Id) c.Assert().Equal(dto.Product.Name, product.Name) } @@ -85,7 +85,7 @@ func (c *getProductByIdHandlerTest) Test_Handle_Should_Return_Error_For_Error_In product := c.Products[0] - query, err := gettingproductbyidv1.NewGetProductById(product.ProductId) + query, err := gettingproductbyidv1.NewGetProductById(product.Id) c.Require().NoError(err) dto, err := c.handler.Handle(c.Ctx, query) diff --git a/internal/services/catalog_write_service/test/unit/products/features/gettingproducts/v1/get_products_handler_unit_test.go b/internal/services/catalogwriteservice/test/unit/products/features/gettingproducts/v1/get_products_handler_unit_test.go similarity index 94% rename from internal/services/catalog_write_service/test/unit/products/features/gettingproducts/v1/get_products_handler_unit_test.go rename to internal/services/catalogwriteservice/test/unit/products/features/gettingproducts/v1/get_products_handler_unit_test.go index 74a3b12a..4efc434e 100644 --- a/internal/services/catalog_write_service/test/unit/products/features/gettingproducts/v1/get_products_handler_unit_test.go +++ b/internal/services/catalogwriteservice/test/unit/products/features/gettingproducts/v1/get_products_handler_unit_test.go @@ -8,12 +8,12 @@ import ( "testing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/cqrs" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams" - gettingproductsv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/getting_products/v1" - "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/getting_products/v1/dtos" + gettingproductsv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1" + "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/gettingproducts/v1/dtos" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/shared/testfixtures/unittest" "github.com/stretchr/testify/suite" diff --git a/internal/services/catalog_write_service/test/unit/products/features/searchingproducts/v1/search_products_unit_test.go b/internal/services/catalogwriteservice/test/unit/products/features/searchingproducts/v1/search_products_unit_test.go similarity index 98% rename from internal/services/catalog_write_service/test/unit/products/features/searchingproducts/v1/search_products_unit_test.go rename to internal/services/catalogwriteservice/test/unit/products/features/searchingproducts/v1/search_products_unit_test.go index 7f199cc5..ea5db3ea 100644 --- a/internal/services/catalog_write_service/test/unit/products/features/searchingproducts/v1/search_products_unit_test.go +++ b/internal/services/catalogwriteservice/test/unit/products/features/searchingproducts/v1/search_products_unit_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/cqrs" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams" diff --git a/internal/services/catalog_write_service/test/unit/products/features/updatingproduct/v1/update_product_handler_unit_test.go b/internal/services/catalogwriteservice/test/unit/products/features/updatingproduct/v1/update_product_handler_unit_test.go similarity index 92% rename from internal/services/catalog_write_service/test/unit/products/features/updatingproduct/v1/update_product_handler_unit_test.go rename to internal/services/catalogwriteservice/test/unit/products/features/updatingproduct/v1/update_product_handler_unit_test.go index efd27042..961fd945 100644 --- a/internal/services/catalog_write_service/test/unit/products/features/updatingproduct/v1/update_product_handler_unit_test.go +++ b/internal/services/catalogwriteservice/test/unit/products/features/updatingproduct/v1/update_product_handler_unit_test.go @@ -9,7 +9,7 @@ import ( "testing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/cqrs" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/dtos/v1/fxparams" updatingoroductsv1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/products/features/updatingproduct/v1" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/catalogwriteservice/internal/shared/testfixtures/unittest" @@ -37,7 +37,7 @@ func TestUpdateProductHandlerUnit(t *testing.T) { } func (c *updateProductHandlerUnitTests) SetupTest() { - // call base SetupTest hook before running child hook + // call base `SetupTest hook` before running child hook c.UnitTestSharedFixture.SetupTest() c.handler = updatingoroductsv1.NewUpdateProductHandler( fxparams.ProductHandlerParams{ @@ -50,7 +50,7 @@ func (c *updateProductHandlerUnitTests) SetupTest() { } func (c *updateProductHandlerUnitTests) TearDownTest() { - // call base TearDownTest hook before running child hook + // call base `TearDownTest hook` before running child hook c.UnitTestSharedFixture.TearDownTest() } @@ -58,7 +58,7 @@ func (c *updateProductHandlerUnitTests) Test_Handle_Should_Update_Product_With_V existing := c.Products[0] updateProductCommand, err := updatingoroductsv1.NewUpdateProduct( - existing.ProductId, + existing.Id, gofakeit.Name(), gofakeit.EmojiDescription(), existing.Price, @@ -77,7 +77,7 @@ func (c *updateProductHandlerUnitTests) Test_Handle_Should_Update_Product_With_V ) c.Require().NoError(err) - c.Assert().Equal(updatedProduct.ProductId, updateProductCommand.ProductID) + c.Assert().Equal(updatedProduct.Id, updateProductCommand.ProductID) c.Assert().Equal(updatedProduct.Name, updateProductCommand.Name) c.Bus.AssertNumberOfCalls(c.T(), "PublishMessage", 1) } @@ -109,7 +109,7 @@ func (c *updateProductHandlerUnitTests) Test_Handle_Should_Return_Error_For_Erro existing := c.Products[0] updateProductCommand, err := updatingoroductsv1.NewUpdateProduct( - existing.ProductId, + existing.Id, gofakeit.Name(), gofakeit.EmojiDescription(), existing.Price, diff --git a/internal/services/catalog_write_service/test/unit/products/features/updatingproduct/v1/update_product_unit_test.go b/internal/services/catalogwriteservice/test/unit/products/features/updatingproduct/v1/update_product_unit_test.go similarity index 100% rename from internal/services/catalog_write_service/test/unit/products/features/updatingproduct/v1/update_product_unit_test.go rename to internal/services/catalogwriteservice/test/unit/products/features/updatingproduct/v1/update_product_unit_test.go diff --git a/internal/services/catalog_write_service/test/unit/products/mappings_profile_test.go b/internal/services/catalogwriteservice/test/unit/products/mappings_profile_test.go similarity index 94% rename from internal/services/catalog_write_service/test/unit/products/mappings_profile_test.go rename to internal/services/catalogwriteservice/test/unit/products/mappings_profile_test.go index 38a45fbd..f675268b 100644 --- a/internal/services/catalog_write_service/test/unit/products/mappings_profile_test.go +++ b/internal/services/catalogwriteservice/test/unit/products/mappings_profile_test.go @@ -30,7 +30,7 @@ func TestMappingProfileUnit(t *testing.T) { func (m *mappingProfileUnitTests) Test_Mappings() { productModel := &models.Product{ - ProductId: uuid.NewV4(), + Id: uuid.NewV4(), Name: gofakeit.Name(), CreatedAt: time.Now(), Description: gofakeit.EmojiDescription(), @@ -48,7 +48,7 @@ func (m *mappingProfileUnitTests) Test_Mappings() { m.Run("Should_Map_Product_To_ProductDto", func() { d, err := mapper.Map[*dtoV1.ProductDto](productModel) m.Require().NoError(err) - m.Equal(productModel.ProductId, d.ProductId) + m.Equal(productModel.Id, d.ProductId) m.Equal(productModel.Name, d.Name) }) @@ -61,7 +61,7 @@ func (m *mappingProfileUnitTests) Test_Mappings() { m.Run("Should_Map_ProductDto_To_Product", func() { d, err := mapper.Map[*models.Product](productDto) m.Require().NoError(err) - m.Equal(productDto.ProductId, d.ProductId) + m.Equal(productDto.ProductId, d.Id) m.Equal(productDto.Name, d.Name) }) diff --git a/internal/services/order_service/.env b/internal/services/order_service/.env deleted file mode 100644 index d883e79f..00000000 --- a/internal/services/order_service/.env +++ /dev/null @@ -1 +0,0 @@ -PROJECT_NAME=order_service diff --git a/internal/services/order_service/.air.toml b/internal/services/orderservice/.air.toml similarity index 100% rename from internal/services/order_service/.air.toml rename to internal/services/orderservice/.air.toml diff --git a/internal/services/order_service/.dockerignore b/internal/services/orderservice/.dockerignore similarity index 100% rename from internal/services/order_service/.dockerignore rename to internal/services/orderservice/.dockerignore diff --git a/internal/services/orderservice/.env b/internal/services/orderservice/.env new file mode 100644 index 00000000..0cedb4bf --- /dev/null +++ b/internal/services/orderservice/.env @@ -0,0 +1 @@ +PROJECT_NAME=orderservice diff --git a/internal/services/order_service/.golangci.yml b/internal/services/orderservice/.golangci.yml similarity index 100% rename from internal/services/order_service/.golangci.yml rename to internal/services/orderservice/.golangci.yml diff --git a/internal/services/order_service/Dockerfile b/internal/services/orderservice/Dockerfile similarity index 100% rename from internal/services/order_service/Dockerfile rename to internal/services/orderservice/Dockerfile diff --git a/internal/services/order_service/Makefile b/internal/services/orderservice/Makefile similarity index 100% rename from internal/services/order_service/Makefile rename to internal/services/orderservice/Makefile diff --git a/internal/services/order_service/arch-go.yml b/internal/services/orderservice/arch-go.yml similarity index 100% rename from internal/services/order_service/arch-go.yml rename to internal/services/orderservice/arch-go.yml diff --git a/internal/services/order_service/client.http b/internal/services/orderservice/client.http similarity index 100% rename from internal/services/order_service/client.http rename to internal/services/orderservice/client.http diff --git a/internal/services/order_service/cmd/app/main.go b/internal/services/orderservice/cmd/app/main.go similarity index 100% rename from internal/services/order_service/cmd/app/main.go rename to internal/services/orderservice/cmd/app/main.go diff --git a/internal/services/order_service/cmd/migration/.gitkeep b/internal/services/orderservice/cmd/migration/.gitkeep similarity index 100% rename from internal/services/order_service/cmd/migration/.gitkeep rename to internal/services/orderservice/cmd/migration/.gitkeep diff --git a/internal/services/order_service/config/config.development.json b/internal/services/orderservice/config/config.development.json similarity index 95% rename from internal/services/order_service/config/config.development.json rename to internal/services/orderservice/config/config.development.json index 059bf573..6e8c1275 100644 --- a/internal/services/order_service/config/config.development.json +++ b/internal/services/orderservice/config/config.development.json @@ -1,16 +1,16 @@ { "appOptions": { - "serviceName": "order_service", + "serviceName": "orderservice", "deliveryType": "http" }, "grpcOptions": { - "name": "order_service", + "name": "orderservice", "port": ":6005", "host": "localhost", "development": true }, "echoHttpOptions": { - "name": "order_service", + "name": "orderservice", "port": ":8000", "development": true, "timeout": 30, diff --git a/internal/services/order_service/config/config.go b/internal/services/orderservice/config/config.go similarity index 100% rename from internal/services/order_service/config/config.go rename to internal/services/orderservice/config/config.go diff --git a/internal/services/order_service/config/config.test.json b/internal/services/orderservice/config/config.test.json similarity index 95% rename from internal/services/order_service/config/config.test.json rename to internal/services/orderservice/config/config.test.json index c9f14c9c..a416ed3a 100644 --- a/internal/services/order_service/config/config.test.json +++ b/internal/services/orderservice/config/config.test.json @@ -1,16 +1,16 @@ { "appOptions": { - "serviceName": "order_service", + "serviceName": "orderservice", "deliveryType": "http" }, "grpcOptions": { - "name": "order_service", + "name": "orderservice", "port": ":3302", "host": "localhost", "development": true }, "echoHttpOptions": { - "name": "order_service", + "name": "orderservice", "port": ":6002", "development": true, "timeout": 30, diff --git a/internal/services/order_service/config/config_fx.go b/internal/services/orderservice/config/config_fx.go similarity index 100% rename from internal/services/order_service/config/config_fx.go rename to internal/services/orderservice/config/config_fx.go diff --git a/internal/services/order_service/docs/docs.go b/internal/services/orderservice/docs/docs.go similarity index 100% rename from internal/services/order_service/docs/docs.go rename to internal/services/orderservice/docs/docs.go diff --git a/internal/services/order_service/docs/swagger.json b/internal/services/orderservice/docs/swagger.json similarity index 100% rename from internal/services/order_service/docs/swagger.json rename to internal/services/orderservice/docs/swagger.json diff --git a/internal/services/order_service/docs/swagger.yaml b/internal/services/orderservice/docs/swagger.yaml similarity index 100% rename from internal/services/order_service/docs/swagger.yaml rename to internal/services/orderservice/docs/swagger.yaml diff --git a/internal/services/order_service/go.mod b/internal/services/orderservice/go.mod similarity index 95% rename from internal/services/order_service/go.mod rename to internal/services/orderservice/go.mod index ceb5850d..21e775e4 100644 --- a/internal/services/order_service/go.mod +++ b/internal/services/orderservice/go.mod @@ -8,7 +8,7 @@ replace github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg => ../../ require ( emperror.dev/errors v0.8.1 github.com/EventStore/EventStore-Client-Go v1.0.2 - github.com/brianvoe/gofakeit/v6 v6.23.2 + github.com/brianvoe/gofakeit/v6 v6.25.0 github.com/elastic/go-elasticsearch/v8 v8.10.0 github.com/gavv/httpexpect/v2 v2.15.0 github.com/go-ozzo/ozzo-validation v3.6.0+incompatible @@ -66,11 +66,14 @@ require ( github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/doug-martin/goqu/v9 v9.18.0 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect github.com/elastic/elastic-transport-go/v8 v8.3.0 // indirect github.com/fatih/color v1.15.0 // indirect github.com/fatih/structs v1.1.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect + github.com/glebarez/go-sqlite v1.21.2 // indirect + github.com/glebarez/sqlite v1.10.0 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -154,6 +157,7 @@ require ( github.com/redis/go-redis/extra/rediscmd/v9 v9.0.5 // indirect github.com/redis/go-redis/extra/redisotel/v9 v9.0.5 // indirect github.com/redis/go-redis/v9 v9.2.1 // indirect + github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/samber/lo v1.38.1 // indirect github.com/sanity-io/litter v1.5.5 // indirect @@ -173,13 +177,14 @@ require ( github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect + github.com/ulule/limiter/v3 v3.11.2 // indirect github.com/uptrace/bun v1.1.16 // indirect github.com/uptrace/bun/driver/pgdriver v1.1.16 // indirect github.com/uptrace/opentelemetry-go-extra/otellogrus v0.2.3 // indirect github.com/uptrace/opentelemetry-go-extra/otelutil v0.2.3 // indirect github.com/uptrace/opentelemetry-go-extra/otelzap v0.2.3 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect - github.com/valyala/fasthttp v1.34.0 // indirect + github.com/valyala/fasthttp v1.47.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect github.com/vmihailenco/msgpack/v5 v5.4.0 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect @@ -230,8 +235,12 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gorm.io/driver/postgres v1.5.2 // indirect - gorm.io/gorm v1.25.4 // indirect + gorm.io/gorm v1.25.5 // indirect gorm.io/plugin/opentelemetry v0.1.4 // indirect mellium.im/sasl v0.3.1 // indirect + modernc.org/libc v1.24.1 // indirect + modernc.org/mathutil v1.6.0 // indirect + modernc.org/memory v1.6.0 // indirect + modernc.org/sqlite v1.25.0 // indirect moul.io/http2curl/v2 v2.3.0 // indirect ) diff --git a/internal/services/order_service/go.sum b/internal/services/orderservice/go.sum similarity index 98% rename from internal/services/order_service/go.sum rename to internal/services/orderservice/go.sum index d849c313..909258ac 100644 --- a/internal/services/order_service/go.sum +++ b/internal/services/orderservice/go.sum @@ -93,7 +93,6 @@ github.com/ahmetb/go-linq/v3 v3.2.0 h1:BEuMfp+b59io8g5wYzNoFe9pWPalRklhlhbiU3hYZ github.com/ahmetb/go-linq/v3 v3.2.0/go.mod h1:haQ3JfOeWK8HpVxMtHHEMPVgBKiYyQ+f1/kLZh/cj9U= github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= -github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de h1:FxWPpzIjnTlhPwqqXc4/vE0f7GvRjuAsbW+HOIe8KnA= @@ -108,8 +107,8 @@ github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/brianvoe/gofakeit/v6 v6.23.2 h1:lVde18uhad5wII/f5RMVFLtdQNE0HaGFuBUXmYKk8i8= -github.com/brianvoe/gofakeit/v6 v6.23.2/go.mod h1:Ow6qC71xtwm79anlwKRlWZW6zVq9D2XHE4QSSMP/rU8= +github.com/brianvoe/gofakeit/v6 v6.25.0 h1:ZpFjktOpLZUeF8q223o0rUuXtA+m5qW5srjvVi+JkXk= +github.com/brianvoe/gofakeit/v6 v6.25.0/go.mod h1:Xj58BMSnFqcn/fAQeSK+/PLtC5kSb7FJIq4JyGa8vEs= github.com/bsm/ginkgo/v2 v2.7.0/go.mod h1:AiKlXPm7ItEHNc/2+OkrNG4E0ITzojb9/xWzvQ9XZ9w= github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= @@ -179,6 +178,8 @@ github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD github.com/doug-martin/goqu/v9 v9.18.0 h1:/6bcuEtAe6nsSMVK/M+fOiXUNfyFF3yYtE07DBPFMYY= github.com/doug-martin/goqu/v9 v9.18.0/go.mod h1:nf0Wc2/hV3gYK9LiyqIrzBEVGlI8qW3GuDCEobC4wBQ= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/elastic/elastic-transport-go/v8 v8.0.0-20230329154755-1a3c63de0db6/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= github.com/elastic/elastic-transport-go/v8 v8.3.0 h1:DJGxovyQLXGr62e9nDMPSxRyWION0Bh6d9eCFBriiHo= github.com/elastic/elastic-transport-go/v8 v8.3.0/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= @@ -207,6 +208,10 @@ github.com/gavv/httpexpect/v2 v2.15.0 h1:CCnFk9of4l4ijUhnMxyoEpJsIIBKcuWIFLMwwGT github.com/gavv/httpexpect/v2 v2.15.0/go.mod h1:7myOP3A3VyS4+qnA4cm8DAad8zMN+7zxDB80W9f8yIc= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/glebarez/go-sqlite v1.21.2 h1:3a6LFC4sKahUunAmynQKLZceZCOzUthkRkEAl9gAXWo= +github.com/glebarez/go-sqlite v1.21.2/go.mod h1:sfxdZyhQjTM2Wry3gVYWaW072Ri1WMdWJi0k6+3382k= +github.com/glebarez/sqlite v1.10.0 h1:u4gt8y7OND/cCei/NMHmfbLxF6xP2wgKcT/BJf2pYkc= +github.com/glebarez/sqlite v1.10.0/go.mod h1:IJ+lfSOmiekhQsFTJRx/lHtGYmCdtAiTaf5wI9u5uHA= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -443,7 +448,6 @@ github.com/kamva/mgm/v3 v3.5.0/go.mod h1:F4J1hZnXQMkqL3DZgR7Z7BOuiTqQG/JTic3Yzli github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= @@ -517,10 +521,6 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zk github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mcuadros/go-defaults v1.2.0 h1:FODb8WSf0uGaY8elWJAkoLL0Ri6AlZ1bFlenk56oZtc= github.com/mcuadros/go-defaults v1.2.0/go.mod h1:WEZtHEVIGYVDqkKSWBdWKUVdRyKlMfulPaGDWIVeCWY= -github.com/mehdihadeli/go-mediatr v1.1.10 h1:NAzg4065c90lgYeb+Vzbd2WKH0tUFpxzL0mpx6hkU/A= -github.com/mehdihadeli/go-mediatr v1.1.10/go.mod h1:lwgZl7qVL/RKomObBblhG3uEte/r4nJDV95Vd+nGrMw= -github.com/mehdihadeli/go-mediatr v1.2.0 h1:XkzYF/uGfW4pwPWYAxKyY+mO6l989PbmCQWSYHuCZtU= -github.com/mehdihadeli/go-mediatr v1.2.0/go.mod h1:I9LuExxAKz6cTDJyP/SSDSmkHaPHK1/usnvEXjUY47k= github.com/mehdihadeli/go-mediatr v1.3.0 h1:hrb5Scp/nsiR3Y62mjZ0Tc5UX/dRJl4nDFkINBEIESA= github.com/mehdihadeli/go-mediatr v1.3.0/go.mod h1:lsG+hyH+pEOhmZiZl0KPO72BcZiEReF03CBk4GVJB0k= github.com/michaelklishin/rabbit-hole v1.5.0 h1:Bex27BiFDsijCM9D0ezSHqyy0kehpYHuNKaPqq/a4RM= @@ -620,6 +620,8 @@ github.com/redis/go-redis/extra/redisotel/v9 v9.0.5/go.mod h1:WZjPDy7VNzn77AAfnA github.com/redis/go-redis/v9 v9.0.5/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk= github.com/redis/go-redis/v9 v9.2.1 h1:WlYJg71ODF0dVspZZCpYmoF1+U1Jjk9Rwd7pq6QmlCg= github.com/redis/go-redis/v9 v9.2.1/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= @@ -716,6 +718,8 @@ github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+F github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= +github.com/ulule/limiter/v3 v3.11.2 h1:P4yOrxoEMJbOTfRJR2OzjL90oflzYPPmWg+dvwN2tHA= +github.com/ulule/limiter/v3 v3.11.2/go.mod h1:QG5GnFOCV+k7lrL5Y8kgEeeflPH3+Cviqlqa8SVSQxI= github.com/uptrace/bun v1.1.16 h1:cn9cgEMFwcyYRsQLfxCRMUxyK1WaHwOVrR3TvzEFZ/A= github.com/uptrace/bun v1.1.16/go.mod h1:7HnsMRRvpLFUcquJxp22JO8PsWKpFQO/gNXqqsuGWg8= github.com/uptrace/bun/driver/pgdriver v1.1.16 h1:b/NiSXk6Ldw7KLfMLbOqIkm4odHd7QiNOCPLqPFJjK4= @@ -729,12 +733,11 @@ github.com/uptrace/opentelemetry-go-extra/otelzap v0.2.3/go.mod h1:9IVEh9mPv3NwF github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.34.0 h1:d3AAQJ2DRcxJYHm7OXNXtXt2as1vMDfxeIcFvhmGGm4= -github.com/valyala/fasthttp v1.34.0/go.mod h1:epZA5N+7pY6ZaEKRmstzOuYJx9HI8DI1oaCGZpdH4h0= +github.com/valyala/fasthttp v1.47.0 h1:y7moDoxYzMooFpT5aHgNgVOQDrS3qlkfiP9mDtGGK9c= +github.com/valyala/fasthttp v1.47.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= github.com/vmihailenco/msgpack/v5 v5.4.0 h1:hRM0digJwyR6vll33NNAwCFguy5JuBD6jxDmQP3l608= @@ -868,7 +871,6 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= @@ -951,7 +953,6 @@ golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= @@ -1045,8 +1046,6 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1295,8 +1294,8 @@ gorm.io/driver/postgres v1.5.2 h1:ytTDxxEv+MplXOfFe3Lzm7SjG09fcdb3Z/c056DTBx0= gorm.io/driver/postgres v1.5.2/go.mod h1:fmpX0m2I1PKuR7mKZiEluwrP3hbs+ps7JIGMUBpCgl8= gorm.io/driver/sqlite v1.5.0 h1:zKYbzRCpBrT1bNijRnxLDJWPjVfImGEn0lSnUY5gZ+c= gorm.io/driver/sqlite v1.5.0/go.mod h1:kDMDfntV9u/vuMmz8APHtHF0b4nyBB7sfCieC6G8k8I= -gorm.io/gorm v1.25.4 h1:iyNd8fNAe8W9dvtlgeRI5zSVZPsq3OpcTu37cYcpCmw= -gorm.io/gorm v1.25.4/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls= +gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= gorm.io/plugin/opentelemetry v0.1.4 h1:7p0ocWELjSSRI7NCKPW2mVe6h43YPini99sNJcbsTuc= gorm.io/plugin/opentelemetry v0.1.4/go.mod h1:tndJHOdvPT0pyGhOb8E2209eXJCUxhC5UpKw7bGVWeI= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= @@ -1311,6 +1310,14 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= mellium.im/sasl v0.3.1 h1:wE0LW6g7U83vhvxjC1IY8DnXM+EU095yeo8XClvCdfo= mellium.im/sasl v0.3.1/go.mod h1:xm59PUYpZHhgQ9ZqoJ5QaCqzWMi8IeS49dhp6plPCzw= +modernc.org/libc v1.24.1 h1:uvJSeCKL/AgzBo2yYIPPTy82v21KgGnizcGYfBHaNuM= +modernc.org/libc v1.24.1/go.mod h1:FmfO1RLrU3MHJfyi9eYYmZBfi/R+tqZ6+hQ3yQQUkak= +modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= +modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= +modernc.org/memory v1.6.0 h1:i6mzavxrE9a30whzMfwf7XWVODx2r5OYXvU46cirX7o= +modernc.org/memory v1.6.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= +modernc.org/sqlite v1.25.0 h1:AFweiwPNd/b3BoKnBOfFm+Y260guGMF+0UFk0savqeA= +modernc.org/sqlite v1.25.0/go.mod h1:FL3pVXie73rg3Rii6V/u5BoHlSoyeZeIgKZEgHARyCU= moul.io/http2curl/v2 v2.3.0 h1:9r3JfDzWPcbIklMOs2TnIFzDYvfAZvjeavG6EzP7jYs= moul.io/http2curl/v2 v2.3.0/go.mod h1:RW4hyBjTWSYDOxapodpNEtX0g5Eb16sxklBqmd2RHcE= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/internal/services/order_service/internal/orders/configurations/mappings/mappings_profile.go b/internal/services/orderservice/internal/orders/configurations/mappings/mappings_profile.go similarity index 100% rename from internal/services/order_service/internal/orders/configurations/mappings/mappings_profile.go rename to internal/services/orderservice/internal/orders/configurations/mappings/mappings_profile.go diff --git a/internal/services/order_service/internal/orders/configurations/mediatr/mediator_configurations.go b/internal/services/orderservice/internal/orders/configurations/mediatr/mediator_configurations.go similarity index 100% rename from internal/services/order_service/internal/orders/configurations/mediatr/mediator_configurations.go rename to internal/services/orderservice/internal/orders/configurations/mediatr/mediator_configurations.go diff --git a/internal/services/order_service/internal/orders/configurations/orders_module_configurator.go b/internal/services/orderservice/internal/orders/configurations/orders_module_configurator.go similarity index 99% rename from internal/services/order_service/internal/orders/configurations/orders_module_configurator.go rename to internal/services/orderservice/internal/orders/configurations/orders_module_configurator.go index 53470b32..b5ccc37d 100644 --- a/internal/services/order_service/internal/orders/configurations/orders_module_configurator.go +++ b/internal/services/orderservice/internal/orders/configurations/orders_module_configurator.go @@ -5,7 +5,7 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/es/contracts/store" contracts2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/fxapp/contracts" grpcServer "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/grpc" - customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo" + customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/internal/orders/configurations/mappings" diff --git a/internal/services/order_service/internal/orders/configurations/rabbitmq/rabbitmq_configurations.go b/internal/services/orderservice/internal/orders/configurations/rabbitmq/rabbitmq_configurations.go similarity index 100% rename from internal/services/order_service/internal/orders/configurations/rabbitmq/rabbitmq_configurations.go rename to internal/services/orderservice/internal/orders/configurations/rabbitmq/rabbitmq_configurations.go diff --git a/internal/services/order_service/internal/orders/contracts/params/order_projection_params.go b/internal/services/orderservice/internal/orders/contracts/params/order_projection_params.go similarity index 100% rename from internal/services/order_service/internal/orders/contracts/params/order_projection_params.go rename to internal/services/orderservice/internal/orders/contracts/params/order_projection_params.go diff --git a/internal/services/order_service/internal/orders/contracts/params/order_route_params.go b/internal/services/orderservice/internal/orders/contracts/params/order_route_params.go similarity index 100% rename from internal/services/order_service/internal/orders/contracts/params/order_route_params.go rename to internal/services/orderservice/internal/orders/contracts/params/order_route_params.go diff --git a/internal/services/order_service/internal/orders/contracts/repositories/order_repository.go b/internal/services/orderservice/internal/orders/contracts/repositories/order_repository.go similarity index 100% rename from internal/services/order_service/internal/orders/contracts/repositories/order_repository.go rename to internal/services/orderservice/internal/orders/contracts/repositories/order_repository.go diff --git a/internal/services/order_service/internal/orders/data/repositories/elastic_order_read_repository.go b/internal/services/orderservice/internal/orders/data/repositories/elastic_order_read_repository.go similarity index 100% rename from internal/services/order_service/internal/orders/data/repositories/elastic_order_read_repository.go rename to internal/services/orderservice/internal/orders/data/repositories/elastic_order_read_repository.go diff --git a/internal/services/order_service/internal/orders/data/repositories/mongo_order_read_repository.go b/internal/services/orderservice/internal/orders/data/repositories/mongo_order_read_repository.go similarity index 100% rename from internal/services/order_service/internal/orders/data/repositories/mongo_order_read_repository.go rename to internal/services/orderservice/internal/orders/data/repositories/mongo_order_read_repository.go diff --git a/internal/services/order_service/internal/orders/dtos/v1/order_dto.go b/internal/services/orderservice/internal/orders/dtos/v1/order_dto.go similarity index 100% rename from internal/services/order_service/internal/orders/dtos/v1/order_dto.go rename to internal/services/orderservice/internal/orders/dtos/v1/order_dto.go diff --git a/internal/services/order_service/internal/orders/dtos/v1/order_read_dto.go b/internal/services/orderservice/internal/orders/dtos/v1/order_read_dto.go similarity index 100% rename from internal/services/order_service/internal/orders/dtos/v1/order_read_dto.go rename to internal/services/orderservice/internal/orders/dtos/v1/order_read_dto.go diff --git a/internal/services/order_service/internal/orders/dtos/v1/shopItem_dto.go b/internal/services/orderservice/internal/orders/dtos/v1/shopItem_dto.go similarity index 100% rename from internal/services/order_service/internal/orders/dtos/v1/shopItem_dto.go rename to internal/services/orderservice/internal/orders/dtos/v1/shopItem_dto.go diff --git a/internal/services/order_service/internal/orders/dtos/v1/shopItem_read_dto.go b/internal/services/orderservice/internal/orders/dtos/v1/shopItem_read_dto.go similarity index 100% rename from internal/services/order_service/internal/orders/dtos/v1/shopItem_read_dto.go rename to internal/services/orderservice/internal/orders/dtos/v1/shopItem_read_dto.go diff --git a/internal/services/order_service/internal/orders/exceptions/domain_exceptions/invalid_delivery_address_error.go b/internal/services/orderservice/internal/orders/exceptions/domain_exceptions/invalid_delivery_address_error.go similarity index 94% rename from internal/services/order_service/internal/orders/exceptions/domain_exceptions/invalid_delivery_address_error.go rename to internal/services/orderservice/internal/orders/exceptions/domain_exceptions/invalid_delivery_address_error.go index 5ebc0d1a..a420de8f 100644 --- a/internal/services/order_service/internal/orders/exceptions/domain_exceptions/invalid_delivery_address_error.go +++ b/internal/services/orderservice/internal/orders/exceptions/domain_exceptions/invalid_delivery_address_error.go @@ -1,7 +1,7 @@ package domainExceptions import ( - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "emperror.dev/errors" ) diff --git a/internal/services/order_service/internal/orders/exceptions/domain_exceptions/invalid_email_error.go b/internal/services/orderservice/internal/orders/exceptions/domain_exceptions/invalid_email_error.go similarity index 94% rename from internal/services/order_service/internal/orders/exceptions/domain_exceptions/invalid_email_error.go rename to internal/services/orderservice/internal/orders/exceptions/domain_exceptions/invalid_email_error.go index e025a2f0..b5a30ec2 100644 --- a/internal/services/order_service/internal/orders/exceptions/domain_exceptions/invalid_email_error.go +++ b/internal/services/orderservice/internal/orders/exceptions/domain_exceptions/invalid_email_error.go @@ -1,7 +1,7 @@ package domainExceptions import ( - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "emperror.dev/errors" ) diff --git a/internal/services/order_service/internal/orders/exceptions/domain_exceptions/order_domain_errors_test.go b/internal/services/orderservice/internal/orders/exceptions/domain_exceptions/order_domain_errors_test.go similarity index 95% rename from internal/services/order_service/internal/orders/exceptions/domain_exceptions/order_domain_errors_test.go rename to internal/services/orderservice/internal/orders/exceptions/domain_exceptions/order_domain_errors_test.go index 44735cf8..fc06c48b 100644 --- a/internal/services/order_service/internal/orders/exceptions/domain_exceptions/order_domain_errors_test.go +++ b/internal/services/orderservice/internal/orders/exceptions/domain_exceptions/order_domain_errors_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" - errorUtils "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils/error_utils" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" + errorUtils "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils/errorutils" "github.com/stretchr/testify/assert" ) diff --git a/internal/services/order_service/internal/orders/exceptions/domain_exceptions/order_items_required_errors.go b/internal/services/orderservice/internal/orders/exceptions/domain_exceptions/order_items_required_errors.go similarity index 94% rename from internal/services/order_service/internal/orders/exceptions/domain_exceptions/order_items_required_errors.go rename to internal/services/orderservice/internal/orders/exceptions/domain_exceptions/order_items_required_errors.go index 61e2647c..ddbc4413 100644 --- a/internal/services/order_service/internal/orders/exceptions/domain_exceptions/order_items_required_errors.go +++ b/internal/services/orderservice/internal/orders/exceptions/domain_exceptions/order_items_required_errors.go @@ -1,7 +1,7 @@ package domainExceptions import ( - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "emperror.dev/errors" ) diff --git a/internal/services/order_service/internal/orders/exceptions/domain_exceptions/order_not_found_error.go b/internal/services/orderservice/internal/orders/exceptions/domain_exceptions/order_not_found_error.go similarity index 94% rename from internal/services/order_service/internal/orders/exceptions/domain_exceptions/order_not_found_error.go rename to internal/services/orderservice/internal/orders/exceptions/domain_exceptions/order_not_found_error.go index e1993a07..b9d77100 100644 --- a/internal/services/order_service/internal/orders/exceptions/domain_exceptions/order_not_found_error.go +++ b/internal/services/orderservice/internal/orders/exceptions/domain_exceptions/order_not_found_error.go @@ -3,7 +3,7 @@ package domainExceptions import ( "fmt" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "emperror.dev/errors" ) diff --git a/internal/services/order_service/internal/orders/features/creating_order/v1/commands/create_order.go b/internal/services/orderservice/internal/orders/features/creating_order/v1/commands/create_order.go similarity index 100% rename from internal/services/order_service/internal/orders/features/creating_order/v1/commands/create_order.go rename to internal/services/orderservice/internal/orders/features/creating_order/v1/commands/create_order.go diff --git a/internal/services/order_service/internal/orders/features/creating_order/v1/commands/create_order_handler.go b/internal/services/orderservice/internal/orders/features/creating_order/v1/commands/create_order_handler.go similarity index 98% rename from internal/services/order_service/internal/orders/features/creating_order/v1/commands/create_order_handler.go rename to internal/services/orderservice/internal/orders/features/creating_order/v1/commands/create_order_handler.go index 8956e662..fa3496f3 100644 --- a/internal/services/order_service/internal/orders/features/creating_order/v1/commands/create_order_handler.go +++ b/internal/services/orderservice/internal/orders/features/creating_order/v1/commands/create_order_handler.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/es/contracts/store" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" diff --git a/internal/services/order_service/internal/orders/features/creating_order/v1/dtos/create_order_request_dto.go b/internal/services/orderservice/internal/orders/features/creating_order/v1/dtos/create_order_request_dto.go similarity index 100% rename from internal/services/order_service/internal/orders/features/creating_order/v1/dtos/create_order_request_dto.go rename to internal/services/orderservice/internal/orders/features/creating_order/v1/dtos/create_order_request_dto.go diff --git a/internal/services/order_service/internal/orders/features/creating_order/v1/dtos/create_order_response_dto.go b/internal/services/orderservice/internal/orders/features/creating_order/v1/dtos/create_order_response_dto.go similarity index 100% rename from internal/services/order_service/internal/orders/features/creating_order/v1/dtos/create_order_response_dto.go rename to internal/services/orderservice/internal/orders/features/creating_order/v1/dtos/create_order_response_dto.go diff --git a/internal/services/order_service/internal/orders/features/creating_order/v1/endpoints/create_order_endpoint.go b/internal/services/orderservice/internal/orders/features/creating_order/v1/endpoints/create_order_endpoint.go similarity index 98% rename from internal/services/order_service/internal/orders/features/creating_order/v1/endpoints/create_order_endpoint.go rename to internal/services/orderservice/internal/orders/features/creating_order/v1/endpoints/create_order_endpoint.go index 5dff96b1..100be0c7 100644 --- a/internal/services/order_service/internal/orders/features/creating_order/v1/endpoints/create_order_endpoint.go +++ b/internal/services/orderservice/internal/orders/features/creating_order/v1/endpoints/create_order_endpoint.go @@ -6,7 +6,7 @@ import ( "time" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/web/route" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/internal/orders/contracts/params" createOrderCommandV1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/internal/orders/features/creating_order/v1/commands" diff --git a/internal/services/order_service/internal/orders/features/creating_order/v1/events/domain_events/order_created.go b/internal/services/orderservice/internal/orders/features/creating_order/v1/events/domain_events/order_created.go similarity index 98% rename from internal/services/order_service/internal/orders/features/creating_order/v1/events/domain_events/order_created.go rename to internal/services/orderservice/internal/orders/features/creating_order/v1/events/domain_events/order_created.go index 10848c72..c7de5061 100644 --- a/internal/services/order_service/internal/orders/features/creating_order/v1/events/domain_events/order_created.go +++ b/internal/services/orderservice/internal/orders/features/creating_order/v1/events/domain_events/order_created.go @@ -4,7 +4,7 @@ import ( "time" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/domain" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" typeMapper "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/reflection/typemapper" dtosV1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/internal/orders/dtos/v1" domainExceptions "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/internal/orders/exceptions/domain_exceptions" diff --git a/internal/services/order_service/internal/orders/features/creating_order/v1/events/integration_events/order_created.go b/internal/services/orderservice/internal/orders/features/creating_order/v1/events/integration_events/order_created.go similarity index 100% rename from internal/services/order_service/internal/orders/features/creating_order/v1/events/integration_events/order_created.go rename to internal/services/orderservice/internal/orders/features/creating_order/v1/events/integration_events/order_created.go diff --git a/internal/services/order_service/internal/orders/features/getting_order_by_id/v1/dtos/get_order_by_id_request_dto.go b/internal/services/orderservice/internal/orders/features/getting_order_by_id/v1/dtos/get_order_by_id_request_dto.go similarity index 100% rename from internal/services/order_service/internal/orders/features/getting_order_by_id/v1/dtos/get_order_by_id_request_dto.go rename to internal/services/orderservice/internal/orders/features/getting_order_by_id/v1/dtos/get_order_by_id_request_dto.go diff --git a/internal/services/order_service/internal/orders/features/getting_order_by_id/v1/dtos/get_order_by_id_response_dto.go b/internal/services/orderservice/internal/orders/features/getting_order_by_id/v1/dtos/get_order_by_id_response_dto.go similarity index 100% rename from internal/services/order_service/internal/orders/features/getting_order_by_id/v1/dtos/get_order_by_id_response_dto.go rename to internal/services/orderservice/internal/orders/features/getting_order_by_id/v1/dtos/get_order_by_id_response_dto.go diff --git a/internal/services/order_service/internal/orders/features/getting_order_by_id/v1/endpoints/get_order_by_id_endpoint.go b/internal/services/orderservice/internal/orders/features/getting_order_by_id/v1/endpoints/get_order_by_id_endpoint.go similarity index 98% rename from internal/services/order_service/internal/orders/features/getting_order_by_id/v1/endpoints/get_order_by_id_endpoint.go rename to internal/services/orderservice/internal/orders/features/getting_order_by_id/v1/endpoints/get_order_by_id_endpoint.go index a1933b61..521c4031 100644 --- a/internal/services/order_service/internal/orders/features/getting_order_by_id/v1/endpoints/get_order_by_id_endpoint.go +++ b/internal/services/orderservice/internal/orders/features/getting_order_by_id/v1/endpoints/get_order_by_id_endpoint.go @@ -5,7 +5,7 @@ import ( "net/http" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/web/route" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/internal/orders/contracts/params" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/internal/orders/features/getting_order_by_id/v1/dtos" diff --git a/internal/services/order_service/internal/orders/features/getting_order_by_id/v1/queries/get_order_by_id.go b/internal/services/orderservice/internal/orders/features/getting_order_by_id/v1/queries/get_order_by_id.go similarity index 100% rename from internal/services/order_service/internal/orders/features/getting_order_by_id/v1/queries/get_order_by_id.go rename to internal/services/orderservice/internal/orders/features/getting_order_by_id/v1/queries/get_order_by_id.go diff --git a/internal/services/order_service/internal/orders/features/getting_order_by_id/v1/queries/get_order_by_id_handler.go b/internal/services/orderservice/internal/orders/features/getting_order_by_id/v1/queries/get_order_by_id_handler.go similarity index 98% rename from internal/services/order_service/internal/orders/features/getting_order_by_id/v1/queries/get_order_by_id_handler.go rename to internal/services/orderservice/internal/orders/features/getting_order_by_id/v1/queries/get_order_by_id_handler.go index e2f4691e..b18201f6 100644 --- a/internal/services/order_service/internal/orders/features/getting_order_by_id/v1/queries/get_order_by_id_handler.go +++ b/internal/services/orderservice/internal/orders/features/getting_order_by_id/v1/queries/get_order_by_id_handler.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" diff --git a/internal/services/order_service/internal/orders/features/getting_orders/v1/dtos/get_orders_request_dto.go b/internal/services/orderservice/internal/orders/features/getting_orders/v1/dtos/get_orders_request_dto.go similarity index 100% rename from internal/services/order_service/internal/orders/features/getting_orders/v1/dtos/get_orders_request_dto.go rename to internal/services/orderservice/internal/orders/features/getting_orders/v1/dtos/get_orders_request_dto.go diff --git a/internal/services/order_service/internal/orders/features/getting_orders/v1/dtos/get_orders_response_dto.go b/internal/services/orderservice/internal/orders/features/getting_orders/v1/dtos/get_orders_response_dto.go similarity index 100% rename from internal/services/order_service/internal/orders/features/getting_orders/v1/dtos/get_orders_response_dto.go rename to internal/services/orderservice/internal/orders/features/getting_orders/v1/dtos/get_orders_response_dto.go diff --git a/internal/services/order_service/internal/orders/features/getting_orders/v1/endpoints/get_orders_endpoint.go b/internal/services/orderservice/internal/orders/features/getting_orders/v1/endpoints/get_orders_endpoint.go similarity index 98% rename from internal/services/order_service/internal/orders/features/getting_orders/v1/endpoints/get_orders_endpoint.go rename to internal/services/orderservice/internal/orders/features/getting_orders/v1/endpoints/get_orders_endpoint.go index f441837e..f6dda661 100644 --- a/internal/services/order_service/internal/orders/features/getting_orders/v1/endpoints/get_orders_endpoint.go +++ b/internal/services/orderservice/internal/orders/features/getting_orders/v1/endpoints/get_orders_endpoint.go @@ -5,7 +5,7 @@ import ( "net/http" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/web/route" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/utils" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/internal/orders/contracts/params" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/internal/orders/features/getting_orders/v1/dtos" diff --git a/internal/services/order_service/internal/orders/features/getting_orders/v1/queries/get_orders.go b/internal/services/orderservice/internal/orders/features/getting_orders/v1/queries/get_orders.go similarity index 100% rename from internal/services/order_service/internal/orders/features/getting_orders/v1/queries/get_orders.go rename to internal/services/orderservice/internal/orders/features/getting_orders/v1/queries/get_orders.go diff --git a/internal/services/order_service/internal/orders/features/getting_orders/v1/queries/get_orders_handler.go b/internal/services/orderservice/internal/orders/features/getting_orders/v1/queries/get_orders_handler.go similarity index 98% rename from internal/services/order_service/internal/orders/features/getting_orders/v1/queries/get_orders_handler.go rename to internal/services/orderservice/internal/orders/features/getting_orders/v1/queries/get_orders_handler.go index c5d41d83..5c49f43c 100644 --- a/internal/services/order_service/internal/orders/features/getting_orders/v1/queries/get_orders_handler.go +++ b/internal/services/orderservice/internal/orders/features/getting_orders/v1/queries/get_orders_handler.go @@ -3,7 +3,7 @@ package queries import ( "context" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing/attribute" diff --git a/internal/services/order_service/internal/orders/features/submitting_order/v1/commands/submit_order.go b/internal/services/orderservice/internal/orders/features/submitting_order/v1/commands/submit_order.go similarity index 100% rename from internal/services/order_service/internal/orders/features/submitting_order/v1/commands/submit_order.go rename to internal/services/orderservice/internal/orders/features/submitting_order/v1/commands/submit_order.go diff --git a/internal/services/order_service/internal/orders/features/submitting_order/v1/events/domain_events/order_submitted.go b/internal/services/orderservice/internal/orders/features/submitting_order/v1/events/domain_events/order_submitted.go similarity index 91% rename from internal/services/order_service/internal/orders/features/submitting_order/v1/events/domain_events/order_submitted.go rename to internal/services/orderservice/internal/orders/features/submitting_order/v1/events/domain_events/order_submitted.go index 890e5baf..8ba117b2 100644 --- a/internal/services/order_service/internal/orders/features/submitting_order/v1/events/domain_events/order_submitted.go +++ b/internal/services/orderservice/internal/orders/features/submitting_order/v1/events/domain_events/order_submitted.go @@ -3,7 +3,7 @@ package domainEvents import ( "fmt" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" uuid "github.com/satori/go.uuid" ) diff --git a/internal/services/order_service/internal/orders/features/updating_shopping_card/v1/commands/update_shopping_card.go b/internal/services/orderservice/internal/orders/features/updating_shopping_card/v1/commands/update_shopping_card.go similarity index 100% rename from internal/services/order_service/internal/orders/features/updating_shopping_card/v1/commands/update_shopping_card.go rename to internal/services/orderservice/internal/orders/features/updating_shopping_card/v1/commands/update_shopping_card.go diff --git a/internal/services/order_service/internal/orders/features/updating_shopping_card/v1/events/shopping_card_updated.go b/internal/services/orderservice/internal/orders/features/updating_shopping_card/v1/events/shopping_card_updated.go similarity index 100% rename from internal/services/order_service/internal/orders/features/updating_shopping_card/v1/events/shopping_card_updated.go rename to internal/services/orderservice/internal/orders/features/updating_shopping_card/v1/events/shopping_card_updated.go diff --git a/internal/services/order_service/internal/orders/models/orders/aggregate/order.go b/internal/services/orderservice/internal/orders/models/orders/aggregate/order.go similarity index 99% rename from internal/services/order_service/internal/orders/models/orders/aggregate/order.go rename to internal/services/orderservice/internal/orders/models/orders/aggregate/order.go index 7b3f17d3..c228a46b 100644 --- a/internal/services/order_service/internal/orders/models/orders/aggregate/order.go +++ b/internal/services/orderservice/internal/orders/models/orders/aggregate/order.go @@ -8,7 +8,7 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/domain" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/es/errors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/es/models" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" typeMapper "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/reflection/typemapper" dtosV1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/internal/orders/dtos/v1" diff --git a/internal/services/order_service/internal/orders/models/orders/read_models/order_read.go b/internal/services/orderservice/internal/orders/models/orders/read_models/order_read.go similarity index 100% rename from internal/services/order_service/internal/orders/models/orders/read_models/order_read.go rename to internal/services/orderservice/internal/orders/models/orders/read_models/order_read.go diff --git a/internal/services/order_service/internal/orders/models/orders/read_models/shop_item_read.go b/internal/services/orderservice/internal/orders/models/orders/read_models/shop_item_read.go similarity index 100% rename from internal/services/order_service/internal/orders/models/orders/read_models/shop_item_read.go rename to internal/services/orderservice/internal/orders/models/orders/read_models/shop_item_read.go diff --git a/internal/services/order_service/internal/orders/models/orders/value_objects/shop_item.go b/internal/services/orderservice/internal/orders/models/orders/value_objects/shop_item.go similarity index 100% rename from internal/services/order_service/internal/orders/models/orders/value_objects/shop_item.go rename to internal/services/orderservice/internal/orders/models/orders/value_objects/shop_item.go diff --git a/internal/services/order_service/internal/orders/orders_fx.go b/internal/services/orderservice/internal/orders/orders_fx.go similarity index 98% rename from internal/services/order_service/internal/orders/orders_fx.go rename to internal/services/orderservice/internal/orders/orders_fx.go index e418fd82..c1ea96aa 100644 --- a/internal/services/order_service/internal/orders/orders_fx.go +++ b/internal/services/orderservice/internal/orders/orders_fx.go @@ -4,7 +4,7 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/web/route" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/es" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/eventstroredb" - customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo" + customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/internal/orders/data/repositories" createOrderV1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/internal/orders/features/creating_order/v1/endpoints" getOrderByIdV1 "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/internal/orders/features/getting_order_by_id/v1/endpoints" diff --git a/internal/services/order_service/internal/orders/projections/elastic_order_projection.go b/internal/services/orderservice/internal/orders/projections/elastic_order_projection.go similarity index 100% rename from internal/services/order_service/internal/orders/projections/elastic_order_projection.go rename to internal/services/orderservice/internal/orders/projections/elastic_order_projection.go diff --git a/internal/services/order_service/internal/orders/projections/mongo_order_projection.go b/internal/services/orderservice/internal/orders/projections/mongo_order_projection.go similarity index 99% rename from internal/services/order_service/internal/orders/projections/mongo_order_projection.go rename to internal/services/orderservice/internal/orders/projections/mongo_order_projection.go index 0c5fc68d..4679e8a1 100644 --- a/internal/services/order_service/internal/orders/projections/mongo_order_projection.go +++ b/internal/services/orderservice/internal/orders/projections/mongo_order_projection.go @@ -7,7 +7,7 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/core/messaging/producer" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/es/contracts/projection" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/es/models" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" diff --git a/internal/services/order_service/internal/shared/app/app.go b/internal/services/orderservice/internal/shared/app/app.go similarity index 100% rename from internal/services/order_service/internal/shared/app/app.go rename to internal/services/orderservice/internal/shared/app/app.go diff --git a/internal/services/order_service/internal/shared/app/application.go b/internal/services/orderservice/internal/shared/app/application.go similarity index 100% rename from internal/services/order_service/internal/shared/app/application.go rename to internal/services/orderservice/internal/shared/app/application.go diff --git a/internal/services/order_service/internal/shared/app/application_builder.go b/internal/services/orderservice/internal/shared/app/application_builder.go similarity index 100% rename from internal/services/order_service/internal/shared/app/application_builder.go rename to internal/services/orderservice/internal/shared/app/application_builder.go diff --git a/internal/services/order_service/internal/shared/app/test/test_app.go b/internal/services/orderservice/internal/shared/app/test/test_app.go similarity index 99% rename from internal/services/order_service/internal/shared/app/test/test_app.go rename to internal/services/orderservice/internal/shared/app/test/test_app.go index 7849d0ed..1d1ae048 100644 --- a/internal/services/order_service/internal/shared/app/test/test_app.go +++ b/internal/services/orderservice/internal/shared/app/test/test_app.go @@ -10,7 +10,7 @@ import ( config4 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/eventstroredb/config" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/fxapp/contracts" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/grpc" - config3 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/config" + config3 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/config" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mongodb" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/rabbitmq/bus" diff --git a/internal/services/order_service/internal/shared/app/test/test_application.go b/internal/services/orderservice/internal/shared/app/test/test_application.go similarity index 100% rename from internal/services/order_service/internal/shared/app/test/test_application.go rename to internal/services/orderservice/internal/shared/app/test/test_application.go diff --git a/internal/services/order_service/internal/shared/app/test/test_application_builder.go b/internal/services/orderservice/internal/shared/app/test/test_application_builder.go similarity index 100% rename from internal/services/order_service/internal/shared/app/test/test_application_builder.go rename to internal/services/orderservice/internal/shared/app/test/test_application_builder.go diff --git a/internal/services/order_service/internal/shared/configurations/orders/infrastructure/infrastructure_configurator.go b/internal/services/orderservice/internal/shared/configurations/orders/infrastructure/infrastructure_configurator.go similarity index 100% rename from internal/services/order_service/internal/shared/configurations/orders/infrastructure/infrastructure_configurator.go rename to internal/services/orderservice/internal/shared/configurations/orders/infrastructure/infrastructure_configurator.go diff --git a/internal/services/order_service/internal/shared/configurations/orders/infrastructure/infrastructure_fx.go b/internal/services/orderservice/internal/shared/configurations/orders/infrastructure/infrastructure_fx.go similarity index 98% rename from internal/services/order_service/internal/shared/configurations/orders/infrastructure/infrastructure_fx.go rename to internal/services/orderservice/internal/shared/configurations/orders/infrastructure/infrastructure_fx.go index f736ac5d..d3a510a4 100644 --- a/internal/services/order_service/internal/shared/configurations/orders/infrastructure/infrastructure_fx.go +++ b/internal/services/orderservice/internal/shared/configurations/orders/infrastructure/infrastructure_fx.go @@ -6,7 +6,7 @@ import ( "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/eventstroredb" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/grpc" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/health" - customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo" + customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mongodb" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/metrics" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing" diff --git a/internal/services/order_service/internal/shared/configurations/orders/orders_configurator.go b/internal/services/orderservice/internal/shared/configurations/orders/orders_configurator.go similarity index 98% rename from internal/services/order_service/internal/shared/configurations/orders/orders_configurator.go rename to internal/services/orderservice/internal/shared/configurations/orders/orders_configurator.go index 24d98ef5..2f435d1a 100644 --- a/internal/services/order_service/internal/shared/configurations/orders/orders_configurator.go +++ b/internal/services/orderservice/internal/shared/configurations/orders/orders_configurator.go @@ -5,7 +5,7 @@ import ( "net/http" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/fxapp/contracts" - customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo" + customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/config" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/internal/orders/configurations" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/internal/shared/configurations/orders/infrastructure" diff --git a/internal/services/order_service/internal/shared/configurations/orders/orders_configurator_swagger.go b/internal/services/orderservice/internal/shared/configurations/orders/orders_configurator_swagger.go similarity index 93% rename from internal/services/order_service/internal/shared/configurations/orders/orders_configurator_swagger.go rename to internal/services/orderservice/internal/shared/configurations/orders/orders_configurator_swagger.go index 74c4be25..7f861a83 100644 --- a/internal/services/order_service/internal/shared/configurations/orders/orders_configurator_swagger.go +++ b/internal/services/orderservice/internal/shared/configurations/orders/orders_configurator_swagger.go @@ -1,7 +1,7 @@ package orders import ( - customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/custom_echo/contracts" + customEcho "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/customecho/contracts" "github.com/mehdihadeli/go-ecommerce-microservices/internal/services/orderservice/docs" "github.com/labstack/echo/v4" diff --git a/internal/services/order_service/internal/shared/configurations/orders/orders_fx.go b/internal/services/orderservice/internal/shared/configurations/orders/orders_fx.go similarity index 100% rename from internal/services/order_service/internal/shared/configurations/orders/orders_fx.go rename to internal/services/orderservice/internal/shared/configurations/orders/orders_fx.go diff --git a/internal/services/order_service/internal/shared/contracts/orders_metrics.go b/internal/services/orderservice/internal/shared/contracts/orders_metrics.go similarity index 100% rename from internal/services/order_service/internal/shared/contracts/orders_metrics.go rename to internal/services/orderservice/internal/shared/contracts/orders_metrics.go diff --git a/internal/services/order_service/internal/shared/grpc/genproto/orders.pb.go b/internal/services/orderservice/internal/shared/grpc/genproto/orders.pb.go similarity index 99% rename from internal/services/order_service/internal/shared/grpc/genproto/orders.pb.go rename to internal/services/orderservice/internal/shared/grpc/genproto/orders.pb.go index abccd5c3..9800c343 100644 --- a/internal/services/order_service/internal/shared/grpc/genproto/orders.pb.go +++ b/internal/services/orderservice/internal/shared/grpc/genproto/orders.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.26.0 // protoc v4.23.4 -// source: order_service/orders.proto +// source: orderservice/orders.proto package orders_service diff --git a/internal/services/order_service/internal/shared/grpc/genproto/orders_grpc.pb.go b/internal/services/orderservice/internal/shared/grpc/genproto/orders_grpc.pb.go similarity index 99% rename from internal/services/order_service/internal/shared/grpc/genproto/orders_grpc.pb.go rename to internal/services/orderservice/internal/shared/grpc/genproto/orders_grpc.pb.go index 6f5be25d..ba46c936 100644 --- a/internal/services/order_service/internal/shared/grpc/genproto/orders_grpc.pb.go +++ b/internal/services/orderservice/internal/shared/grpc/genproto/orders_grpc.pb.go @@ -2,7 +2,7 @@ // versions: // - protoc-gen-go-grpc v1.3.0 // - protoc v4.23.4 -// source: order_service/orders.proto +// source: orderservice/orders.proto package orders_service @@ -251,5 +251,5 @@ var OrdersService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "order_service/orders.proto", + Metadata: "orderservice/orders.proto", } diff --git a/internal/services/order_service/internal/shared/grpc/order_grpc_service_server.go b/internal/services/orderservice/internal/shared/grpc/order_grpc_service_server.go similarity index 99% rename from internal/services/order_service/internal/shared/grpc/order_grpc_service_server.go rename to internal/services/orderservice/internal/shared/grpc/order_grpc_service_server.go index da09de3d..3919e517 100644 --- a/internal/services/order_service/internal/shared/grpc/order_grpc_service_server.go +++ b/internal/services/orderservice/internal/shared/grpc/order_grpc_service_server.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/http_errors/custom_errors" + customErrors "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/http/httperrors/customerrors" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/logger" "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/mapper" attribute2 "github.com/mehdihadeli/go-ecommerce-microservices/internal/pkg/otel/tracing/attribute" diff --git a/internal/services/order_service/internal/shared/test_fixtures/integration/integration_test_fixture.go b/internal/services/orderservice/internal/shared/test_fixtures/integration/integration_test_fixture.go similarity index 100% rename from internal/services/order_service/internal/shared/test_fixtures/integration/integration_test_fixture.go rename to internal/services/orderservice/internal/shared/test_fixtures/integration/integration_test_fixture.go diff --git a/internal/services/order_service/mocks/InvalidDeliveryAddressError.go b/internal/services/orderservice/mocks/InvalidDeliveryAddressError.go similarity index 100% rename from internal/services/order_service/mocks/InvalidDeliveryAddressError.go rename to internal/services/orderservice/mocks/InvalidDeliveryAddressError.go diff --git a/internal/services/order_service/mocks/InvalidEmailAddressError.go b/internal/services/orderservice/mocks/InvalidEmailAddressError.go similarity index 100% rename from internal/services/order_service/mocks/InvalidEmailAddressError.go rename to internal/services/orderservice/mocks/InvalidEmailAddressError.go diff --git a/internal/services/order_service/mocks/OrderElasticRepository.go b/internal/services/orderservice/mocks/OrderElasticRepository.go similarity index 100% rename from internal/services/order_service/mocks/OrderElasticRepository.go rename to internal/services/orderservice/mocks/OrderElasticRepository.go diff --git a/internal/services/order_service/mocks/OrderMongoRepository.go b/internal/services/orderservice/mocks/OrderMongoRepository.go similarity index 100% rename from internal/services/order_service/mocks/OrderMongoRepository.go rename to internal/services/orderservice/mocks/OrderMongoRepository.go diff --git a/internal/services/order_service/mocks/OrderNotFoundError.go b/internal/services/orderservice/mocks/OrderNotFoundError.go similarity index 100% rename from internal/services/order_service/mocks/OrderNotFoundError.go rename to internal/services/orderservice/mocks/OrderNotFoundError.go diff --git a/internal/services/order_service/mocks/OrderShopItemsRequiredError.go b/internal/services/orderservice/mocks/OrderShopItemsRequiredError.go similarity index 100% rename from internal/services/order_service/mocks/OrderShopItemsRequiredError.go rename to internal/services/orderservice/mocks/OrderShopItemsRequiredError.go diff --git a/internal/services/order_service/mocks/OrdersServiceClient.go b/internal/services/orderservice/mocks/OrdersServiceClient.go similarity index 100% rename from internal/services/order_service/mocks/OrdersServiceClient.go rename to internal/services/orderservice/mocks/OrdersServiceClient.go diff --git a/internal/services/order_service/mocks/OrdersServiceServer.go b/internal/services/orderservice/mocks/OrdersServiceServer.go similarity index 100% rename from internal/services/order_service/mocks/OrdersServiceServer.go rename to internal/services/orderservice/mocks/OrdersServiceServer.go diff --git a/internal/services/order_service/mocks/UnsafeOrdersServiceServer.go b/internal/services/orderservice/mocks/UnsafeOrdersServiceServer.go similarity index 100% rename from internal/services/order_service/mocks/UnsafeOrdersServiceServer.go rename to internal/services/orderservice/mocks/UnsafeOrdersServiceServer.go diff --git a/internal/services/order_service/mocks/orderReadRepository.go b/internal/services/orderservice/mocks/orderReadRepository.go similarity index 100% rename from internal/services/order_service/mocks/orderReadRepository.go rename to internal/services/orderservice/mocks/orderReadRepository.go diff --git a/internal/services/order_service/readme.md b/internal/services/orderservice/readme.md similarity index 100% rename from internal/services/order_service/readme.md rename to internal/services/orderservice/readme.md diff --git a/internal/services/order_service/revive-config.toml b/internal/services/orderservice/revive-config.toml similarity index 100% rename from internal/services/order_service/revive-config.toml rename to internal/services/orderservice/revive-config.toml diff --git a/internal/services/order_service/taskfile.yml b/internal/services/orderservice/taskfile.yml similarity index 100% rename from internal/services/order_service/taskfile.yml rename to internal/services/orderservice/taskfile.yml diff --git a/internal/services/order_service/taskfile_db.yml b/internal/services/orderservice/taskfile_db.yml similarity index 100% rename from internal/services/order_service/taskfile_db.yml rename to internal/services/orderservice/taskfile_db.yml diff --git a/internal/services/order_service/taskfile_test.yml b/internal/services/orderservice/taskfile_test.yml similarity index 100% rename from internal/services/order_service/taskfile_test.yml rename to internal/services/orderservice/taskfile_test.yml diff --git a/internal/services/order_service/test/end_to_end/orders/features/creating_order/v1/create_order_test.go b/internal/services/orderservice/test/end_to_end/orders/features/creating_order/v1/create_order_test.go similarity index 100% rename from internal/services/order_service/test/end_to_end/orders/features/creating_order/v1/create_order_test.go rename to internal/services/orderservice/test/end_to_end/orders/features/creating_order/v1/create_order_test.go diff --git a/internal/services/order_service/test/end_to_end/orders/features/getting_order_by_id/v1/get_order_by_id_test.go b/internal/services/orderservice/test/end_to_end/orders/features/getting_order_by_id/v1/get_order_by_id_test.go similarity index 100% rename from internal/services/order_service/test/end_to_end/orders/features/getting_order_by_id/v1/get_order_by_id_test.go rename to internal/services/orderservice/test/end_to_end/orders/features/getting_order_by_id/v1/get_order_by_id_test.go diff --git a/internal/services/order_service/test/end_to_end/orders/grpc/order_grpc_service_server_test.go b/internal/services/orderservice/test/end_to_end/orders/grpc/order_grpc_service_server_test.go similarity index 100% rename from internal/services/order_service/test/end_to_end/orders/grpc/order_grpc_service_server_test.go rename to internal/services/orderservice/test/end_to_end/orders/grpc/order_grpc_service_server_test.go diff --git a/internal/services/order_service/test/integration/orders/features/creating_order/v1/create_order_test.go b/internal/services/orderservice/test/integration/orders/features/creating_order/v1/create_order_test.go similarity index 100% rename from internal/services/order_service/test/integration/orders/features/creating_order/v1/create_order_test.go rename to internal/services/orderservice/test/integration/orders/features/creating_order/v1/create_order_test.go diff --git a/internal/services/order_service/test/integration/orders/features/getting_order_by_id/v1/get_order_by_id_test.go b/internal/services/orderservice/test/integration/orders/features/getting_order_by_id/v1/get_order_by_id_test.go similarity index 100% rename from internal/services/order_service/test/integration/orders/features/getting_order_by_id/v1/get_order_by_id_test.go rename to internal/services/orderservice/test/integration/orders/features/getting_order_by_id/v1/get_order_by_id_test.go diff --git a/taskfile.yml b/taskfile.yml index fd4323d2..45146538 100644 --- a/taskfile.yml +++ b/taskfile.yml @@ -11,33 +11,33 @@ tasks: run-catalogs-write-service: desc: Run catalog write service cmds: - - sh ./scripts/run.sh catalog_write_service + - sh ./scripts/run.sh catalogwriteservice run-catalog-read-service: desc: Run catalog read service cmds: - - sh ./scripts/run.sh catalog_read_service + - sh ./scripts/run.sh catalogreadservice run-order-service: desc: Run order service cmds: - - sh ./scripts/run.sh order_service + - sh ./scripts/run.sh orderservice build: desc: Build project components cmds: - sh ./scripts/build.sh pkg - - sh ./scripts/build.sh catalog_write_service - - sh ./scripts/build.sh catalog_read_service - - sh ./scripts/build.sh order_service + - sh ./scripts/build.sh catalogwriteservice + - sh ./scripts/build.sh catalogreadservice + - sh ./scripts/build.sh orderservice install-dependencies: desc: Install project dependencies cmds: - sh ./scripts/install-dependencies.sh pkg - - sh ./scripts/install-dependencies.sh catalog_write_service - - sh ./scripts/install-dependencies.sh catalog_read_service - - sh ./scripts/install-dependencies.sh order_service + - sh ./scripts/install-dependencies.sh catalogwriteservice + - sh ./scripts/install-dependencies.sh catalogreadservice + - sh ./scripts/install-dependencies.sh orderservice docker-compose-infra-up: desc: Start infrastructure using docker-compose @@ -52,51 +52,51 @@ tasks: openapi: desc: Generate OpenAPI documentation cmds: - - sh ./scripts/openapi.sh catalog_write_service - - sh ./scripts/openapi.sh catalog_read_service - - sh ./scripts/openapi.sh order_service + - sh ./scripts/openapi.sh catalogwriteservice + - sh ./scripts/openapi.sh catalogreadservice + - sh ./scripts/openapi.sh orderservice proto: desc: Generate protobuf files cmds: - - sh ./scripts/proto.sh catalog_write_service - - sh ./scripts/proto.sh order_service + - sh ./scripts/proto.sh catalogwriteservice + - sh ./scripts/proto.sh orderservice unit-test: desc: Run unit tests cmds: - - sh ./scripts/test.sh catalog_write_service unit - - sh ./scripts/test.sh catalog_read_service unit - - sh ./scripts/test.sh order_service unit + - sh ./scripts/test.sh catalogwriteservice unit + - sh ./scripts/test.sh catalogreadservice unit + - sh ./scripts/test.sh orderservice unit integration-test: desc: Run integration tests cmds: - - sh ./scripts/test.sh catalog_write_service integration - - sh ./scripts/test.sh catalog_read_service integration - - sh ./scripts/test.sh order_service integration + - sh ./scripts/test.sh catalogwriteservice integration + - sh ./scripts/test.sh catalogreadservice integration + - sh ./scripts/test.sh orderservice integration e2e-test: desc: Run end-to-end tests cmds: - - sh ./scripts/test.sh catalog_write_service e2e - - sh ./scripts/test.sh catalog_read_service e2e - - sh ./scripts/test.sh order_service e2e + - sh ./scripts/test.sh catalogwriteservice e2e + - sh ./scripts/test.sh catalogreadservice e2e + - sh ./scripts/test.sh orderservice e2e format: desc: Format codebase cmds: - - sh ./scripts/format.sh catalog_write_service - - sh ./scripts/format.sh catalog_read_service - - sh ./scripts/format.sh order_service + - sh ./scripts/format.sh catalogwriteservice + - sh ./scripts/format.sh catalogreadservice + - sh ./scripts/format.sh orderservice - sh ./scripts/format.sh pkg lint: desc: Run linters cmds: - - sh ./scripts/lint.sh catalog_write_service - - sh ./scripts/lint.sh catalog_read_service - - sh ./scripts/lint.sh order_service + - sh ./scripts/lint.sh catalogwriteservice + - sh ./scripts/lint.sh catalogreadservice + - sh ./scripts/lint.sh orderservice - sh ./scripts/lint.sh pkg pkg-mocks: @@ -109,6 +109,6 @@ tasks: services-mocks: desc: Generate service mocks cmds: - - cd internal/services/catalog_write_service && mockery --output mocks --all - - cd internal/services/catalog_read_service && mockery --output mocks --all - - cd internal/services/order_service && mockery --output mocks --all + - cd internal/services/catalogwriteservice && mockery --output mocks --all + - cd internal/services/catalogreadservice && mockery --output mocks --all + - cd internal/services/orderservice && mockery --output mocks --all