From 5c65004f09d29784ddebe50ba8e085924565c1a6 Mon Sep 17 00:00:00 2001 From: jurabek Date: Sun, 21 Jan 2024 01:24:33 +0100 Subject: [PATCH] renaming basket-api into cart-api --- .../{basket-api.yml => cart-api.yml} | 14 ++++----- .github/workflows/codeql-analysis.yml | 2 +- .../services/basket-api/base/deployment.yaml | 12 ++++---- .../services/basket-api/base/http-route.yaml | 4 +-- .../basket-api/base/kustomization.yaml | 6 ++-- .../services/basket-api/base/service.yaml | 4 +-- .../basket-api/dev/kustomization.yaml | 2 +- .../services/order-api/base/config.env | 2 +- src/backend/backend.code-workspace | 4 +-- src/backend/docker/docker-compose.elk.yml | 4 +-- src/backend/docker/docker-compose.kafka.yml | 2 +- .../docker/docker-compose.override.yml | 6 ++-- src/backend/docker/docker-compose.traefik.yml | 2 +- src/backend/docker/docker-compose.yml | 8 ++--- src/backend/nginx/nginx.conf | 6 ++-- src/backend/scripts/build.sh | 2 +- src/backend/scripts/qa.sh | 2 +- .../basket-api/internal/models/checkout.go | 29 ------------------- .../internal/models/customer_basket.go | 9 ------ .../services/basket-api/release.Dockerfile | 10 ------- .../{basket-api => cart-api}/.gitignore | 0 .../{basket-api => cart-api}/Dockerfile | 6 ++-- .../{basket-api => cart-api}/README.md | 0 .../{basket-api => cart-api}/build.sh | 0 .../{basket-api => cart-api}/cmd/api/main.go | 26 ++++++++--------- .../cmd/config/configuration.go | 0 .../coverage_result.sh | 0 .../{basket-api => cart-api}/gen-swagger.sh | 0 .../{basket-api => cart-api}/genproto.sh | 0 .../services/{basket-api => cart-api}/go.mod | 2 +- .../services/{basket-api => cart-api}/go.sum | 6 +++- .../install_ci_dependencies.sh | 0 .../internal/database/db.go | 0 .../internal/docs/docs.go | 0 .../internal/docs/fix.go | 0 .../internal/docs/swagger.json | 0 .../internal/docs/swagger.yaml | 0 .../internal/grpc/cart_service_grpc.go | 4 +-- .../internal/handlers/basket_handler.go | 4 +-- .../internal/handlers/basket_handler_test.go | 4 +-- .../internal/middlewares/swagger.go | 2 +- .../internal/models/customer_basket.go} | 8 +++++ .../internal/models/http_error.go | 0 .../repositories/mock_redis_connection.go | 0 .../internal/repositories/mock_repository.go | 2 +- .../internal/repositories/redis_repository.go | 2 +- .../repositories/redis_repostory_test.go | 2 +- .../{basket-api => cart-api}/pb/cart.proto | 0 .../{basket-api => cart-api}/pb/v1/cart.pb.go | 0 .../pb/v1/cart_grpc.pb.go | 0 .../pkg/producer/kafka_producer.go | 0 .../pkg/util/hosthelper.go | 0 .../pkg/util/iphelper.go | 0 .../pkg/util/porthelper.go | 0 .../services/{basket-api => cart-api}/qa.sh | 0 .../services/cart-api/release.Dockerfile | 10 +++++++ .../services/{basket-api => cart-api}/run.sh | 0 .../sonar-project.properties | 2 +- .../services/{basket-api => cart-api}/test.sh | 0 .../services/{basket-api => cart-api}/version | 0 src/backend/services/checkout-api/README.md | 2 +- .../Identity.API/IdentityServer/Config.cs | 12 ++++---- .../src/app/services/auth.service.ts | 2 +- .../web.client/web-app-new/src/lib/auth.ts | 2 +- .../web.client/web-app/src/api/AuthService.ts | 2 +- 65 files changed, 102 insertions(+), 128 deletions(-) rename .github/workflows/{basket-api.yml => cart-api.yml} (62%) delete mode 100644 src/backend/services/basket-api/internal/models/checkout.go delete mode 100644 src/backend/services/basket-api/internal/models/customer_basket.go delete mode 100644 src/backend/services/basket-api/release.Dockerfile rename src/backend/services/{basket-api => cart-api}/.gitignore (100%) rename src/backend/services/{basket-api => cart-api}/Dockerfile (75%) rename src/backend/services/{basket-api => cart-api}/README.md (100%) rename src/backend/services/{basket-api => cart-api}/build.sh (100%) rename src/backend/services/{basket-api => cart-api}/cmd/api/main.go (89%) rename src/backend/services/{basket-api => cart-api}/cmd/config/configuration.go (100%) rename src/backend/services/{basket-api => cart-api}/coverage_result.sh (100%) rename src/backend/services/{basket-api => cart-api}/gen-swagger.sh (100%) rename src/backend/services/{basket-api => cart-api}/genproto.sh (100%) rename src/backend/services/{basket-api => cart-api}/go.mod (99%) rename src/backend/services/{basket-api => cart-api}/go.sum (99%) rename src/backend/services/{basket-api => cart-api}/install_ci_dependencies.sh (100%) rename src/backend/services/{basket-api => cart-api}/internal/database/db.go (100%) rename src/backend/services/{basket-api => cart-api}/internal/docs/docs.go (100%) rename src/backend/services/{basket-api => cart-api}/internal/docs/fix.go (100%) rename src/backend/services/{basket-api => cart-api}/internal/docs/swagger.json (100%) rename src/backend/services/{basket-api => cart-api}/internal/docs/swagger.yaml (100%) rename src/backend/services/{basket-api => cart-api}/internal/grpc/cart_service_grpc.go (92%) rename src/backend/services/{basket-api => cart-api}/internal/handlers/basket_handler.go (96%) rename src/backend/services/{basket-api => cart-api}/internal/handlers/basket_handler_test.go (97%) rename src/backend/services/{basket-api => cart-api}/internal/middlewares/swagger.go (94%) rename src/backend/services/{basket-api/internal/models/basket_item.go => cart-api/internal/models/customer_basket.go} (65%) rename src/backend/services/{basket-api => cart-api}/internal/models/http_error.go (100%) rename src/backend/services/{basket-api => cart-api}/internal/repositories/mock_redis_connection.go (100%) rename src/backend/services/{basket-api => cart-api}/internal/repositories/mock_repository.go (93%) rename src/backend/services/{basket-api => cart-api}/internal/repositories/redis_repository.go (97%) rename src/backend/services/{basket-api => cart-api}/internal/repositories/redis_repostory_test.go (95%) rename src/backend/services/{basket-api => cart-api}/pb/cart.proto (100%) rename src/backend/services/{basket-api => cart-api}/pb/v1/cart.pb.go (100%) rename src/backend/services/{basket-api => cart-api}/pb/v1/cart_grpc.pb.go (100%) rename src/backend/services/{basket-api => cart-api}/pkg/producer/kafka_producer.go (100%) rename src/backend/services/{basket-api => cart-api}/pkg/util/hosthelper.go (100%) rename src/backend/services/{basket-api => cart-api}/pkg/util/iphelper.go (100%) rename src/backend/services/{basket-api => cart-api}/pkg/util/porthelper.go (100%) rename src/backend/services/{basket-api => cart-api}/qa.sh (100%) create mode 100644 src/backend/services/cart-api/release.Dockerfile rename src/backend/services/{basket-api => cart-api}/run.sh (100%) rename src/backend/services/{basket-api => cart-api}/sonar-project.properties (91%) rename src/backend/services/{basket-api => cart-api}/test.sh (100%) rename src/backend/services/{basket-api => cart-api}/version (100%) diff --git a/.github/workflows/basket-api.yml b/.github/workflows/cart-api.yml similarity index 62% rename from .github/workflows/basket-api.yml rename to .github/workflows/cart-api.yml index be9dbac0f..ac7cecd33 100644 --- a/.github/workflows/basket-api.yml +++ b/.github/workflows/cart-api.yml @@ -1,27 +1,27 @@ -name: basket-api +name: cart-api on: push: branches: - develop paths: - - 'src/backend/services/basket-api/**' - - '.github/workflows/basket-api.yml' + - 'src/backend/services/cart-api/**' + - '.github/workflows/cart-api.yml' pull_request: branches: - develop paths: - - 'src/backend/services/basket-api/**' - - '.github/workflows/basket-api.yml' + - 'src/backend/services/cart-api/**' + - '.github/workflows/cart-api.yml' jobs: build-release: uses: ./.github/workflows/build-release.yml with: - service-name: basket-api + service-name: cart-api secrets: inherit deploy: @@ -30,6 +30,6 @@ jobs: - build-release uses: ./.github/workflows/deploy.yml with: - service-name: basket-api + service-name: cart-api version: ${{ needs.build-release.outputs.new-version }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 95376503b..e86cbb5cf 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -70,7 +70,7 @@ jobs: - if: matrix.language == 'go' name: Build Go run: | - bash ./src/backend/services/basket-api/build.sh + bash ./src/backend/services/cart-api/build.sh - if: matrix.language == 'csharp' name: Build C# diff --git a/k8s-kustomize/services/basket-api/base/deployment.yaml b/k8s-kustomize/services/basket-api/base/deployment.yaml index 25722f52b..2da0544ee 100644 --- a/k8s-kustomize/services/basket-api/base/deployment.yaml +++ b/k8s-kustomize/services/basket-api/base/deployment.yaml @@ -1,26 +1,26 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: basket-api + name: cart-api spec: replicas: 1 selector: matchLabels: - app: basket-api + app: cart-api template: metadata: labels: - app: basket-api + app: cart-api spec: containers: - - image: basket-api # must much from ./kustomization.yaml -> images[0].name + - image: cart-api # must much from ./kustomization.yaml -> images[0].name imagePullPolicy: IfNotPresent - name: basket-api + name: cart-api ports: - containerPort: 5200 envFrom: - configMapKeyRef: - name: basket-api + name: cart-api resources: requests: memory: "32Mi" diff --git a/k8s-kustomize/services/basket-api/base/http-route.yaml b/k8s-kustomize/services/basket-api/base/http-route.yaml index 825b061f1..4869a65e8 100644 --- a/k8s-kustomize/services/basket-api/base/http-route.yaml +++ b/k8s-kustomize/services/basket-api/base/http-route.yaml @@ -1,7 +1,7 @@ apiVersion: gateway.networking.k8s.io/v1alpha2 kind: HTTPRoute metadata: - name: basket-api + name: cart-api spec: parentRefs: - kind: Gateway @@ -13,5 +13,5 @@ spec: type: PathPrefix value: /basket backendRefs: - - name: basket-api + - name: cart-api port: 80 \ No newline at end of file diff --git a/k8s-kustomize/services/basket-api/base/kustomization.yaml b/k8s-kustomize/services/basket-api/base/kustomization.yaml index 2087058f3..04828bc05 100644 --- a/k8s-kustomize/services/basket-api/base/kustomization.yaml +++ b/k8s-kustomize/services/basket-api/base/kustomization.yaml @@ -13,9 +13,9 @@ resources: configMapGenerator: - envs: - config.env - name: basket-api + name: cart-api images: -- name: basket-api - newName: ghcr.io/chayxana/basket-api +- name: cart-api + newName: ghcr.io/chayxana/cart-api newTag: 0.0.27 diff --git a/k8s-kustomize/services/basket-api/base/service.yaml b/k8s-kustomize/services/basket-api/base/service.yaml index f9812af66..8bdc46f69 100644 --- a/k8s-kustomize/services/basket-api/base/service.yaml +++ b/k8s-kustomize/services/basket-api/base/service.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: Service metadata: - name: basket-api + name: cart-api spec: type: ClusterIP ports: @@ -9,4 +9,4 @@ spec: name: http targetPort: 5200 selector: - app: basket-api \ No newline at end of file + app: cart-api \ No newline at end of file diff --git a/k8s-kustomize/services/basket-api/dev/kustomization.yaml b/k8s-kustomize/services/basket-api/dev/kustomization.yaml index 98b75c00c..fb2e9e67b 100644 --- a/k8s-kustomize/services/basket-api/dev/kustomization.yaml +++ b/k8s-kustomize/services/basket-api/dev/kustomization.yaml @@ -7,6 +7,6 @@ configMapGenerator: - behavior: merge envs: - config.env - name: basket-api + name: cart-api resources: - ../base diff --git a/k8s-kustomize/services/order-api/base/config.env b/k8s-kustomize/services/order-api/base/config.env index 2aa4fad1a..19fcfd84a 100644 --- a/k8s-kustomize/services/order-api/base/config.env +++ b/k8s-kustomize/services/order-api/base/config.env @@ -1,3 +1,3 @@ -basket.url=http://basket-api +basket.url=http://cart-api datasource.url=jdbc:postgresql://order-pgsql-database:5432/orderdb env.var=prod \ No newline at end of file diff --git a/src/backend/backend.code-workspace b/src/backend/backend.code-workspace index b874158bd..2a6d0c729 100644 --- a/src/backend/backend.code-workspace +++ b/src/backend/backend.code-workspace @@ -14,8 +14,8 @@ "path": "./services/payment-api" }, { - "name": "basket-api", - "path": "./services/basket-api" + "name": "cart-api", + "path": "./services/cart-api" }, { "name": "identity-api", diff --git a/src/backend/docker/docker-compose.elk.yml b/src/backend/docker/docker-compose.elk.yml index 99417d865..ec11a09fc 100644 --- a/src/backend/docker/docker-compose.elk.yml +++ b/src/backend/docker/docker-compose.elk.yml @@ -19,14 +19,14 @@ services: fluentd-address: localhost:24224 tag: order-api - basket-api: + cart-api: links: - fluentd logging: driver: "fluentd" options: fluentd-address: localhost:24224 - tag: basket-api + tag: cart-api catlog-api: links: diff --git a/src/backend/docker/docker-compose.kafka.yml b/src/backend/docker/docker-compose.kafka.yml index 23913c2fd..9b24bebcd 100644 --- a/src/backend/docker/docker-compose.kafka.yml +++ b/src/backend/docker/docker-compose.kafka.yml @@ -1,7 +1,7 @@ --- version: "3.7" services: - basket-api: + cart-api: depends_on: kafka: condition: service_healthy diff --git a/src/backend/docker/docker-compose.override.yml b/src/backend/docker/docker-compose.override.yml index 832c65cd4..87ef1b8fe 100755 --- a/src/backend/docker/docker-compose.override.yml +++ b/src/backend/docker/docker-compose.override.yml @@ -13,7 +13,7 @@ services: - QUARKUS_OPENTELEMETRY_TRACER_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317 - QUARKUS_OPENTELEMETRY_PROPAGATORS=ottrace - basket-api: + cart-api: environment: - REDIS_HOST=redis:6379 - KAFKA_BROKER=kafka:29092 @@ -32,7 +32,7 @@ services: environment: - PORT=30001 - HOST=0.0.0.0 - - CART_URL=basket-api:8081 + - CART_URL=cart-api:8081 - PAYMENT_API_URL=payment-api:8080 - KAFKA_BROKER=kafka:29092 - CHECKOUT_TOPIC=checkout @@ -69,7 +69,7 @@ services: - IDENTITY_URL_PUB=http://localhost:8080/identity # connect: - # pgcli 'postgresql://admin:Passw0rd!@localhost:5435/identity_database' + # pgcli 'postgresql://admin:Passw0rd!@localhost:5433/orderdb' order-db: environment: - POSTGRES_PASSWORD=Passw0rd! diff --git a/src/backend/docker/docker-compose.traefik.yml b/src/backend/docker/docker-compose.traefik.yml index ea9caa16f..ce66f403f 100644 --- a/src/backend/docker/docker-compose.traefik.yml +++ b/src/backend/docker/docker-compose.traefik.yml @@ -33,7 +33,7 @@ services: - "traefik.http.routers.catalog.rule=PathPrefix(`/catalog/`)" - "traefik.port=8000" - basket-api: + cart-api: labels: - "traefik.enable=true" - "traefik.http.routers.basket.rule=PathPrefix(`/basket/`)" diff --git a/src/backend/docker/docker-compose.yml b/src/backend/docker/docker-compose.yml index ae1d5900d..ec5e39a86 100644 --- a/src/backend/docker/docker-compose.yml +++ b/src/backend/docker/docker-compose.yml @@ -14,7 +14,7 @@ services: image: restaurant/checkout-api build: ./services/checkout-api depends_on: - - basket-api + - cart-api - payment-api ports: - 30001:30001 @@ -29,10 +29,10 @@ services: - 8000:8000 restart: always - basket-api: - image: restaurant/basket-api + cart-api: + image: restaurant/cart-api container_name: basket - build: ./services/basket-api + build: ./services/cart-api depends_on: - redis diff --git a/src/backend/nginx/nginx.conf b/src/backend/nginx/nginx.conf index 1d152386e..9186ce2fa 100644 --- a/src/backend/nginx/nginx.conf +++ b/src/backend/nginx/nginx.conf @@ -6,8 +6,8 @@ upstream identity-api { server identity-api:80; } -upstream basket-api { - server basket-api:5200; +upstream cart-api { + server cart-api:5200; } upstream order-api { @@ -51,7 +51,7 @@ server { } location /basket/ { - proxy_pass http://basket-api/; + } location /order { diff --git a/src/backend/scripts/build.sh b/src/backend/scripts/build.sh index e7288eeb4..711e74233 100644 --- a/src/backend/scripts/build.sh +++ b/src/backend/scripts/build.sh @@ -25,7 +25,7 @@ build_order_api(){ } build_basket_api() { - cd ./services/basket.api/ + cd ./services/cart-api/ echo "#### Building Basket API" sh build.sh cd - diff --git a/src/backend/scripts/qa.sh b/src/backend/scripts/qa.sh index 1df626e3c..30b299003 100644 --- a/src/backend/scripts/qa.sh +++ b/src/backend/scripts/qa.sh @@ -19,7 +19,7 @@ main () { } qa_basket_api() { - cd ./services/basket.api + cd ./services/cart-api sh qa.sh } diff --git a/src/backend/services/basket-api/internal/models/checkout.go b/src/backend/services/basket-api/internal/models/checkout.go deleted file mode 100644 index 5a0ab90fe..000000000 --- a/src/backend/services/basket-api/internal/models/checkout.go +++ /dev/null @@ -1,29 +0,0 @@ -package models - -type UserCheckoutEvent struct { - CheckOutInfo *Checkout `json:"checkout_info"` - CustomerBasket *CustomerBasket `json:"customer_basket"` -} - -type Checkout struct { - CustomerID string `json:"customer_id"` - UserCurrency string `json:"user_currency"` - Address *Address `json:"address"` - Email string `json:"email"` - CreditCard *CreditCardInfo `json:"credit_card"` -} - -type Address struct { - StreetAddress string `json:"street_address"` - City string `json:"city"` - State string `json:"state"` - Country string `json:"country"` - ZipCode int32 `json:"zip_code"` -} - -type CreditCardInfo struct { - CreditCardNumber string `json:"credit_card_number"` - CreditCardCvv int32 `json:"credit_card_cvv"` - CreditCardExpirationYear int32 `json:"credit_card_expiration_year"` - CreditCardExpirationMonth int32 `json:"credit_card_expiration_month"` -} diff --git a/src/backend/services/basket-api/internal/models/customer_basket.go b/src/backend/services/basket-api/internal/models/customer_basket.go deleted file mode 100644 index 987313006..000000000 --- a/src/backend/services/basket-api/internal/models/customer_basket.go +++ /dev/null @@ -1,9 +0,0 @@ -package models - -import "github.com/google/uuid" - -// CustomerBasket relationship user and basket items -type CustomerBasket struct { - CustomerID uuid.UUID `json:"customer_id"` - Items *[]BasketItem `json:"items"` -} diff --git a/src/backend/services/basket-api/release.Dockerfile b/src/backend/services/basket-api/release.Dockerfile deleted file mode 100644 index 13933a94d..000000000 --- a/src/backend/services/basket-api/release.Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM alpine:latest -RUN apk --no-cache add ca-certificates - -ARG sourceFilePath=./basket.api - -COPY ${sourceFilePath} ./basket.api -CMD ["./basket.api"] -LABEL Name=basket.api Version=0.0.1 -EXPOSE 5200 -ENV PORT 5200 \ No newline at end of file diff --git a/src/backend/services/basket-api/.gitignore b/src/backend/services/cart-api/.gitignore similarity index 100% rename from src/backend/services/basket-api/.gitignore rename to src/backend/services/cart-api/.gitignore diff --git a/src/backend/services/basket-api/Dockerfile b/src/backend/services/cart-api/Dockerfile similarity index 75% rename from src/backend/services/basket-api/Dockerfile rename to src/backend/services/cart-api/Dockerfile index e33abaeaf..cc2644b5a 100644 --- a/src/backend/services/basket-api/Dockerfile +++ b/src/backend/services/cart-api/Dockerfile @@ -13,7 +13,7 @@ RUN go mod download COPY ./ ./ -RUN CGO_ENABLED=0 go build -installsuffix 'static' -o basket-api cmd/api/main.go +RUN CGO_ENABLED=0 go build -installsuffix 'static' -o cart-api cmd/api/main.go RUN CGO_ENABLED=0 go test -c ./internal/handlers -o handlers.test -cover #final stage @@ -21,7 +21,7 @@ FROM alpine:latest RUN apk --no-cache add ca-certificates COPY --from=builder /src ./ -CMD ["./basket-api"] -LABEL Name=basket.api Version=0.0.1 +CMD ["./cart-api"] +LABEL Name=cart-api Version=0.0.1 EXPOSE 5200 ENV PORT 5200 diff --git a/src/backend/services/basket-api/README.md b/src/backend/services/cart-api/README.md similarity index 100% rename from src/backend/services/basket-api/README.md rename to src/backend/services/cart-api/README.md diff --git a/src/backend/services/basket-api/build.sh b/src/backend/services/cart-api/build.sh similarity index 100% rename from src/backend/services/basket-api/build.sh rename to src/backend/services/cart-api/build.sh diff --git a/src/backend/services/basket-api/cmd/api/main.go b/src/backend/services/cart-api/cmd/api/main.go similarity index 89% rename from src/backend/services/basket-api/cmd/api/main.go rename to src/backend/services/cart-api/cmd/api/main.go index 791714251..d602813af 100644 --- a/src/backend/services/basket-api/cmd/api/main.go +++ b/src/backend/services/cart-api/cmd/api/main.go @@ -10,13 +10,13 @@ import ( "syscall" "time" - "github.com/jurabek/basket.api/cmd/config" - "github.com/jurabek/basket.api/internal/database" - "github.com/jurabek/basket.api/internal/docs" - grpcsvc "github.com/jurabek/basket.api/internal/grpc" - "github.com/jurabek/basket.api/internal/handlers" - "github.com/jurabek/basket.api/internal/middlewares" - pbv1 "github.com/jurabek/basket.api/pb/v1" + "github.com/jurabek/cart-api/cmd/config" + "github.com/jurabek/cart-api/internal/database" + "github.com/jurabek/cart-api/internal/docs" + grpcsvc "github.com/jurabek/cart-api/internal/grpc" + "github.com/jurabek/cart-api/internal/handlers" + "github.com/jurabek/cart-api/internal/middlewares" + pbv1 "github.com/jurabek/cart-api/pb/v1" "github.com/redis/go-redis/v9" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" @@ -32,7 +32,7 @@ import ( sdktrace "go.opentelemetry.io/otel/sdk/trace" semconv "go.opentelemetry.io/otel/semconv/v1.17.0" - "github.com/jurabek/basket.api/internal/repositories" + "github.com/jurabek/cart-api/internal/repositories" "github.com/rs/zerolog" "github.com/rs/zerolog/log" @@ -48,9 +48,9 @@ var ( Version string ) -// @title Basket API +// @title Cart API // @version 1.0 -// @description This is a rest api for basket which saves items to redis server +// @description This is a rest api for cart which saves items to redis server // @termsOfService http://swagger.io/terms/ // @contact.name API Support @@ -79,7 +79,7 @@ func main() { handleSigterm() router := gin.Default() router.Use(middlewares.RequestMiddleware()) - router.Use(otelgin.Middleware("basket-api")) + router.Use(otelgin.Middleware("cart-api")) cfg := config.Init() @@ -146,7 +146,7 @@ func grpcServer(svc pbv1.CartServiceServer) { func handleSigterm() { c := make(chan os.Signal, 1) - signal.Notify(c, syscall.SIGTERM, os.Kill, os.Interrupt) + signal.Notify(c, syscall.SIGTERM) go func() { <-c time.Sleep(10 * time.Second) @@ -160,7 +160,7 @@ func initTracer() (*sdktrace.TracerProvider, error) { res, err := resource.New(ctx, resource.WithAttributes( // the service name used to display traces in backends - semconv.ServiceName("basket-api"), + semconv.ServiceName("cart-api"), ), ) if err != nil { diff --git a/src/backend/services/basket-api/cmd/config/configuration.go b/src/backend/services/cart-api/cmd/config/configuration.go similarity index 100% rename from src/backend/services/basket-api/cmd/config/configuration.go rename to src/backend/services/cart-api/cmd/config/configuration.go diff --git a/src/backend/services/basket-api/coverage_result.sh b/src/backend/services/cart-api/coverage_result.sh similarity index 100% rename from src/backend/services/basket-api/coverage_result.sh rename to src/backend/services/cart-api/coverage_result.sh diff --git a/src/backend/services/basket-api/gen-swagger.sh b/src/backend/services/cart-api/gen-swagger.sh similarity index 100% rename from src/backend/services/basket-api/gen-swagger.sh rename to src/backend/services/cart-api/gen-swagger.sh diff --git a/src/backend/services/basket-api/genproto.sh b/src/backend/services/cart-api/genproto.sh similarity index 100% rename from src/backend/services/basket-api/genproto.sh rename to src/backend/services/cart-api/genproto.sh diff --git a/src/backend/services/basket-api/go.mod b/src/backend/services/cart-api/go.mod similarity index 99% rename from src/backend/services/basket-api/go.mod rename to src/backend/services/cart-api/go.mod index e2e0d9961..eca99f0f5 100644 --- a/src/backend/services/basket-api/go.mod +++ b/src/backend/services/cart-api/go.mod @@ -1,4 +1,4 @@ -module github.com/jurabek/basket.api +module github.com/jurabek/cart-api require ( github.com/Jurabek/gin-swagger v1.2.2 diff --git a/src/backend/services/basket-api/go.sum b/src/backend/services/cart-api/go.sum similarity index 99% rename from src/backend/services/basket-api/go.sum rename to src/backend/services/cart-api/go.sum index 43c7d94e8..78c6ee389 100644 --- a/src/backend/services/basket-api/go.sum +++ b/src/backend/services/cart-api/go.sum @@ -13,12 +13,15 @@ cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKV cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.105.0 h1:DNtEKRBAAzeS4KyIory52wWHuClNaXJ5x1F7xa4q+5Y= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/compute v1.15.1 h1:7UGq3QknM33pw5xATlpzeoomNxsacIVvTqTTvbfajmE= +cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= @@ -350,7 +353,6 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 h1:TKf2uAs2ueguzLaxOCB go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0/go.mod h1:HrbCVv40OOLTABmOn1ZWty6CHXkU8DK/Urc43tHug70= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 h1:ap+y8RXX3Mu9apKVtOkM6WSFESLM8K3wNQyOU8sWHcc= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0/go.mod h1:5w41DY6S9gZrbjuq6Y+753e96WfPha5IcsOSZTtullM= -go.opentelemetry.io/otel/metric v0.35.0 h1:aPT5jk/w7F9zW51L7WgRqNKDElBdyRLGuBtI5MX34e8= go.opentelemetry.io/otel/metric v0.35.0/go.mod h1:qAcbhaTRFU6uG8QM7dDo7XvFsWcugziq/5YI065TokQ= go.opentelemetry.io/otel/metric v0.37.0 h1:pHDQuLQOZwYD+Km0eb657A25NaRzy0a+eLyKfDXedEs= go.opentelemetry.io/otel/metric v0.37.0/go.mod h1:DmdaHfGt54iV6UKxsV9slj2bBRJcKC1B1uvDLIioc1s= @@ -449,6 +451,7 @@ golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.4.0 h1:NF0gk8LVPg1Ml7SSbGyySuoxdsXitj7TvgvuRxIMc/M= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -589,6 +592,7 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= diff --git a/src/backend/services/basket-api/install_ci_dependencies.sh b/src/backend/services/cart-api/install_ci_dependencies.sh similarity index 100% rename from src/backend/services/basket-api/install_ci_dependencies.sh rename to src/backend/services/cart-api/install_ci_dependencies.sh diff --git a/src/backend/services/basket-api/internal/database/db.go b/src/backend/services/cart-api/internal/database/db.go similarity index 100% rename from src/backend/services/basket-api/internal/database/db.go rename to src/backend/services/cart-api/internal/database/db.go diff --git a/src/backend/services/basket-api/internal/docs/docs.go b/src/backend/services/cart-api/internal/docs/docs.go similarity index 100% rename from src/backend/services/basket-api/internal/docs/docs.go rename to src/backend/services/cart-api/internal/docs/docs.go diff --git a/src/backend/services/basket-api/internal/docs/fix.go b/src/backend/services/cart-api/internal/docs/fix.go similarity index 100% rename from src/backend/services/basket-api/internal/docs/fix.go rename to src/backend/services/cart-api/internal/docs/fix.go diff --git a/src/backend/services/basket-api/internal/docs/swagger.json b/src/backend/services/cart-api/internal/docs/swagger.json similarity index 100% rename from src/backend/services/basket-api/internal/docs/swagger.json rename to src/backend/services/cart-api/internal/docs/swagger.json diff --git a/src/backend/services/basket-api/internal/docs/swagger.yaml b/src/backend/services/cart-api/internal/docs/swagger.yaml similarity index 100% rename from src/backend/services/basket-api/internal/docs/swagger.yaml rename to src/backend/services/cart-api/internal/docs/swagger.yaml diff --git a/src/backend/services/basket-api/internal/grpc/cart_service_grpc.go b/src/backend/services/cart-api/internal/grpc/cart_service_grpc.go similarity index 92% rename from src/backend/services/basket-api/internal/grpc/cart_service_grpc.go rename to src/backend/services/cart-api/internal/grpc/cart_service_grpc.go index 6fd55d357..2e28a4bd2 100644 --- a/src/backend/services/basket-api/internal/grpc/cart_service_grpc.go +++ b/src/backend/services/cart-api/internal/grpc/cart_service_grpc.go @@ -3,8 +3,8 @@ package grpc import ( context "context" - "github.com/jurabek/basket.api/internal/models" - pbv1 "github.com/jurabek/basket.api/pb/v1" + "github.com/jurabek/cart-api/internal/models" + pbv1 "github.com/jurabek/cart-api/pb/v1" ) var _ pbv1.CartServiceServer = (*cartGrpcService)(nil) diff --git a/src/backend/services/basket-api/internal/handlers/basket_handler.go b/src/backend/services/cart-api/internal/handlers/basket_handler.go similarity index 96% rename from src/backend/services/basket-api/internal/handlers/basket_handler.go rename to src/backend/services/cart-api/internal/handlers/basket_handler.go index 0057c8e48..7efa7522a 100644 --- a/src/backend/services/basket-api/internal/handlers/basket_handler.go +++ b/src/backend/services/cart-api/internal/handlers/basket_handler.go @@ -5,8 +5,8 @@ import ( "net/http" "github.com/gin-gonic/gin" - "github.com/jurabek/basket.api/internal/models" - "github.com/jurabek/basket.api/internal/repositories" + "github.com/jurabek/cart-api/internal/models" + "github.com/jurabek/cart-api/internal/repositories" "github.com/pkg/errors" ) diff --git a/src/backend/services/basket-api/internal/handlers/basket_handler_test.go b/src/backend/services/cart-api/internal/handlers/basket_handler_test.go similarity index 97% rename from src/backend/services/basket-api/internal/handlers/basket_handler_test.go rename to src/backend/services/cart-api/internal/handlers/basket_handler_test.go index b5a05c738..d9818d831 100644 --- a/src/backend/services/basket-api/internal/handlers/basket_handler_test.go +++ b/src/backend/services/cart-api/internal/handlers/basket_handler_test.go @@ -13,8 +13,8 @@ import ( "github.com/google/uuid" "github.com/gin-gonic/gin" - "github.com/jurabek/basket.api/internal/models" - "github.com/jurabek/basket.api/internal/repositories" + "github.com/jurabek/cart-api/internal/models" + "github.com/jurabek/cart-api/internal/repositories" "github.com/stretchr/testify/assert" ) diff --git a/src/backend/services/basket-api/internal/middlewares/swagger.go b/src/backend/services/cart-api/internal/middlewares/swagger.go similarity index 94% rename from src/backend/services/basket-api/internal/middlewares/swagger.go rename to src/backend/services/cart-api/internal/middlewares/swagger.go index 264aa15b9..c4bdbabc3 100644 --- a/src/backend/services/basket-api/internal/middlewares/swagger.go +++ b/src/backend/services/cart-api/internal/middlewares/swagger.go @@ -5,7 +5,7 @@ import ( "os" "github.com/gin-gonic/gin" - "github.com/jurabek/basket.api/internal/docs" + "github.com/jurabek/cart-api/internal/docs" ) // RequestMiddleware changes swagger Info on runtime diff --git a/src/backend/services/basket-api/internal/models/basket_item.go b/src/backend/services/cart-api/internal/models/customer_basket.go similarity index 65% rename from src/backend/services/basket-api/internal/models/basket_item.go rename to src/backend/services/cart-api/internal/models/customer_basket.go index d147106c1..fb1237d9a 100644 --- a/src/backend/services/basket-api/internal/models/basket_item.go +++ b/src/backend/services/cart-api/internal/models/customer_basket.go @@ -1,5 +1,7 @@ package models +import "github.com/google/uuid" + // BasketItem items for users basket type BasketItem struct { FoodID int `json:"food_id"` @@ -10,3 +12,9 @@ type BasketItem struct { FoodName string `json:"food_name"` FoodDescription string `json:"food_description"` } + +// CustomerBasket relationship user and basket items +type CustomerBasket struct { + CustomerID uuid.UUID `json:"customer_id"` + Items *[]BasketItem `json:"items"` +} diff --git a/src/backend/services/basket-api/internal/models/http_error.go b/src/backend/services/cart-api/internal/models/http_error.go similarity index 100% rename from src/backend/services/basket-api/internal/models/http_error.go rename to src/backend/services/cart-api/internal/models/http_error.go diff --git a/src/backend/services/basket-api/internal/repositories/mock_redis_connection.go b/src/backend/services/cart-api/internal/repositories/mock_redis_connection.go similarity index 100% rename from src/backend/services/basket-api/internal/repositories/mock_redis_connection.go rename to src/backend/services/cart-api/internal/repositories/mock_redis_connection.go diff --git a/src/backend/services/basket-api/internal/repositories/mock_repository.go b/src/backend/services/cart-api/internal/repositories/mock_repository.go similarity index 93% rename from src/backend/services/basket-api/internal/repositories/mock_repository.go rename to src/backend/services/cart-api/internal/repositories/mock_repository.go index 912af428d..8a425bb5b 100644 --- a/src/backend/services/basket-api/internal/repositories/mock_repository.go +++ b/src/backend/services/cart-api/internal/repositories/mock_repository.go @@ -3,7 +3,7 @@ package repositories import ( "context" - "github.com/jurabek/basket.api/internal/models" + "github.com/jurabek/cart-api/internal/models" "github.com/stretchr/testify/mock" ) diff --git a/src/backend/services/basket-api/internal/repositories/redis_repository.go b/src/backend/services/cart-api/internal/repositories/redis_repository.go similarity index 97% rename from src/backend/services/basket-api/internal/repositories/redis_repository.go rename to src/backend/services/cart-api/internal/repositories/redis_repository.go index 3c471528e..a636df164 100644 --- a/src/backend/services/basket-api/internal/repositories/redis_repository.go +++ b/src/backend/services/cart-api/internal/repositories/redis_repository.go @@ -6,7 +6,7 @@ import ( "errors" "fmt" - "github.com/jurabek/basket.api/internal/models" + "github.com/jurabek/cart-api/internal/models" "github.com/redis/go-redis/v9" ) diff --git a/src/backend/services/basket-api/internal/repositories/redis_repostory_test.go b/src/backend/services/cart-api/internal/repositories/redis_repostory_test.go similarity index 95% rename from src/backend/services/basket-api/internal/repositories/redis_repostory_test.go rename to src/backend/services/cart-api/internal/repositories/redis_repostory_test.go index 3238d9b72..eb23b1707 100644 --- a/src/backend/services/basket-api/internal/repositories/redis_repostory_test.go +++ b/src/backend/services/cart-api/internal/repositories/redis_repostory_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/google/uuid" - "github.com/jurabek/basket.api/internal/models" + "github.com/jurabek/cart-api/internal/models" ) var items = []models.BasketItem{{ diff --git a/src/backend/services/basket-api/pb/cart.proto b/src/backend/services/cart-api/pb/cart.proto similarity index 100% rename from src/backend/services/basket-api/pb/cart.proto rename to src/backend/services/cart-api/pb/cart.proto diff --git a/src/backend/services/basket-api/pb/v1/cart.pb.go b/src/backend/services/cart-api/pb/v1/cart.pb.go similarity index 100% rename from src/backend/services/basket-api/pb/v1/cart.pb.go rename to src/backend/services/cart-api/pb/v1/cart.pb.go diff --git a/src/backend/services/basket-api/pb/v1/cart_grpc.pb.go b/src/backend/services/cart-api/pb/v1/cart_grpc.pb.go similarity index 100% rename from src/backend/services/basket-api/pb/v1/cart_grpc.pb.go rename to src/backend/services/cart-api/pb/v1/cart_grpc.pb.go diff --git a/src/backend/services/basket-api/pkg/producer/kafka_producer.go b/src/backend/services/cart-api/pkg/producer/kafka_producer.go similarity index 100% rename from src/backend/services/basket-api/pkg/producer/kafka_producer.go rename to src/backend/services/cart-api/pkg/producer/kafka_producer.go diff --git a/src/backend/services/basket-api/pkg/util/hosthelper.go b/src/backend/services/cart-api/pkg/util/hosthelper.go similarity index 100% rename from src/backend/services/basket-api/pkg/util/hosthelper.go rename to src/backend/services/cart-api/pkg/util/hosthelper.go diff --git a/src/backend/services/basket-api/pkg/util/iphelper.go b/src/backend/services/cart-api/pkg/util/iphelper.go similarity index 100% rename from src/backend/services/basket-api/pkg/util/iphelper.go rename to src/backend/services/cart-api/pkg/util/iphelper.go diff --git a/src/backend/services/basket-api/pkg/util/porthelper.go b/src/backend/services/cart-api/pkg/util/porthelper.go similarity index 100% rename from src/backend/services/basket-api/pkg/util/porthelper.go rename to src/backend/services/cart-api/pkg/util/porthelper.go diff --git a/src/backend/services/basket-api/qa.sh b/src/backend/services/cart-api/qa.sh similarity index 100% rename from src/backend/services/basket-api/qa.sh rename to src/backend/services/cart-api/qa.sh diff --git a/src/backend/services/cart-api/release.Dockerfile b/src/backend/services/cart-api/release.Dockerfile new file mode 100644 index 000000000..a62ab92c0 --- /dev/null +++ b/src/backend/services/cart-api/release.Dockerfile @@ -0,0 +1,10 @@ +FROM alpine:latest +RUN apk --no-cache add ca-certificates + +ARG sourceFilePath=./cart-api + +COPY ${sourceFilePath} ./cart-api +CMD ["./cart-api"] +LABEL Name=cart-api Version=0.0.1 +EXPOSE 5200 +ENV PORT 5200 \ No newline at end of file diff --git a/src/backend/services/basket-api/run.sh b/src/backend/services/cart-api/run.sh similarity index 100% rename from src/backend/services/basket-api/run.sh rename to src/backend/services/cart-api/run.sh diff --git a/src/backend/services/basket-api/sonar-project.properties b/src/backend/services/cart-api/sonar-project.properties similarity index 91% rename from src/backend/services/basket-api/sonar-project.properties rename to src/backend/services/cart-api/sonar-project.properties index acefd735b..a77c4e0cf 100644 --- a/src/backend/services/basket-api/sonar-project.properties +++ b/src/backend/services/cart-api/sonar-project.properties @@ -1,4 +1,4 @@ -sonar.projectKey=restaurant-basket-api +sonar.projectKey=restaurant-cart-api sonar.projectName=Basket API sonar.host.url=https://sonarcloud.io sonar.organization=restaurant-app diff --git a/src/backend/services/basket-api/test.sh b/src/backend/services/cart-api/test.sh similarity index 100% rename from src/backend/services/basket-api/test.sh rename to src/backend/services/cart-api/test.sh diff --git a/src/backend/services/basket-api/version b/src/backend/services/cart-api/version similarity index 100% rename from src/backend/services/basket-api/version rename to src/backend/services/cart-api/version diff --git a/src/backend/services/checkout-api/README.md b/src/backend/services/checkout-api/README.md index fb21fec66..6632b78ba 100644 --- a/src/backend/services/checkout-api/README.md +++ b/src/backend/services/checkout-api/README.md @@ -36,7 +36,7 @@ The response will be a plain text message, either "Checkout OK" or an error mess ## Implementation Details When a request is made to the API endpoint, the `Checkout()` function is called, which initiates the checkout process. -- The checkout process involves retrieving the customer's cart items using the grpc by calling basket-api. +- The checkout process involves retrieving the customer's cart items using the grpc by calling cart-api. - After that it calculates amount that user has to pay and processes payment using the payment-api. - When payment is successful it creates a checkout event and publishes to a message broker (e.g Kafka). diff --git a/src/backend/services/identity-api/Identity.API/IdentityServer/Config.cs b/src/backend/services/identity-api/Identity.API/IdentityServer/Config.cs index d563a3878..d2406a89b 100644 --- a/src/backend/services/identity-api/Identity.API/IdentityServer/Config.cs +++ b/src/backend/services/identity-api/Identity.API/IdentityServer/Config.cs @@ -25,7 +25,7 @@ public static IEnumerable GetApiScopes() { new ApiScope("catalog-api", "Restaurant Catalog Api") { UserClaims = { "role" } }, new ApiScope("order-api", "Restaurant Order Api") { UserClaims = { "role" } }, - new ApiScope("basket-api", "Restaurant Basket Api") { UserClaims = { "role" } }, + new ApiScope("cart-api", "Restaurant Basket Api") { UserClaims = { "role" } }, new ApiScope("checkout-api", "Restaurant Checkout Api") { UserClaims = { "role" } }, new ApiScope("payment-api", "Restaurant Payment Api") { UserClaims = { "role" } } }; @@ -45,7 +45,7 @@ public static IEnumerable GetClients(IDictionary clientU AllowedScopes = { "menu-api", - "basket-api", + "cart-api", "order-api" }, AllowOfflineAccess = true @@ -65,7 +65,7 @@ public static IEnumerable GetClients(IDictionary clientU IdentityServerConstants.StandardScopes.Profile, IdentityServerConstants.StandardScopes.Email, "menu-api", - "basket-api", + "cart-api", "order-api" }, }, @@ -82,14 +82,14 @@ public static IEnumerable GetClients(IDictionary clientU }, new Client { - ClientId = "basket-api-swagger-ui", + ClientId = "cart-api-swagger-ui", ClientName = "Basket API Swagger UI", RequireConsent = false, AllowedGrantTypes = GrantTypes.Implicit, AllowAccessTokensViaBrowser = true, RedirectUris = { $"{clientUrls["BasketApiUrl"]}/swagger/oauth2-redirect.html" ,"http://localhost:3200/oauth2-redirect.html" }, PostLogoutRedirectUris = { $"{clientUrls["BasketApiUrl"]}/swagger/" }, - AllowedScopes = { "basket-api" } + AllowedScopes = { "cart-api" } }, new Client { @@ -117,7 +117,7 @@ public static IEnumerable GetClients(IDictionary clientU IdentityServerConstants.StandardScopes.OpenId, IdentityServerConstants.StandardScopes.Profile, "catalog-api", - "basket-api", + "cart-api", "order-api", "payment-api", "checkout-api" diff --git a/src/backend/web/web.admin/dashboard/src/app/services/auth.service.ts b/src/backend/web/web.admin/dashboard/src/app/services/auth.service.ts index ed5e8a084..980c63331 100644 --- a/src/backend/web/web.admin/dashboard/src/app/services/auth.service.ts +++ b/src/backend/web/web.admin/dashboard/src/app/services/auth.service.ts @@ -62,7 +62,7 @@ function getClientSettings(): UserManagerSettings { redirect_uri: window.location.origin + '/dashboard' + '/auth-callback', post_logout_redirect_uri: window.location.origin + '/dashboard', response_type: 'id_token token', - scope: 'openid profile menu-api order-api basket-api', + scope: 'openid profile menu-api order-api cart-api', filterProtocolClaims: true, loadUserInfo: true, automaticSilentRenew: true, diff --git a/src/backend/web/web.client/web-app-new/src/lib/auth.ts b/src/backend/web/web.client/web-app-new/src/lib/auth.ts index 52ee03e1a..f371c965d 100644 --- a/src/backend/web/web.client/web-app-new/src/lib/auth.ts +++ b/src/backend/web/web.client/web-app-new/src/lib/auth.ts @@ -11,7 +11,7 @@ export const authOptions: AuthOptions = { issuer: process.env.AUTH_ISSUER, authorization: { params: { - scope: 'openid profile catalog-api order-api basket-api payment-api checkout-api' + scope: 'openid profile catalog-api order-api cart-api payment-api checkout-api' } } }) diff --git a/src/backend/web/web.client/web-app/src/api/AuthService.ts b/src/backend/web/web.client/web-app/src/api/AuthService.ts index 27204eab9..edd7a3fcd 100644 --- a/src/backend/web/web.client/web-app/src/api/AuthService.ts +++ b/src/backend/web/web.client/web-app/src/api/AuthService.ts @@ -62,7 +62,7 @@ // redirect_uri: window.location.origin + '/dashboard' + '/auth-callback', // post_logout_redirect_uri: window.location.origin + '/dashboard', // response_type: 'id_token token', -// scope: 'openid profile menu-api order-api basket-api', +// scope: 'openid profile menu-api order-api cart-api', // filterProtocolClaims: true, // loadUserInfo: true, // automaticSilentRenew: true,