diff --git a/docker/docker-compose-local.yml b/docker/docker-compose-local.yml index 1588268..2afb69d 100644 --- a/docker/docker-compose-local.yml +++ b/docker/docker-compose-local.yml @@ -2,19 +2,21 @@ version: "3" services: - rabbitmq: - image: rabbitmq:3-management + devstore-rabbit: + image: rabbitmq:management container_name: devstore-rabbit + ports: + - 5672:5672 + - 15672:15672 environment: - RABBITMQ_DEFAULT_USER: "devstore" - RABBITMQ_DEFAULT_PASS: "devstore" + RABBITMQ_DEFAULT_USER: devstore + RABBITMQ_DEFAULT_PASS: devstore sql-server: - image: desenvolvedorio/devstore-sql-server:latest + image: mcr.microsoft.com/mssql/server:2017-latest container_name: devstore-sql-server - build: - context: ../sql - dockerfile: ./Dockerfile + ports: + - 1433:1433 environment: SA_PASSWORD: "MyDB@123" ACCEPT_EULA: "Y" @@ -27,7 +29,7 @@ services: dockerfile: ./web/DevStore.WebApp.MVC/Dockerfile restart: always environment: - - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_ENVIRONMENT=Docker - ASPNETCORE_URLS=http://*:5001 - LC_ALL=en_US.UTF-8 - LANG=en_US.UTF-8 @@ -48,14 +50,14 @@ services: dockerfile: ./services/DevStore.Identity.API/Dockerfile restart: always environment: - - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_ENVIRONMENT=Docker - ASPNETCORE_URLS=https://+:5101;http://+5102 - - ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore - - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx + - ASPNETCORE_Kestrel__Certificates__Default__Password=9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe + - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore.academy-localhost.pfx volumes: - ./certs:/https:ro depends_on: - - rabbitmq + - devstore-rabbit - sql-server api-cart: @@ -66,14 +68,14 @@ services: dockerfile: ./services/DevStore.ShoppingCart.API/Dockerfile restart: always environment: - - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_ENVIRONMENT=Docker - ASPNETCORE_URLS=https://+:5201;http://+5202 - - ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore - - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx + - ASPNETCORE_Kestrel__Certificates__Default__Password=9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe + - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore.academy-localhost.pfx volumes: - ./certs:/https:ro depends_on: - - rabbitmq + - devstore-rabbit - api-identity - sql-server @@ -85,14 +87,14 @@ services: dockerfile: ./services/DevStore.Catalog.API/Dockerfile restart: always environment: - - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_ENVIRONMENT=Docker - ASPNETCORE_URLS=https://+:5301;http://+5302 - - ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore - - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx + - ASPNETCORE_Kestrel__Certificates__Default__Password=9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe + - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore.academy-localhost.pfx volumes: - ./certs:/https:ro depends_on: - - rabbitmq + - devstore-rabbit - sql-server api-customers: @@ -103,14 +105,14 @@ services: dockerfile: ./services/DevStore.Customers.API/Dockerfile restart: always environment: - - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_ENVIRONMENT=Docker - ASPNETCORE_URLS=https://+:5401;http://+5402 - - ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore - - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx + - ASPNETCORE_Kestrel__Certificates__Default__Password=9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe + - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore.academy-localhost.pfx volumes: - ./certs:/https:ro depends_on: - - rabbitmq + - devstore-rabbit - api-identity - sql-server @@ -122,14 +124,14 @@ services: dockerfile: ./api-gateways/DevStore.Bff.Checkout/Dockerfile restart: always environment: - - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_ENVIRONMENT=Docker - ASPNETCORE_URLS=https://+:5501;http://+5502 - - ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore - - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx + - ASPNETCORE_Kestrel__Certificates__Default__Password=9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe + - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore.academy-localhost.pfx volumes: - ./certs:/https:ro depends_on: - - rabbitmq + - devstore-rabbit - api-identity - api-cart - api-billing @@ -143,14 +145,14 @@ services: dockerfile: ./services/DevStore.Billing.API/Dockerfile restart: always environment: - - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_ENVIRONMENT=Docker - ASPNETCORE_URLS=https://+:5601;http://+5602 - - ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore - - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx + - ASPNETCORE_Kestrel__Certificates__Default__Password=9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe + - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore.academy-localhost.pfx volumes: - ./certs:/https:ro depends_on: - - rabbitmq + - devstore-rabbit - api-identity - api-order - sql-server @@ -163,14 +165,14 @@ services: dockerfile: ./services/DevStore.Orders.API/Dockerfile restart: always environment: - - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_ENVIRONMENT=Docker - ASPNETCORE_URLS=https://+:5701;http://+5702 - - ASPNETCORE_Kestrel__Certificates__Default__Password=nerdstore - - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/nerdstore-certificate.pfx + - ASPNETCORE_Kestrel__Certificates__Default__Password=9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe + - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/devstore.academy-localhost.pfx volumes: - ./certs:/https:ro depends_on: - - rabbitmq + - devstore-rabbit - sql-server - api-identity @@ -187,5 +189,16 @@ services: depends_on: - web-mvc + generate-pfx: + image: emberstack/openssl + container_name: generate-pfx + volumes: + - ./certs:/https:rw + command: > + sh -c "[ -e "./https/devstore.academy-localhost.pfx" ] && echo File Already exist || (openssl genrsa -out devstore.rsa 2048 && + openssl req -sha256 -new -key devstore.rsa -out devstore.csr -subj '/CN=localhost' && + openssl x509 -req -sha256 -days 1825 -in devstore.csr -signkey devstore.rsa -out devstore.crt && + openssl pkcs12 -export -out /https/devstore.academy-localhost.pfx -inkey devstore.rsa -in devstore.crt -password pass:9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe)" + volumes: - dpkeys: \ No newline at end of file + dpkeys: \ No newline at end of file diff --git a/docker/pfx/devstore.academy.localhost b/docker/pfx/devstore.academy.localhost new file mode 100644 index 0000000..5c492fa Binary files /dev/null and b/docker/pfx/devstore.academy.localhost differ diff --git a/docker/pfx/devstore.crt b/docker/pfx/devstore.crt new file mode 100644 index 0000000..332e7ac --- /dev/null +++ b/docker/pfx/devstore.crt @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICrzCCAZcCFAWxMLTPB0q8Ora4PRrIRz2KwZUEMA0GCSqGSIb3DQEBCwUAMBQx +EjAQBgNVBAMMCWxvY2FsaG9zdDAeFw0yMjA0MDQwMzEzMDNaFw0yNzA0MDMwMzEz +MDNaMBQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAMSAbs5JB+0mZL1etOSClVSVSe5OnRzzd3jXI1v0uD++3LLFAbOh +KwKAvLC/fnn5bonhrlpr6wH+3JziGDdW0kknO1OvJGoXdosIZTT6OcBvl/O/q+5F +agvQiA7aXuE12DT9JA3JjMGoOd+0Q+6dwXiFE3q9RgmvoOHmzZVm/2E9g+WAAU9m +Uqks5CD2NXI3xokiArMeMkFxYV6od4AswtDMx8YQseDTh87NB+r2RfubJ8xpYYNe +OyEOzXto6UVUEPvOau/wwxO/urSbPkkjvy0aeysrTCY2LUE1wbPiPp0HpowYiEJU +or4mEbI+YgD5ydXitNheGxdLGcBPjV+AuAECAwEAATANBgkqhkiG9w0BAQsFAAOC +AQEAbmrIDyYQdgwSfP3qYc2DNpExjln+jOmnIH7kSqdMzV48KzBf3/Si50Y8IvMt ++wDN2z77OjhttePC4+kdUVmjRzGVktly+1gLb++fJVvZqT0wV6Ui8SE7xRqA/oL6 +bUqkjHKgrL6VuSj0ruJ5X++Ue0hXBxM+e4O4Umt6qfj2t5IcO0t+slxeO6Cyo1u/ +ZHzy7DDxOXExeEJ48xI1E8lVp7dxDT7Gm92vfhKzkvF6YGMlXCoiFDjYFd07d+8D +xofnYUD507nkNz60IRGWtEHzpBCONrAykCeBnEX0gB05O/BG+NrLSSCdYLS4DmkU +4cpVtbQ1VbeoGhfxFuE1syVwKQ== +-----END CERTIFICATE----- diff --git a/docker/pfx/devstore.csr b/docker/pfx/devstore.csr new file mode 100644 index 0000000..d870040 --- /dev/null +++ b/docker/pfx/devstore.csr @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIICWTCCAUECAQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0B +AQEFAAOCAQ8AMIIBCgKCAQEAxIBuzkkH7SZkvV605IKVVJVJ7k6dHPN3eNcjW/S4 +P77cssUBs6ErAoC8sL9+efluieGuWmvrAf7cnOIYN1bSSSc7U68kahd2iwhlNPo5 +wG+X87+r7kVqC9CIDtpe4TXYNP0kDcmMwag537RD7p3BeIUTer1GCa+g4ebNlWb/ +YT2D5YABT2ZSqSzkIPY1cjfGiSICsx4yQXFhXqh3gCzC0MzHxhCx4NOHzs0H6vZF ++5snzGlhg147IQ7Ne2jpRVQQ+85q7/DDE7+6tJs+SSO/LRp7KytMJjYtQTXBs+I+ +nQemjBiIQlSiviYRsj5iAPnJ1eK02F4bF0sZwE+NX4C4AQIDAQABoAAwDQYJKoZI +hvcNAQELBQADggEBAEYYlcxafY3+Dx9vbbSpQRRh7iHPMQwUOdB3d3+XOK7Fh/N0 +6LXVJBiNzQIprcM4LzatFXnTcCjjJc7WsLMK8ZzH+by3npUijQGA6Ns75J5erIQl +4r9WB5THGFONZOFazSBGWesWB1Oq1me7CK92C+TnOn7OIp8TSV+qT2iNHqgPnFRb +e2UayAiKg3EiVw4f0WpYT+CgbBONgjtfvnL+e01LH4XTCgeI2ppkRv+lQM1EhBhx +6Dl/DdCmqnA+IE+7GcrdMHut/QBSYxrita19sXxotlznpwjbfPjUSd2veUgPtHS5 +Ed8b2FmNViNRoDGA1vMbXlS5bf8XMMr+7NQmjls= +-----END CERTIFICATE REQUEST----- diff --git a/docker/pfx/devstore.rsa b/docker/pfx/devstore.rsa new file mode 100644 index 0000000..e26eb66 --- /dev/null +++ b/docker/pfx/devstore.rsa @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAxIBuzkkH7SZkvV605IKVVJVJ7k6dHPN3eNcjW/S4P77cssUB +s6ErAoC8sL9+efluieGuWmvrAf7cnOIYN1bSSSc7U68kahd2iwhlNPo5wG+X87+r +7kVqC9CIDtpe4TXYNP0kDcmMwag537RD7p3BeIUTer1GCa+g4ebNlWb/YT2D5YAB +T2ZSqSzkIPY1cjfGiSICsx4yQXFhXqh3gCzC0MzHxhCx4NOHzs0H6vZF+5snzGlh +g147IQ7Ne2jpRVQQ+85q7/DDE7+6tJs+SSO/LRp7KytMJjYtQTXBs+I+nQemjBiI +QlSiviYRsj5iAPnJ1eK02F4bF0sZwE+NX4C4AQIDAQABAoIBAQCVHPD40SqWp3/i +xC95CC7RlMgZcsZ+5bJPnNJUQYxfszI+5oi4CyFcMNz/MxGC9ekP8JYiP6qCRSic +VGYT+Gpy4LaAdnOnnk5yithiL1AL26LvcQ/DLCGg/YmB2+wL8pQzAbWOUNfjTQk9 +3MmAFW5vSmzRwzeWuhPX2RFAwnwhCPzbkHhv4mTc47xkskQRaY2gCxOZiqaRdOpD +V/VaDk7TsnsK7MuFaYIInXtFFVDgu4H0mGzZlz03Tzfxd4H4ZFIuPLVzSaGqNIby +PuTCe12uYPlk0fjLU0liIj3wyrkZuFf8U5GDq05na0gGOR51o1m1MHEh5ewlu1Qz +mAK3ITRRAoGBAOCa6HvKAxfN8fhjg7qR3xFv8ELjc7PwpUlmNoycnc2a9vJi+kde +L/pRUsZF9QbRPXYkHtKKLCZY4waMKlNvsE2xVxYicwfMf9ww0sfg8QcGH7fv6Il/ +HSgIGLLxVNmLmpOoAA21dJhPin+n9uVNH+mJdQusdU0+G+L357RW/jIbAoGBAN/3 +5OZwJPX29lks8276DjdoF86nVqYdwaKapPpiET/HPNqHBMHs9lQtHamCfg4w6WgG +lTYyrvfHDpAuZd/mCdYt/tFFfxswZ0s3tni/S3KRhWDM4Qz/c1jAOrpdc0GBmE4F +6ERmzKJK5TRYo+nrlHLmL6a61PxSloGCxJhyGQATAoGAX79p0Cuj+effeQXjSAub +TnGruLgBwPmbXJjoNDUnyFiBYX70NqxeQ5Wbdc6oz8kvLEflo9cnTwmhbk8eVAdO +3y/0cgkphG+XKiTeFjs8RMRFjUIGnWbE5SXecZoTk9HBiaSasT1jgPKXlifiRooE +SqhAb0OLleweMzl/Ww+iuXUCgYAE/wy2L05DxmycdKpBkYZ7qfDOBWGjdwp4zCZe +B44G9DThUx3CDb05B4Cf5W9WdbTfQzZU7TCGCoTCpqZTJliV1JTYqko5mwzS2r1R +WEMgnSpyjF+A4Ln8At3MhoUpsvBo3SzfScPK4wzV7BxL/ZtkLMpnV8ekkVsWLIqi +M/lmzQKBgQCCzyUfHPXhlX66lV6fPb8cLcoHKz3U/UiPGL2J+wd5lOWp0tp/qV/V +FGWaxDptl1IGeb7TPNm5tsXppFOPk/ixzYHc/b9c3U9efISCRLeT3rYBdfXZpyw6 +bqj9s4CgzmY/H3IKWTH6FzxMiKVsw/eh+/O+F9qy5nMht2wzDh1BXg== +-----END RSA PRIVATE KEY----- diff --git a/docker/teste.yml b/docker/teste.yml new file mode 100644 index 0000000..4b20761 --- /dev/null +++ b/docker/teste.yml @@ -0,0 +1,17 @@ +version: "3" + +services: + + genpfx: + image: emberstack/openssl + container_name: genpfx + volumes: + - ./certs:/certs:rw + command: > + sh -c "[ -e "./certs/devstore.academy.localhost" ] && echo File Already exist || openssl genrsa -out devstore.rsa 2048 && + openssl req -sha256 -new -key devstore.rsa -out devstore.csr -subj '/CN=localhost' && + openssl x509 -req -sha256 -days 1825 -in devstore.csr -signkey devstore.rsa -out devstore.crt && + openssl pkcs12 -export -out /certs/devstore.academy.localhost -inkey devstore.rsa -in devstore.crt -password pass:9HoGMnb7Lu8NFdHBz4Vq2rtKivzMhmMXhtvuB4TZcLMmbWfFmDQCjJeLURAJ4GYe" + +volumes: + certs: \ No newline at end of file diff --git a/sql/Dockerfile b/sql/Dockerfile deleted file mode 100644 index fc0deb0..0000000 --- a/sql/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM mcr.microsoft.com/mssql/rhel/server:2019-CU1-rhel-8 -RUN mkdir -p /usr/work -WORKDIR /usr/work -COPY . /usr/work/ - -EXPOSE 1433 - -CMD /bin/bash ./entrypoint.sh \ No newline at end of file diff --git a/sql/entrypoint.sh b/sql/entrypoint.sh deleted file mode 100644 index 3aaf22d..0000000 --- a/sql/entrypoint.sh +++ /dev/null @@ -1 +0,0 @@ -/usr/work/import-data.sh & /opt/mssql/bin/sqlservr \ No newline at end of file diff --git a/sql/generate-database.sql b/sql/generate-database.sql deleted file mode 100644 index 4abf23f..0000000 --- a/sql/generate-database.sql +++ /dev/null @@ -1,679 +0,0 @@ -USE [master] -GO -/****** Object: Database [DSBilling] Script Date: 01/10/2021 21:23:12 ******/ -CREATE DATABASE [DSBilling] -GO - -USE [DSBilling] -GO - -CREATE TABLE [dbo].[Payments]( - [Id] [uniqueidentifier] NOT NULL, - [OrderId] [uniqueidentifier] NOT NULL, - [PaymentType] [int] NOT NULL, - [Amount] [decimal](18, 2) NOT NULL, - CONSTRAINT [PK_Payments] PRIMARY KEY CLUSTERED -( - [Id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] -GO - -CREATE TABLE [dbo].[Transactions]( - [Id] [uniqueidentifier] NOT NULL, - [AuthorizationCode] [varchar](100) NULL, - [CreditCardCompany] [varchar](100) NULL, - [TransactionDate] [datetime2](7) NULL, - [Amount] [decimal](18, 2) NOT NULL, - [TransactionCost] [decimal](18, 2) NOT NULL, - [TransactionStatus] [int] NOT NULL, - [TID] [varchar](100) NULL, - [NSU] [varchar](100) NULL, - [PaymentId] [uniqueidentifier] NOT NULL, - CONSTRAINT [PK_Transactions] PRIMARY KEY CLUSTERED -( - [Id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] -GO - -CREATE NONCLUSTERED INDEX [IX_Transactions_PaymentId] ON [dbo].[Transactions] -( - [PaymentId] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -GO -ALTER TABLE [dbo].[Transactions] WITH CHECK ADD CONSTRAINT [FK_Transactions_Payments_PaymentId] FOREIGN KEY([PaymentId]) -REFERENCES [dbo].[Payments] ([Id]) -GO -ALTER TABLE [dbo].[Transactions] CHECK CONSTRAINT [FK_Transactions_Payments_PaymentId] -GO - -USE [master] -GO -ALTER DATABASE [DSBilling] SET READ_WRITE -GO - - - -/****** Object: Database [DSCatalog] Script Date: 01/10/2021 21:26:03 ******/ -CREATE DATABASE [DSCatalog] -GO - -USE [DSCatalog] -GO - -CREATE TABLE [dbo].[Products]( - [Id] [uniqueidentifier] NOT NULL, - [Name] [varchar](250) NOT NULL, - [Description] [varchar](500) NOT NULL, - [Active] [bit] NOT NULL, - [Price] [decimal](18, 2) NOT NULL, - [DateAdded] [datetime2](7) NOT NULL, - [Image] [varchar](250) NOT NULL, - [Stock] [int] NOT NULL, - CONSTRAINT [PK_Products] PRIMARY KEY CLUSTERED -( - [Id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] -GO - -USE [master] -GO - -ALTER DATABASE [DSCatalog] SET READ_WRITE -GO - - -/****** Object: Database [DSCustomers] Script Date: 01/10/2021 21:27:00 ******/ -CREATE DATABASE [DSCustomers] -GO - -USE [DSCustomers] -GO - -CREATE TABLE [dbo].[Addresses]( - [Id] [uniqueidentifier] NOT NULL, - [StreetAddress] [varchar](200) NOT NULL, - [BuildingNumber] [varchar](50) NOT NULL, - [SecondaryAddress] [varchar](250) NULL, - [Neighborhood] [varchar](100) NOT NULL, - [ZipCode] [varchar](20) NOT NULL, - [City] [varchar](100) NOT NULL, - [State] [varchar](50) NOT NULL, - [CustomerId] [uniqueidentifier] NOT NULL, - CONSTRAINT [PK_Addresses] PRIMARY KEY CLUSTERED -( - [Id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] -GO - -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -CREATE TABLE [dbo].[Customer]( - [Id] [uniqueidentifier] NOT NULL, - [Name] [varchar](200) NOT NULL, - [Email] [varchar](254) NULL, - [SocialNumber] [varchar](50) NOT NULL, - [Deleted] [bit] NOT NULL, - CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED -( - [Id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] -GO - -CREATE UNIQUE NONCLUSTERED INDEX [IX_Addresses_CustomerId] ON [dbo].[Addresses] -( - [CustomerId] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -GO -ALTER TABLE [dbo].[Addresses] WITH CHECK ADD CONSTRAINT [FK_Addresses_Customer_CustomerId] FOREIGN KEY([CustomerId]) -REFERENCES [dbo].[Customer] ([Id]) -GO -ALTER TABLE [dbo].[Addresses] CHECK CONSTRAINT [FK_Addresses_Customer_CustomerId] -GO - -USE [master] -GO -ALTER DATABASE [DSCustomers] SET READ_WRITE -GO - - -/****** Object: Database [DSOrders] Script Date: 01/10/2021 21:28:07 ******/ -CREATE DATABASE [DSOrders] -GO - -USE [DSOrders] -GO - -CREATE SEQUENCE [dbo].[MySequence] - AS [int] - START WITH 1000 - INCREMENT BY 1 - MINVALUE -2147483648 - MAXVALUE 2147483647 - CACHE -GO - -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -CREATE TABLE [dbo].[OrderItems]( - [Id] [uniqueidentifier] NOT NULL, - [OrderId] [uniqueidentifier] NOT NULL, - [ProductId] [uniqueidentifier] NOT NULL, - [ProductName] [varchar](250) NOT NULL, - [Quantity] [int] NOT NULL, - [Price] [decimal](18, 2) NOT NULL, - [ProductImage] [varchar](100) NULL, - CONSTRAINT [PK_OrderItems] PRIMARY KEY CLUSTERED -( - [Id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] -GO - -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -CREATE TABLE [dbo].[Orders]( - [Id] [uniqueidentifier] NOT NULL, - [Code] [int] NOT NULL, - [CustomerId] [uniqueidentifier] NOT NULL, - [VoucherId] [uniqueidentifier] NULL, - [HasVoucher] [bit] NOT NULL, - [Discount] [decimal](18, 2) NOT NULL, - [Amount] [decimal](18, 2) NOT NULL, - [DateAdded] [datetime2](7) NOT NULL, - [OrderStatus] [int] NOT NULL, - [StreetAddress] [varchar](100) NULL, - [BuildingNumber] [varchar](100) NULL, - [SecondaryAddress] [varchar](100) NULL, - [Neighborhood] [varchar](100) NULL, - [ZipCode] [varchar](100) NULL, - [City] [varchar](100) NULL, - [State] [varchar](100) NULL, - CONSTRAINT [PK_Orders] PRIMARY KEY CLUSTERED -( - [Id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] -GO - -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -CREATE TABLE [dbo].[Vouchers]( - [Id] [uniqueidentifier] NOT NULL, - [Code] [varchar](100) NOT NULL, - [Percentage] [decimal](18, 2) NULL, - [Discount] [decimal](18, 2) NULL, - [Quantity] [int] NOT NULL, - [DiscountType] [int] NOT NULL, - [CreatedAt] [datetime2](7) NOT NULL, - [UsedAt] [datetime2](7) NULL, - [ExpirationDate] [datetime2](7) NOT NULL, - [Active] [bit] NOT NULL, - [Used] [bit] NOT NULL, - CONSTRAINT [PK_Vouchers] PRIMARY KEY CLUSTERED -( - [Id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] -GO - -CREATE NONCLUSTERED INDEX [IX_OrderItems_OrderId] ON [dbo].[OrderItems] -( - [OrderId] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -GO - -CREATE NONCLUSTERED INDEX [IX_Orders_VoucherId] ON [dbo].[Orders] -( - [VoucherId] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -GO -ALTER TABLE [dbo].[Orders] ADD DEFAULT (NEXT VALUE FOR [MySequence]) FOR [Code] -GO -ALTER TABLE [dbo].[OrderItems] WITH CHECK ADD CONSTRAINT [FK_OrderItems_Orders_OrderId] FOREIGN KEY([OrderId]) -REFERENCES [dbo].[Orders] ([Id]) -GO -ALTER TABLE [dbo].[OrderItems] CHECK CONSTRAINT [FK_OrderItems_Orders_OrderId] -GO -ALTER TABLE [dbo].[Orders] WITH CHECK ADD CONSTRAINT [FK_Orders_Vouchers_VoucherId] FOREIGN KEY([VoucherId]) -REFERENCES [dbo].[Vouchers] ([Id]) -GO -ALTER TABLE [dbo].[Orders] CHECK CONSTRAINT [FK_Orders_Vouchers_VoucherId] -GO - -USE [master] -GO -ALTER DATABASE [DSOrders] SET READ_WRITE -GO - - -/****** Object: Database [DSShoppingCart] Script Date: 01/10/2021 21:29:26 ******/ -CREATE DATABASE [DSShoppingCart] -GO - -USE [DSShoppingCart] -GO - -CREATE TABLE [dbo].[CartItems]( - [Id] [uniqueidentifier] NOT NULL, - [ProductId] [uniqueidentifier] NOT NULL, - [Name] [varchar](100) NULL, - [Quantity] [int] NOT NULL, - [Price] [decimal](18, 2) NOT NULL, - [Image] [varchar](100) NULL, - [ShoppingCartId] [uniqueidentifier] NOT NULL, - CONSTRAINT [PK_CartItems] PRIMARY KEY CLUSTERED -( - [Id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] -GO - -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -CREATE TABLE [dbo].[CustomerShoppingCart]( - [Id] [uniqueidentifier] NOT NULL, - [CustomerId] [uniqueidentifier] NOT NULL, - [Total] [decimal](18, 2) NOT NULL, - [HasVoucher] [bit] NOT NULL, - [Discount] [decimal](18, 2) NOT NULL, - [Voucher_Percentage] [decimal](18, 2) NULL, - [Voucher_Discount] [decimal](18, 2) NULL, - [Voucher_Code] [varchar](50) NULL, - [Voucher_DiscountType] [int] NULL, - CONSTRAINT [PK_CustomerShoppingCart] PRIMARY KEY CLUSTERED -( - [Id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] -GO - -CREATE NONCLUSTERED INDEX [IX_CartItems_ShoppingCartId] ON [dbo].[CartItems] -( - [ShoppingCartId] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -GO - -CREATE NONCLUSTERED INDEX [IDX_Customer] ON [dbo].[CustomerShoppingCart] -( - [CustomerId] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -GO -ALTER TABLE [dbo].[CartItems] WITH CHECK ADD CONSTRAINT [FK_CartItems_CustomerShoppingCart_ShoppingCartId] FOREIGN KEY([ShoppingCartId]) -REFERENCES [dbo].[CustomerShoppingCart] ([Id]) -ON DELETE CASCADE -GO -ALTER TABLE [dbo].[CartItems] CHECK CONSTRAINT [FK_CartItems_CustomerShoppingCart_ShoppingCartId] -GO - -USE [master] -GO - -ALTER DATABASE [DSShoppingCart] SET READ_WRITE -GO - - -/****** Object: Database [DSUsers] Script Date: 01/10/2021 21:30:23 ******/ -CREATE DATABASE [DSUsers] - -GO -USE [DSUsers] -GO - -CREATE TABLE [dbo].[AspNetRoleClaims]( - [Id] [int] IDENTITY(1,1) NOT NULL, - [RoleId] [nvarchar](450) NOT NULL, - [ClaimType] [nvarchar](max) NULL, - [ClaimValue] [nvarchar](max) NULL, - CONSTRAINT [PK_AspNetRoleClaims] PRIMARY KEY CLUSTERED -( - [Id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -CREATE TABLE [dbo].[AspNetRoles]( - [Id] [nvarchar](450) NOT NULL, - [Name] [nvarchar](256) NULL, - [NormalizedName] [nvarchar](256) NULL, - [ConcurrencyStamp] [nvarchar](max) NULL, - CONSTRAINT [PK_AspNetRoles] PRIMARY KEY CLUSTERED -( - [Id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -CREATE TABLE [dbo].[AspNetUserClaims]( - [Id] [int] IDENTITY(1,1) NOT NULL, - [UserId] [nvarchar](450) NOT NULL, - [ClaimType] [nvarchar](max) NULL, - [ClaimValue] [nvarchar](max) NULL, - CONSTRAINT [PK_AspNetUserClaims] PRIMARY KEY CLUSTERED -( - [Id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -CREATE TABLE [dbo].[AspNetUserLogins]( - [LoginProvider] [nvarchar](128) NOT NULL, - [ProviderKey] [nvarchar](128) NOT NULL, - [ProviderDisplayName] [nvarchar](max) NULL, - [UserId] [nvarchar](450) NOT NULL, - CONSTRAINT [PK_AspNetUserLogins] PRIMARY KEY CLUSTERED -( - [LoginProvider] ASC, - [ProviderKey] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -CREATE TABLE [dbo].[AspNetUserRoles]( - [UserId] [nvarchar](450) NOT NULL, - [RoleId] [nvarchar](450) NOT NULL, - CONSTRAINT [PK_AspNetUserRoles] PRIMARY KEY CLUSTERED -( - [UserId] ASC, - [RoleId] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] -GO - -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -CREATE TABLE [dbo].[AspNetUsers]( - [Id] [nvarchar](450) NOT NULL, - [UserName] [nvarchar](256) NULL, - [NormalizedUserName] [nvarchar](256) NULL, - [Email] [nvarchar](256) NULL, - [NormalizedEmail] [nvarchar](256) NULL, - [EmailConfirmed] [bit] NOT NULL, - [PasswordHash] [nvarchar](max) NULL, - [SecurityStamp] [nvarchar](max) NULL, - [ConcurrencyStamp] [nvarchar](max) NULL, - [PhoneNumber] [nvarchar](max) NULL, - [PhoneNumberConfirmed] [bit] NOT NULL, - [TwoFactorEnabled] [bit] NOT NULL, - [LockoutEnd] [datetimeoffset](7) NULL, - [LockoutEnabled] [bit] NOT NULL, - [AccessFailedCount] [int] NOT NULL, - CONSTRAINT [PK_AspNetUsers] PRIMARY KEY CLUSTERED -( - [Id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -CREATE TABLE [dbo].[AspNetUserTokens]( - [UserId] [nvarchar](450) NOT NULL, - [LoginProvider] [nvarchar](128) NOT NULL, - [Name] [nvarchar](128) NOT NULL, - [Value] [nvarchar](max) NULL, - CONSTRAINT [PK_AspNetUserTokens] PRIMARY KEY CLUSTERED -( - [UserId] ASC, - [LoginProvider] ASC, - [Name] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -CREATE TABLE [dbo].[RefreshTokens]( - [Id] [uniqueidentifier] NOT NULL, - [Username] [nvarchar](max) NULL, - [Token] [uniqueidentifier] NOT NULL, - [ExpirationDate] [datetime2](7) NOT NULL, - CONSTRAINT [PK_RefreshTokens] PRIMARY KEY CLUSTERED -( - [Id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO - -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -CREATE TABLE [dbo].[SecurityKeys]( - [Id] [uniqueidentifier] NOT NULL, - [Parameters] [nvarchar](max) NULL, - [KeyId] [nvarchar](max) NULL, - [Type] [nvarchar](max) NULL, - [JwsAlgorithm] [nvarchar](max) NULL, - [JweAlgorithm] [nvarchar](max) NULL, - [JweEncryption] [nvarchar](max) NULL, - [CreationDate] [datetime2](7) NOT NULL, - [JwkType] [int] NOT NULL, - [IsRevoked] [bit] NOT NULL, - CONSTRAINT [PK_SecurityKeys] PRIMARY KEY CLUSTERED -( - [Id] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] -GO -SET ANSI_PADDING ON -GO - -CREATE NONCLUSTERED INDEX [IX_AspNetRoleClaims_RoleId] ON [dbo].[AspNetRoleClaims] -( - [RoleId] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -GO -SET ANSI_PADDING ON -GO - -CREATE UNIQUE NONCLUSTERED INDEX [RoleNameIndex] ON [dbo].[AspNetRoles] -( - [NormalizedName] ASC -) -WHERE ([NormalizedName] IS NOT NULL) -WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -GO -SET ANSI_PADDING ON -GO - -CREATE NONCLUSTERED INDEX [IX_AspNetUserClaims_UserId] ON [dbo].[AspNetUserClaims] -( - [UserId] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -GO -SET ANSI_PADDING ON -GO - -CREATE NONCLUSTERED INDEX [IX_AspNetUserLogins_UserId] ON [dbo].[AspNetUserLogins] -( - [UserId] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -GO -SET ANSI_PADDING ON -GO - -CREATE NONCLUSTERED INDEX [IX_AspNetUserRoles_RoleId] ON [dbo].[AspNetUserRoles] -( - [RoleId] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -GO -SET ANSI_PADDING ON -GO - -CREATE NONCLUSTERED INDEX [EmailIndex] ON [dbo].[AspNetUsers] -( - [NormalizedEmail] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -GO -SET ANSI_PADDING ON -GO - -CREATE UNIQUE NONCLUSTERED INDEX [UserNameIndex] ON [dbo].[AspNetUsers] -( - [NormalizedUserName] ASC -) -WHERE ([NormalizedUserName] IS NOT NULL) -WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] -GO -ALTER TABLE [dbo].[AspNetRoleClaims] WITH CHECK ADD CONSTRAINT [FK_AspNetRoleClaims_AspNetRoles_RoleId] FOREIGN KEY([RoleId]) -REFERENCES [dbo].[AspNetRoles] ([Id]) -ON DELETE CASCADE -GO -ALTER TABLE [dbo].[AspNetRoleClaims] CHECK CONSTRAINT [FK_AspNetRoleClaims_AspNetRoles_RoleId] -GO -ALTER TABLE [dbo].[AspNetUserClaims] WITH CHECK ADD CONSTRAINT [FK_AspNetUserClaims_AspNetUsers_UserId] FOREIGN KEY([UserId]) -REFERENCES [dbo].[AspNetUsers] ([Id]) -ON DELETE CASCADE -GO -ALTER TABLE [dbo].[AspNetUserClaims] CHECK CONSTRAINT [FK_AspNetUserClaims_AspNetUsers_UserId] -GO -ALTER TABLE [dbo].[AspNetUserLogins] WITH CHECK ADD CONSTRAINT [FK_AspNetUserLogins_AspNetUsers_UserId] FOREIGN KEY([UserId]) -REFERENCES [dbo].[AspNetUsers] ([Id]) -ON DELETE CASCADE -GO -ALTER TABLE [dbo].[AspNetUserLogins] CHECK CONSTRAINT [FK_AspNetUserLogins_AspNetUsers_UserId] -GO -ALTER TABLE [dbo].[AspNetUserRoles] WITH CHECK ADD CONSTRAINT [FK_AspNetUserRoles_AspNetRoles_RoleId] FOREIGN KEY([RoleId]) -REFERENCES [dbo].[AspNetRoles] ([Id]) -ON DELETE CASCADE -GO -ALTER TABLE [dbo].[AspNetUserRoles] CHECK CONSTRAINT [FK_AspNetUserRoles_AspNetRoles_RoleId] -GO -ALTER TABLE [dbo].[AspNetUserRoles] WITH CHECK ADD CONSTRAINT [FK_AspNetUserRoles_AspNetUsers_UserId] FOREIGN KEY([UserId]) -REFERENCES [dbo].[AspNetUsers] ([Id]) -ON DELETE CASCADE -GO -ALTER TABLE [dbo].[AspNetUserRoles] CHECK CONSTRAINT [FK_AspNetUserRoles_AspNetUsers_UserId] -GO -ALTER TABLE [dbo].[AspNetUserTokens] WITH CHECK ADD CONSTRAINT [FK_AspNetUserTokens_AspNetUsers_UserId] FOREIGN KEY([UserId]) -REFERENCES [dbo].[AspNetUsers] ([Id]) -ON DELETE CASCADE -GO -ALTER TABLE [dbo].[AspNetUserTokens] CHECK CONSTRAINT [FK_AspNetUserTokens_AspNetUsers_UserId] -GO -USE [master] -GO -ALTER DATABASE [DSUsers] SET READ_WRITE -GO - -USE [DSCatalog] -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'ba861293-ded9-4639-ab8f-0395bf15ddca', N'Mug Wonder Woman', N'Porcelain mug with high-strength thermal printing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8373449' AS DateTime2), N'caneca-Wonder Woman.jpg', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'51e47fc9-d1ec-4d3d-b8be-0e2f0aec878c', N'Mug Rick and Morty', N'Porcelain mug with high-strength thermal printing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8373316' AS DateTime2), N'caneca-Rick and Morty.jpg', 5) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'd61f5340-bc48-4ddd-b9e8-13b4efbce1fe', N'T-Shirt Maestria', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8371484' AS DateTime2), N'Maestria.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'dd296d6d-1de4-4668-9973-14d99ade799f', N'T-Shirt Software Developer', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(100.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8374889' AS DateTime2), N'camiseta1.jpg', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'86cbe472-b0af-4583-969d-1eb0dd54a556', N'T-Shirt 4 Head White', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8364739' AS DateTime2), N'Branca 4head.webp', 5) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'53c04d7d-92dd-4a89-9ba6-22e8770e38c0', N'Mug Nightmare', N'Porcelain mug with high-strength thermal printing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8373125' AS DateTime2), N'caneca-Nightmare.jpg', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'f5770d7b-5e93-4d27-8567-3c0cd8b8defb', N'T-Shirt Debugar Black', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(75.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8374453' AS DateTime2), N'camiseta4.jpg', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'b87bfc63-0690-411f-886b-4b292fad6ba1', N'T-Shirt Yoda', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8372072' AS DateTime2), N'Yoda.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'a21043db-4096-4e1d-bcbc-4bc6b847347b', N'Mug No Coffee No Code', N'Porcelain mug with high-strength thermal printing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8373550' AS DateTime2), N'caneca4.jpg', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'df35647f-d7fe-40ab-b1d7-4f756f29de4f', N'Mug Batman Black', N'Porcelain mug with high-strength thermal printing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8373895' AS DateTime2), N'caneca-Batman.jpg', 8) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'147a1255-dff6-45e7-be5a-5af0f2cc1b79', N'T-Shirt My Yoda', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8371753' AS DateTime2), N'My Yoda.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'2e744010-9d7d-4293-8db5-602e5f1dddbb', N'T-Shirt Pato', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8371856' AS DateTime2), N'Pato.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'4dc4a409-12e2-45d7-92f9-6bfd6c2ab930', N'T-Shirt Code Life Gray', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(99.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8374549' AS DateTime2), N'camiseta3.jpg', 3) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'4c6eb181-3896-402f-8c10-6e047d0f7907', N'T-Shirt Xavier School', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8371972' AS DateTime2), N'Xaviers School.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'27a9d6c7-41fa-49ae-8215-77e6b0810734', N'Mug Turn Coffee into Code', N'Porcelain mug with high-strength thermal printing.', 1, CAST(20.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8375032' AS DateTime2), N'caneca3.jpg', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'66ef4617-37c2-4fd0-a5fc-7cc5c210399a', N'Mug Vegeta', N'Porcelain mug with high-strength thermal printing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8373765' AS DateTime2), N'caneca1-Vegeta.jpg', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'70217a50-68c2-441c-b2c4-7e0c91e73be6', N'T-Shirt Kappa', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8371257' AS DateTime2), N'Kappa.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'9de438f3-bece-4a08-b429-8043cb52a979', N'T-Shirt 4 Head', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.7686079' AS DateTime2), N'4head.webp', 5) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'7d102ad0-b6a4-46ad-8518-8fe8cc899837', N'T-Shirt MacGyver', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8371381' AS DateTime2), N'MacGyver.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'079a4fbf-adcc-4574-b89e-92de224ef047', N'T-Shirt Rick And Morty', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8372424' AS DateTime2), N'Rick And Morty.webp', 5) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'8be38d66-9448-4bcc-9f77-93e693f6a1f8', N'Mug Big Bang Theory', N'Porcelain mug with high-strength thermal printing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8374010' AS DateTime2), N'caneca-bbt.webp', 0) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'b2eff88b-a4c5-4ca3-83b2-93f9489160c7', N'Mug Geeks', N'Porcelain mug with high-strength thermal printing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8374212' AS DateTime2), N'caneca-Geeks.jpg', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'903827e3-2dd4-4add-9fdc-a72f537a48ef', N'T-Shirt Tilt White', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8366622' AS DateTime2), N'Branco Tiltado.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'ac38ad47-c463-4f65-9d1b-af0738a7579e', N'T-Shirt Code Life Black', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8371639' AS DateTime2), N'camiseta2.jpg', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'39608034-d9aa-4a9b-bdcc-b110e0ca7d61', N'T-Shirt Rick And Morty 2', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8372317' AS DateTime2), N'Rick And Morty Captured.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'df5d5274-ac5d-4001-bd21-b6cb19b1eff5', N'Mug Mushroom', N'Porcelain mug with high-strength thermal printing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8374117' AS DateTime2), N'caneca-cogumelo.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'd56c92dd-5138-4261-82cb-bafa84e24c0f', N'Mug Batman', N'Porcelain mug with high-strength thermal printing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8373670' AS DateTime2), N'caneca1--batman.jpg', 5) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'2433c7d5-5543-416c-8397-bb7d973f7abf', N'T-Shirt Say My Name', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8372524' AS DateTime2), N'Say My Name.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'070037a2-c563-4e24-87aa-bcd4b6a91876', N'T-Shirt Tilt', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8366375' AS DateTime2), N'tiltado.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'84667a5d-2bf6-4c2b-a4d5-c0f6b441e5f8', N'Mug IronMan', N'Porcelain mug with high-strength thermal printing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8374309' AS DateTime2), N'caneca-ironman.jpg', 8) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'18a30989-9cf6-435d-8c61-c49826ea03a6', N'T-Shirt Support', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8372661' AS DateTime2), N'support.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'5d953a57-06d4-40d7-a84f-c864d7083274', N'Mug Joker Wanted', N'Porcelain mug with high-strength thermal printing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8372883' AS DateTime2), N'caneca-joker Wanted.jpg', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'09d30aa9-0580-4b08-a3dc-d651936fc53d', N'Mug Ozob', N'Porcelain mug with high-strength thermal printing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8373220' AS DateTime2), N'caneca-Ozob.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'f4f2f70c-3df6-46f6-83c9-da53a2053e87', N'T-Shirt Heisenberg', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8370964' AS DateTime2), N'Heisenberg.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'931bf19d-6292-4309-96cb-e8d133e45e26', N'T-Shirt Quack', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8372206' AS DateTime2), N'Quack.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'9669789a-f9f7-4fbe-8c4c-ebf50a0aff4b', N'Mug Programmer Code', N'Porcelain mug with high-strength thermal printing.', 1, CAST(15.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8374736' AS DateTime2), N'caneca2.jpg', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'a5fd7e4f-cff6-4de8-8ed3-f38e09d27adb', N'T-Shirt Try Hard', N'T-Shirt 100% cotton, high durable to wash and high temperatures washing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8372771' AS DateTime2), N'Tryhard.webp', 10) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'5251c7f6-1a02-4e49-88b4-f6a9c374a020', N'Mug Joker', N'Porcelain mug with high-strength thermal printing.', 1, CAST(50.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8373013' AS DateTime2), N'caneca-Joker.jpg', 5) -GO -INSERT [dbo].[Products] ([Id], [Name], [Description], [Active], [Price], [DateAdded], [Image], [Stock]) VALUES (N'af6f98a1-70e5-45b8-87c4-f8c1bd95972d', N'Mug Star Bugs Coffee', N'Porcelain mug with high-strength thermal printing.', 1, CAST(20.00 AS Decimal(18, 2)), CAST(N'2021-10-01T21:33:45.8374642' AS DateTime2), N'caneca1.jpg', 10) -GO - - - -SELECT 'DATABASE CREATED !!! :D' \ No newline at end of file diff --git a/sql/import-data.sh b/sql/import-data.sh deleted file mode 100644 index 65c77e4..0000000 --- a/sql/import-data.sh +++ /dev/null @@ -1,4 +0,0 @@ -# Wait 90 seconds to starting -sleep 90s -# Generating database -/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P "MyDB@123" -i generate-database.sql \ No newline at end of file diff --git a/src/api-gateways/DevStore.Bff.Checkout/Dockerfile b/src/api-gateways/DevStore.Bff.Checkout/Dockerfile index 06c7723..ac2b71f 100644 --- a/src/api-gateways/DevStore.Bff.Checkout/Dockerfile +++ b/src/api-gateways/DevStore.Bff.Checkout/Dockerfile @@ -7,13 +7,13 @@ EXPOSE 443 FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src -COPY ["src/api-gateways/DevStore.Bff.Checkout/DevStore.Bff.Checkout.csproj", "src/api-gateways/DevStore.Bff.Checkout/"] -COPY ["src/building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "src/building-blocks/DevStore.WebAPI.Core/"] -COPY ["src/building-blocks/DevStore.Core/DevStore.Core.csproj", "src/building-blocks/DevStore.Core/"] -COPY ["src/building-blocks/DevStore.MessageBus/DevStore.MessageBus.csproj", "src/building-blocks/DevStore.MessageBus/"] -RUN dotnet restore "src/api-gateways/DevStore.Bff.Checkout/DevStore.Bff.Checkout.csproj" +COPY ["api-gateways/DevStore.Bff.Checkout/DevStore.Bff.Checkout.csproj", "api-gateways/DevStore.Bff.Checkout/"] +COPY ["building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "building-blocks/DevStore.WebAPI.Core/"] +COPY ["building-blocks/DevStore.Core/DevStore.Core.csproj", "building-blocks/DevStore.Core/"] +COPY ["building-blocks/DevStore.MessageBus/DevStore.MessageBus.csproj", "building-blocks/DevStore.MessageBus/"] +RUN dotnet restore "api-gateways/DevStore.Bff.Checkout/DevStore.Bff.Checkout.csproj" COPY . . -WORKDIR "/src/src/api-gateways/DevStore.Bff.Checkout" +WORKDIR "api-gateways/DevStore.Bff.Checkout" RUN dotnet build "DevStore.Bff.Checkout.csproj" -c Release -o /app/build FROM build AS publish diff --git a/src/api-gateways/DevStore.Bff.Checkout/Program.cs b/src/api-gateways/DevStore.Bff.Checkout/Program.cs index 68f860c..7ff3208 100644 Binary files a/src/api-gateways/DevStore.Bff.Checkout/Program.cs and b/src/api-gateways/DevStore.Bff.Checkout/Program.cs differ diff --git a/src/api-gateways/DevStore.Bff.Checkout/appsettings.Development.json b/src/api-gateways/DevStore.Bff.Checkout/appsettings.Development.json index df7badf..716bca4 100644 --- a/src/api-gateways/DevStore.Bff.Checkout/appsettings.Development.json +++ b/src/api-gateways/DevStore.Bff.Checkout/appsettings.Development.json @@ -14,7 +14,7 @@ "OrderUrl": "https://localhost:5471", "MessageQueueConnection": { - "MessageBus": "host=localhost:5672;publisherConfirms=true;timeout=1000" + "MessageBus": "host=localhost:5672;publisherConfirms=true;timeout=10;username=devstore;password=devstore00" }, "AppSettings": { "AuthenticationJwksUrl": "https://localhost:5421/jwks" diff --git a/src/api-gateways/DevStore.Bff.Checkout/appsettings.Docker.json b/src/api-gateways/DevStore.Bff.Checkout/appsettings.Docker.json new file mode 100644 index 0000000..ebba1ea --- /dev/null +++ b/src/api-gateways/DevStore.Bff.Checkout/appsettings.Docker.json @@ -0,0 +1,22 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*", + "ShoppingCartUrl": "https://devstore-api-cart:5201", + "CatalogUrl": "https://devstore-api-catalog:5301", + "CustomerUrl": "https://devstore-api-customers:5401", + "PaymentUrl": "https://devstore-api-billing:5601", + "OrderUrl": "https://devstore-api-order:5701", + + "MessageQueueConnection": { + "MessageBus": "host=devstore-rabbit:5672;publisherConfirms=true;timeout=30;username=devstore;password=devstore" + }, + "AppSettings": { + "AuthenticationJwksUrl": "https://devstore-api-identity:5101/jwks" + } +} \ No newline at end of file diff --git a/src/services/DevStore.Billing.API/Configuration/DbMigrationHelpers.cs b/src/services/DevStore.Billing.API/Configuration/DbMigrationHelpers.cs index a88ef76..4049d7f 100644 --- a/src/services/DevStore.Billing.API/Configuration/DbMigrationHelpers.cs +++ b/src/services/DevStore.Billing.API/Configuration/DbMigrationHelpers.cs @@ -2,7 +2,9 @@ using System.Threading.Tasks; using DevStore.Billing.API.Data; using DevStore.WebAPI.Core.Configuration; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -16,9 +18,9 @@ public static class DbMigrationHelpers /// Nuget package manager: Add-Migration DbInit -context BillingContext /// Dotnet CLI: dotnet ef migrations add DbInit -c BillingContext /// - public static async Task EnsureSeedData(IServiceScope serviceScope) + public static async Task EnsureSeedData(WebApplication serviceScope) { - var services = serviceScope.ServiceProvider; + var services = serviceScope.Services.CreateScope().ServiceProvider; await EnsureSeedData(services); } @@ -28,11 +30,11 @@ public static async Task EnsureSeedData(IServiceProvider serviceProvider) var env = scope.ServiceProvider.GetRequiredService(); var ssoContext = scope.ServiceProvider.GetRequiredService(); - await DbHealthChecker.TestConnection(ssoContext); - if (env.IsDevelopment()) + if (env.IsDevelopment() || env.IsEnvironment("Docker")) await ssoContext.Database.EnsureCreatedAsync(); + } } diff --git a/src/services/DevStore.Billing.API/Dockerfile b/src/services/DevStore.Billing.API/Dockerfile index d06db1a..bd46db6 100644 --- a/src/services/DevStore.Billing.API/Dockerfile +++ b/src/services/DevStore.Billing.API/Dockerfile @@ -7,14 +7,14 @@ EXPOSE 443 FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src -COPY ["src/services/DevStore.Billing.API/DevStore.Billing.API.csproj", "src/services/DevStore.Billing.API/"] -COPY ["src/services/DevStore.Billing.DevsPay/DevStore.Billing.DevsPay.csproj", "src/services/DevStore.Billing.DevsPay/"] -COPY ["src/building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "src/building-blocks/DevStore.WebAPI.Core/"] -COPY ["src/building-blocks/DevStore.Core/DevStore.Core.csproj", "src/building-blocks/DevStore.Core/"] -COPY ["src/building-blocks/DevStore.MessageBus/DevStore.MessageBus.csproj", "src/building-blocks/DevStore.MessageBus/"] -RUN dotnet restore "src/services/DevStore.Billing.API/DevStore.Billing.API.csproj" +COPY ["services/DevStore.Billing.API/DevStore.Billing.API.csproj", "services/DevStore.Billing.API/"] +COPY ["services/DevStore.Billing.DevsPay/DevStore.Billing.DevsPay.csproj", "services/DevStore.Billing.DevsPay/"] +COPY ["building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "building-blocks/DevStore.WebAPI.Core/"] +COPY ["building-blocks/DevStore.Core/DevStore.Core.csproj", "building-blocks/DevStore.Core/"] +COPY ["building-blocks/DevStore.MessageBus/DevStore.MessageBus.csproj", "building-blocks/DevStore.MessageBus/"] +RUN dotnet restore "services/DevStore.Billing.API/DevStore.Billing.API.csproj" COPY . . -WORKDIR "/src/src/services/DevStore.Billing.API" +WORKDIR "services/DevStore.Billing.API" RUN dotnet build "DevStore.Billing.API.csproj" -c Release -o /app/build FROM build AS publish diff --git a/src/services/DevStore.Billing.API/Program.cs b/src/services/DevStore.Billing.API/Program.cs index bd241ea..22c7de1 100644 Binary files a/src/services/DevStore.Billing.API/Program.cs and b/src/services/DevStore.Billing.API/Program.cs differ diff --git a/src/services/DevStore.Billing.API/Startup.cs b/src/services/DevStore.Billing.API/Startup.cs deleted file mode 100644 index 8f268a2..0000000 Binary files a/src/services/DevStore.Billing.API/Startup.cs and /dev/null differ diff --git a/src/services/DevStore.Billing.API/appsettings.Development.json b/src/services/DevStore.Billing.API/appsettings.Development.json index ece56b2..b492f00 100644 --- a/src/services/DevStore.Billing.API/appsettings.Development.json +++ b/src/services/DevStore.Billing.API/appsettings.Development.json @@ -10,7 +10,7 @@ "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=DSBilling;Trusted_Connection=True;MultipleActiveResultSets=true" }, "MessageQueueConnection": { - "MessageBus": "host=localhost:5672;publisherConfirms=true;timeout=10" + "MessageBus": "host=localhost:5672;publisherConfirms=true;timeout=10;username=devstore;password=devstore" }, "AppSettings": { "AuthenticationJwksUrl": "https://localhost:5421/jwks" diff --git a/src/services/DevStore.Billing.API/appsettings.Docker.json b/src/services/DevStore.Billing.API/appsettings.Docker.json new file mode 100644 index 0000000..da54656 --- /dev/null +++ b/src/services/DevStore.Billing.API/appsettings.Docker.json @@ -0,0 +1,22 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "ConnectionStrings": { + "DefaultConnection": "Server=sql-server;Database=DSBilling;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123" + }, + "MessageQueueConnection": { + "MessageBus": "host=devstore-rabbit:5672;publisherConfirms=true;timeout=30;username=devstore;password=devstore" + }, + "AppSettings": { + "AuthenticationJwksUrl": "https://devstore-api-identity:5101/jwks" + }, + "BillingConfig": { + "DefaultApiKey": "ak_ewr4dsWehiwAT", + "DefaultEncryptionKey": "ek_SweRsdFas4uT5" + } +} \ No newline at end of file diff --git a/src/services/DevStore.Catalog.API/Configuration/DbMigrationHelpers.cs b/src/services/DevStore.Catalog.API/Configuration/DbMigrationHelpers.cs index fcc62dc..2a2bf6e 100644 --- a/src/services/DevStore.Catalog.API/Configuration/DbMigrationHelpers.cs +++ b/src/services/DevStore.Catalog.API/Configuration/DbMigrationHelpers.cs @@ -7,6 +7,7 @@ using System; using System.Linq; using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; namespace DevStore.Catalog.API.Configuration { @@ -18,9 +19,9 @@ public static class DbMigrationHelpers /// Nuget package manager: Add-Migration DbInit -context CatalogContext /// Dotnet CLI: dotnet ef migrations add DbInit -c CatalogContext /// - public static async Task EnsureSeedData(IServiceScope serviceScope) + public static async Task EnsureSeedData(WebApplication serviceScope) { - var services = serviceScope.ServiceProvider; + var services = serviceScope.Services.CreateScope().ServiceProvider; await EnsureSeedData(services); } @@ -33,7 +34,7 @@ public static async Task EnsureSeedData(IServiceProvider serviceProvider) await DbHealthChecker.TestConnection(context); - if (env.IsDevelopment()) + if (env.IsDevelopment() || env.IsEnvironment("Docker")) { await context.Database.EnsureCreatedAsync(); await EnsureSeedProducts(context); diff --git a/src/services/DevStore.Catalog.API/Dockerfile b/src/services/DevStore.Catalog.API/Dockerfile index 71b3235..689f9ae 100644 --- a/src/services/DevStore.Catalog.API/Dockerfile +++ b/src/services/DevStore.Catalog.API/Dockerfile @@ -7,13 +7,13 @@ EXPOSE 443 FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src -COPY ["src/services/DevStore.Catalog.API/DevStore.Catalog.API.csproj", "src/services/DevStore.Catalog.API/"] -COPY ["src/building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "src/building-blocks/DevStore.WebAPI.Core/"] -COPY ["src/building-blocks/DevStore.Core/DevStore.Core.csproj", "src/building-blocks/DevStore.Core/"] -COPY ["src/building-blocks/DevStore.MessageBus/DevStore.MessageBus.csproj", "src/building-blocks/DevStore.MessageBus/"] -RUN dotnet restore "src/services/DevStore.Catalog.API/DevStore.Catalog.API.csproj" +COPY ["services/DevStore.Catalog.API/DevStore.Catalog.API.csproj", "services/DevStore.Catalog.API/"] +COPY ["building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "building-blocks/DevStore.WebAPI.Core/"] +COPY ["building-blocks/DevStore.Core/DevStore.Core.csproj", "building-blocks/DevStore.Core/"] +COPY ["building-blocks/DevStore.MessageBus/DevStore.MessageBus.csproj", "building-blocks/DevStore.MessageBus/"] +RUN dotnet restore "services/DevStore.Catalog.API/DevStore.Catalog.API.csproj" COPY . . -WORKDIR "/src/src/services/DevStore.Catalog.API" +WORKDIR "services/DevStore.Catalog.API" RUN dotnet build "DevStore.Catalog.API.csproj" -c Release -o /app/build FROM build AS publish diff --git a/src/services/DevStore.Catalog.API/Program.cs b/src/services/DevStore.Catalog.API/Program.cs index 17a289f..738cc1d 100644 Binary files a/src/services/DevStore.Catalog.API/Program.cs and b/src/services/DevStore.Catalog.API/Program.cs differ diff --git a/src/services/DevStore.Catalog.API/Startup.cs b/src/services/DevStore.Catalog.API/Startup.cs deleted file mode 100644 index b72b5b3..0000000 Binary files a/src/services/DevStore.Catalog.API/Startup.cs and /dev/null differ diff --git a/src/services/DevStore.Catalog.API/appsettings.Development.json b/src/services/DevStore.Catalog.API/appsettings.Development.json index 54f0882..519e7dc 100644 --- a/src/services/DevStore.Catalog.API/appsettings.Development.json +++ b/src/services/DevStore.Catalog.API/appsettings.Development.json @@ -7,10 +7,10 @@ } }, "ConnectionStrings": { - "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=DSCatalog;Trusted_Connection=True;MultipleActiveResultSets=true" + "DefaultConnection": "Server=localhost;Database=DSCatalog;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123" }, "MessageQueueConnection": { - "MessageBus": "host=localhost:5672;publisherConfirms=true;timeout=10" + "MessageBus": "host=localhost:5672;publisherConfirms=true;timeout=10;username=devstore;password=devstore" }, "AppSettings": { "AuthenticationJwksUrl": "https://localhost:5421/jwks" diff --git a/src/services/DevStore.Catalog.API/appsettings.Docker.json b/src/services/DevStore.Catalog.API/appsettings.Docker.json new file mode 100644 index 0000000..88d84a9 --- /dev/null +++ b/src/services/DevStore.Catalog.API/appsettings.Docker.json @@ -0,0 +1,18 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "ConnectionStrings": { + "DefaultConnection": "Server=sql-server;Database=DSCatalog;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123" + }, + "MessageQueueConnection": { + "MessageBus": "host=devstore-rabbit:5672;publisherConfirms=true;timeout=30;username=devstore;password=devstore" + }, + "AppSettings": { + "AuthenticationJwksUrl": "https://devstore-api-identity:5101/jwks" + } +} diff --git a/src/services/DevStore.Customers.API/Configuration/DbMigrationHelpers.cs b/src/services/DevStore.Customers.API/Configuration/DbMigrationHelpers.cs index d476abf..d1b892f 100644 --- a/src/services/DevStore.Customers.API/Configuration/DbMigrationHelpers.cs +++ b/src/services/DevStore.Customers.API/Configuration/DbMigrationHelpers.cs @@ -2,7 +2,9 @@ using System.Threading.Tasks; using DevStore.Customers.API.Data; using DevStore.WebAPI.Core.Configuration; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -16,9 +18,9 @@ public static class DbMigrationHelpers /// Nuget package manager: Add-Migration DbInit -context CustomerContext /// Dotnet CLI: dotnet ef migrations add DbInit -c CustomerContext /// - public static async Task EnsureSeedData(IServiceScope serviceScope) + public static async Task EnsureSeedData(WebApplication serviceScope) { - var services = serviceScope.ServiceProvider; + var services = serviceScope.Services.CreateScope().ServiceProvider; await EnsureSeedData(services); } @@ -28,11 +30,11 @@ public static async Task EnsureSeedData(IServiceProvider serviceProvider) var env = scope.ServiceProvider.GetRequiredService(); var ssoContext = scope.ServiceProvider.GetRequiredService(); - await DbHealthChecker.TestConnection(ssoContext); - if (env.IsDevelopment()) + if (env.IsDevelopment() || env.IsEnvironment("Docker")) await ssoContext.Database.EnsureCreatedAsync(); + } } diff --git a/src/services/DevStore.Customers.API/Dockerfile b/src/services/DevStore.Customers.API/Dockerfile index 9347857..d047944 100644 --- a/src/services/DevStore.Customers.API/Dockerfile +++ b/src/services/DevStore.Customers.API/Dockerfile @@ -7,13 +7,13 @@ EXPOSE 443 FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src -COPY ["src/services/DevStore.Customers.API/DevStore.Customers.API.csproj", "src/services/DevStore.Customers.API/"] -COPY ["src/building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "src/building-blocks/DevStore.WebAPI.Core/"] -COPY ["src/building-blocks/DevStore.Core/DevStore.Core.csproj", "src/building-blocks/DevStore.Core/"] -COPY ["src/building-blocks/DevStore.MessageBus/DevStore.MessageBus.csproj", "src/building-blocks/DevStore.MessageBus/"] -RUN dotnet restore "src/services/DevStore.Customers.API/DevStore.Customers.API.csproj" +COPY ["services/DevStore.Customers.API/DevStore.Customers.API.csproj", "services/DevStore.Customers.API/"] +COPY ["building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "building-blocks/DevStore.WebAPI.Core/"] +COPY ["building-blocks/DevStore.Core/DevStore.Core.csproj", "building-blocks/DevStore.Core/"] +COPY ["building-blocks/DevStore.MessageBus/DevStore.MessageBus.csproj", "building-blocks/DevStore.MessageBus/"] +RUN dotnet restore "services/DevStore.Customers.API/DevStore.Customers.API.csproj" COPY . . -WORKDIR "/src/src/services/DevStore.Customers.API" +WORKDIR "services/DevStore.Customers.API" RUN dotnet build "DevStore.Customers.API.csproj" -c Release -o /app/build FROM build AS publish diff --git a/src/services/DevStore.Customers.API/Program.cs b/src/services/DevStore.Customers.API/Program.cs index e8d7682..ea92cb5 100644 Binary files a/src/services/DevStore.Customers.API/Program.cs and b/src/services/DevStore.Customers.API/Program.cs differ diff --git a/src/services/DevStore.Customers.API/Startup.cs b/src/services/DevStore.Customers.API/Startup.cs deleted file mode 100644 index 1fdb5ef..0000000 Binary files a/src/services/DevStore.Customers.API/Startup.cs and /dev/null differ diff --git a/src/services/DevStore.Customers.API/appsettings.Development.json b/src/services/DevStore.Customers.API/appsettings.Development.json index adfb1de..b95cf1c 100644 --- a/src/services/DevStore.Customers.API/appsettings.Development.json +++ b/src/services/DevStore.Customers.API/appsettings.Development.json @@ -10,7 +10,7 @@ "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=DSCustomers;Trusted_Connection=True;MultipleActiveResultSets=true", }, "MessageQueueConnection": { - "MessageBus": "host=localhost:5672;publisherConfirms=true;timeout=10" + "MessageBus": "host=localhost:5672;publisherConfirms=true;timeout=10;username=devstore;password=devstore" }, "AppSettings": { "AuthenticationJwksUrl": "https://localhost:5421/jwks" diff --git a/src/services/DevStore.Customers.API/appsettings.Docker.json b/src/services/DevStore.Customers.API/appsettings.Docker.json new file mode 100644 index 0000000..7b3f84d --- /dev/null +++ b/src/services/DevStore.Customers.API/appsettings.Docker.json @@ -0,0 +1,18 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "ConnectionStrings": { + "DefaultConnection": "Server=sql-server;Database=DSCustomers;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123" + }, + "MessageQueueConnection": { + "MessageBus": "host=devstore-rabbit:5672;publisherConfirms=true;timeout=30;username=devstore;password=devstore" + }, + "AppSettings": { + "AuthenticationJwksUrl": "https://devstore-api-identity:5101/jwks" + } +} \ No newline at end of file diff --git a/src/services/DevStore.Identity.API/Configuration/DbMigrationHelpers.cs b/src/services/DevStore.Identity.API/Configuration/DbMigrationHelpers.cs index f540967..f9bbba0 100644 --- a/src/services/DevStore.Identity.API/Configuration/DbMigrationHelpers.cs +++ b/src/services/DevStore.Identity.API/Configuration/DbMigrationHelpers.cs @@ -4,6 +4,7 @@ using DevStore.WebAPI.Core.Configuration; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -32,7 +33,7 @@ public static async Task EnsureSeedData(IServiceProvider serviceProvider) await DbHealthChecker.TestConnection(ssoContext); - if (env.IsDevelopment()) + if (env.IsDevelopment() || env.IsEnvironment("Docker")) await ssoContext.Database.EnsureCreatedAsync(); } diff --git a/src/services/DevStore.Identity.API/Controllers/AuthController.cs b/src/services/DevStore.Identity.API/Controllers/AuthController.cs index 130bcf8..2ca714d 100644 Binary files a/src/services/DevStore.Identity.API/Controllers/AuthController.cs and b/src/services/DevStore.Identity.API/Controllers/AuthController.cs differ diff --git a/src/services/DevStore.Identity.API/Dockerfile b/src/services/DevStore.Identity.API/Dockerfile index 46ae8c6..1933482 100644 --- a/src/services/DevStore.Identity.API/Dockerfile +++ b/src/services/DevStore.Identity.API/Dockerfile @@ -7,13 +7,13 @@ EXPOSE 443 FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src -COPY ["src/services/DevStore.Identity.API/DevStore.Identity.API.csproj", "src/services/DevStore.Identity.API/"] -COPY ["src/building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "src/building-blocks/DevStore.WebAPI.Core/"] -COPY ["src/building-blocks/DevStore.Core/DevStore.Core.csproj", "src/building-blocks/DevStore.Core/"] -COPY ["src/building-blocks/DevStore.MessageBus/DevStore.MessageBus.csproj", "src/building-blocks/DevStore.MessageBus/"] -RUN dotnet restore "src/services/DevStore.Identity.API/DevStore.Identity.API.csproj" +COPY ["services/DevStore.Identity.API/DevStore.Identity.API.csproj", "services/DevStore.Identity.API/"] +COPY ["building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "building-blocks/DevStore.WebAPI.Core/"] +COPY ["building-blocks/DevStore.Core/DevStore.Core.csproj", "building-blocks/DevStore.Core/"] +COPY ["building-blocks/DevStore.MessageBus/DevStore.MessageBus.csproj", "building-blocks/DevStore.MessageBus/"] +RUN dotnet restore "services/DevStore.Identity.API/DevStore.Identity.API.csproj" COPY . . -WORKDIR "/src/src/services/DevStore.Identity.API" +WORKDIR "services/DevStore.Identity.API" RUN dotnet build "DevStore.Identity.API.csproj" -c Release -o /app/build FROM build AS publish diff --git a/src/services/DevStore.Identity.API/appsettings.Development.json b/src/services/DevStore.Identity.API/appsettings.Development.json index c5ac6b1..e43796e 100644 --- a/src/services/DevStore.Identity.API/appsettings.Development.json +++ b/src/services/DevStore.Identity.API/appsettings.Development.json @@ -10,6 +10,6 @@ "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=DSUsers;Trusted_Connection=True;MultipleActiveResultSets=true" }, "MessageQueueConnection": { - "MessageBus": "host=localhost:5672;publisherConfirms=true;timeout=10" + "MessageBus": "host=localhost:5672;publisherConfirms=true;timeout=10;username=devstore;password=devstore" } } diff --git a/src/services/DevStore.Identity.API/appsettings.Docker.json b/src/services/DevStore.Identity.API/appsettings.Docker.json new file mode 100644 index 0000000..97b83c0 --- /dev/null +++ b/src/services/DevStore.Identity.API/appsettings.Docker.json @@ -0,0 +1,15 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "ConnectionStrings": { + "DefaultConnection": "Server=sql-server;Database=DSUsers;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123" + }, + "MessageQueueConnection": { + "MessageBus": "host=devstore-rabbit:5672;publisherConfirms=true;timeout=30;username=devstore;password=devstore" + } +} \ No newline at end of file diff --git a/src/services/DevStore.Identity.API/appsettings.Production.json b/src/services/DevStore.Identity.API/appsettings.Production.json index 5116f2d..97b83c0 100644 --- a/src/services/DevStore.Identity.API/appsettings.Production.json +++ b/src/services/DevStore.Identity.API/appsettings.Production.json @@ -11,8 +11,5 @@ }, "MessageQueueConnection": { "MessageBus": "host=devstore-rabbit:5672;publisherConfirms=true;timeout=30;username=devstore;password=devstore" - }, - "AppTokeDevStorettings": { - "RefreshTokenExpiration": 8 } } \ No newline at end of file diff --git a/src/services/DevStore.Orders.API/Configuration/DbMigrationHelpers.cs b/src/services/DevStore.Orders.API/Configuration/DbMigrationHelpers.cs index 2db6b59..cf96bf1 100644 --- a/src/services/DevStore.Orders.API/Configuration/DbMigrationHelpers.cs +++ b/src/services/DevStore.Orders.API/Configuration/DbMigrationHelpers.cs @@ -2,7 +2,9 @@ using System.Threading.Tasks; using DevStore.Orders.Infra.Context; using DevStore.WebAPI.Core.Configuration; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -16,9 +18,9 @@ public static class DbMigrationHelpers /// Nuget package manager: Add-Migration DbInit -context OrdersContext /// Dotnet CLI: dotnet ef migrations add DbInit -c OrdersContext /// - public static async Task EnsureSeedData(IServiceScope serviceScope) + public static async Task EnsureSeedData(WebApplication app) { - var services = serviceScope.ServiceProvider; + var services = app.Services.CreateScope().ServiceProvider; await EnsureSeedData(services); } @@ -31,8 +33,10 @@ public static async Task EnsureSeedData(IServiceProvider serviceProvider) await DbHealthChecker.TestConnection(ssoContext); - if (env.IsDevelopment()) + if (env.IsDevelopment() || env.IsEnvironment("Docker")) await ssoContext.Database.EnsureCreatedAsync(); + + } } diff --git a/src/services/DevStore.Orders.API/Dockerfile b/src/services/DevStore.Orders.API/Dockerfile index 7d40229..cde35e1 100644 --- a/src/services/DevStore.Orders.API/Dockerfile +++ b/src/services/DevStore.Orders.API/Dockerfile @@ -7,15 +7,15 @@ EXPOSE 443 FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src -COPY ["src/services/DevStore.Orders.API/DevStore.Orders.API.csproj", "src/services/DevStore.Orders.API/"] -COPY ["src/services/DevStore.Orders.Infra/DevStore.Orders.Infra.csproj", "src/services/DevStore.Orders.Infra/"] -COPY ["src/services/DevStore.Orders.Domain/DevStore.Orders.Domain.csproj", "src/services/DevStore.Orders.Domain/"] -COPY ["src/building-blocks/DevStore.Core/DevStore.Core.csproj", "src/building-blocks/DevStore.Core/"] -COPY ["src/building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "src/building-blocks/DevStore.WebAPI.Core/"] -COPY ["src/building-blocks/DevStore.MessageBus/DevStore.MessageBus.csproj", "src/building-blocks/DevStore.MessageBus/"] -RUN dotnet restore "src/services/DevStore.Orders.API/DevStore.Orders.API.csproj" +COPY ["services/DevStore.Orders.API/DevStore.Orders.API.csproj", "services/DevStore.Orders.API/"] +COPY ["services/DevStore.Orders.Infra/DevStore.Orders.Infra.csproj", "services/DevStore.Orders.Infra/"] +COPY ["services/DevStore.Orders.Domain/DevStore.Orders.Domain.csproj", "services/DevStore.Orders.Domain/"] +COPY ["building-blocks/DevStore.Core/DevStore.Core.csproj", "building-blocks/DevStore.Core/"] +COPY ["building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "building-blocks/DevStore.WebAPI.Core/"] +COPY ["building-blocks/DevStore.MessageBus/DevStore.MessageBus.csproj", "building-blocks/DevStore.MessageBus/"] +RUN dotnet restore "services/DevStore.Orders.API/DevStore.Orders.API.csproj" COPY . . -WORKDIR "/src/src/services/DevStore.Orders.API" +WORKDIR "services/DevStore.Orders.API" RUN dotnet build "DevStore.Orders.API.csproj" -c Release -o /app/build FROM build AS publish diff --git a/src/services/DevStore.Orders.API/Program.cs b/src/services/DevStore.Orders.API/Program.cs index 30b9a10..435a558 100644 Binary files a/src/services/DevStore.Orders.API/Program.cs and b/src/services/DevStore.Orders.API/Program.cs differ diff --git a/src/services/DevStore.Orders.API/Startup.cs b/src/services/DevStore.Orders.API/Startup.cs deleted file mode 100644 index fd22039..0000000 Binary files a/src/services/DevStore.Orders.API/Startup.cs and /dev/null differ diff --git a/src/services/DevStore.Orders.API/appsettings.Development.json b/src/services/DevStore.Orders.API/appsettings.Development.json index 903ee34..23f44a7 100644 --- a/src/services/DevStore.Orders.API/appsettings.Development.json +++ b/src/services/DevStore.Orders.API/appsettings.Development.json @@ -11,7 +11,7 @@ "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=DSOrders;Trusted_Connection=True;MultipleActiveResultSets=true" }, "MessageQueueConnection": { - "MessageBus": "host=localhost:5672;publisherConfirms=true;timeout=10" + "MessageBus": "host=localhost:5672;publisherConfirms=true;timeout=10;username=devstore;password=devstore" }, "AppSettings": { "AuthenticationJwksUrl": "https://localhost:5421/jwks" diff --git a/src/services/DevStore.Orders.API/appsettings.Docker.json b/src/services/DevStore.Orders.API/appsettings.Docker.json new file mode 100644 index 0000000..9fc5a0a --- /dev/null +++ b/src/services/DevStore.Orders.API/appsettings.Docker.json @@ -0,0 +1,19 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*", + "ConnectionStrings": { + "DefaultConnection": "Server=sql-server;Database=DSOrders;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123" + }, + "MessageQueueConnection": { + "MessageBus": "host=devstore-rabbit:5672;publisherConfirms=true;timeout=30;username=devstore;password=devstore" + }, + "AppSettings": { + "AuthenticationJwksUrl": "https://devstore-api-identity:5101/jwks" + } +} diff --git a/src/services/DevStore.ShoppingCart.API/Configuration/DbMigrationHelpers.cs b/src/services/DevStore.ShoppingCart.API/Configuration/DbMigrationHelpers.cs index f229ccf..914017e 100644 --- a/src/services/DevStore.ShoppingCart.API/Configuration/DbMigrationHelpers.cs +++ b/src/services/DevStore.ShoppingCart.API/Configuration/DbMigrationHelpers.cs @@ -1,5 +1,6 @@ using DevStore.ShoppingCart.API.Data; using DevStore.WebAPI.Core.Configuration; +using Microsoft.EntityFrameworkCore; namespace DevStore.ShoppingCart.API.Configuration { @@ -7,19 +8,27 @@ public static class DbMigrationHelpers { /// /// Generate migrations before running this method, you can use command bellow: - /// Nuget package manager: Add-Migration DbInit -context ShoppingCartContext - /// Dotnet CLI: dotnet ef migrations add DbInit -c ShoppingCartContext + /// Nuget package manager: Add-Migration DbInit -context OrdersContext + /// Dotnet CLI: dotnet ef migrations add DbInit -c OrdersContext /// public static async Task EnsureSeedData(WebApplication app) { - using var context = app.Services.CreateScope().ServiceProvider.GetRequiredService(); + var services = app.Services.CreateScope().ServiceProvider; + await EnsureSeedData(services); + } + + public static async Task EnsureSeedData(IServiceProvider serviceProvider) + { + using var scope = serviceProvider.GetRequiredService().CreateScope(); + var env = scope.ServiceProvider.GetRequiredService(); + + var ssoContext = scope.ServiceProvider.GetRequiredService(); + + await DbHealthChecker.TestConnection(ssoContext); - await DbHealthChecker.TestConnection(context); + if (env.IsDevelopment() || env.IsEnvironment("Docker")) + await ssoContext.Database.EnsureCreatedAsync(); - if (app.Environment.IsDevelopment()) - { - await context.Database.EnsureCreatedAsync(); - } } } } diff --git a/src/services/DevStore.ShoppingCart.API/Dockerfile b/src/services/DevStore.ShoppingCart.API/Dockerfile index 2f06cc2..f4f6ec1 100644 --- a/src/services/DevStore.ShoppingCart.API/Dockerfile +++ b/src/services/DevStore.ShoppingCart.API/Dockerfile @@ -7,13 +7,13 @@ EXPOSE 443 FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src -COPY ["src/services/DevStore.ShoppingCart.API/DevStore.ShoppingCart.API.csproj", "src/services/DevStore.ShoppingCart.API/"] -COPY ["src/building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "src/building-blocks/DevStore.WebAPI.Core/"] -COPY ["src/building-blocks/DevStore.Core/DevStore.Core.csproj", "src/building-blocks/DevStore.Core/"] -COPY ["src/building-blocks/DevStore.MessageBus/DevStore.MessageBus.csproj", "src/building-blocks/DevStore.MessageBus/"] -RUN dotnet restore "src/services/DevStore.ShoppingCart.API/DevStore.ShoppingCart.API.csproj" +COPY ["services/DevStore.ShoppingCart.API/DevStore.ShoppingCart.API.csproj", "services/DevStore.ShoppingCart.API/"] +COPY ["building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "building-blocks/DevStore.WebAPI.Core/"] +COPY ["building-blocks/DevStore.Core/DevStore.Core.csproj", "building-blocks/DevStore.Core/"] +COPY ["building-blocks/DevStore.MessageBus/DevStore.MessageBus.csproj", "building-blocks/DevStore.MessageBus/"] +RUN dotnet restore "services/DevStore.ShoppingCart.API/DevStore.ShoppingCart.API.csproj" COPY . . -WORKDIR "/src/src/services/DevStore.ShoppingCart.API" +WORKDIR "services/DevStore.ShoppingCart.API" RUN dotnet build "DevStore.ShoppingCart.API.csproj" -c Release -o /app/build FROM build AS publish diff --git a/src/services/DevStore.ShoppingCart.API/appsettings.Development.json b/src/services/DevStore.ShoppingCart.API/appsettings.Development.json index b87accc..4e3de1d 100644 --- a/src/services/DevStore.ShoppingCart.API/appsettings.Development.json +++ b/src/services/DevStore.ShoppingCart.API/appsettings.Development.json @@ -10,7 +10,7 @@ "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=DSShoppingCart;Trusted_Connection=True;MultipleActiveResultSets=true" }, "MessageQueueConnection": { - "MessageBus": "host=localhost:5672;publisherConfirms=true;timeout=10" + "MessageBus": "host=localhost:5672;publisherConfirms=true;timeout=10;username=devstore;password=devstore" }, "AppSettings": { "AuthenticationJwksUrl": "https://localhost:5421/jwks" diff --git a/src/services/DevStore.ShoppingCart.API/appsettings.Docker.json b/src/services/DevStore.ShoppingCart.API/appsettings.Docker.json new file mode 100644 index 0000000..ee37d67 --- /dev/null +++ b/src/services/DevStore.ShoppingCart.API/appsettings.Docker.json @@ -0,0 +1,18 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "ConnectionStrings": { + "DefaultConnection": "Server=sql-server;Database=DSShoppingCart;MultipleActiveResultSets=true;User Id=sa;Password=MyDB@123" + }, + "MessageQueueConnection": { + "MessageBus": "host=devstore-rabbit:5672;publisherConfirms=true;timeout=30;username=devstore;password=devstore" + }, + "AppSettings": { + "AuthenticationJwksUrl": "https://devstore-api-identity:5101/jwks" + } +} \ No newline at end of file diff --git a/src/web/DevStore.WebApp.MVC/Configuration/WebAppConfig.cs b/src/web/DevStore.WebApp.MVC/Configuration/WebAppConfig.cs index 160b059..ac3c4f0 100644 Binary files a/src/web/DevStore.WebApp.MVC/Configuration/WebAppConfig.cs and b/src/web/DevStore.WebApp.MVC/Configuration/WebAppConfig.cs differ diff --git a/src/web/DevStore.WebApp.MVC/Dockerfile b/src/web/DevStore.WebApp.MVC/Dockerfile index 26ad3b5..ac192f0 100644 --- a/src/web/DevStore.WebApp.MVC/Dockerfile +++ b/src/web/DevStore.WebApp.MVC/Dockerfile @@ -7,12 +7,12 @@ EXPOSE 443 FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src -COPY ["src/web/DevStore.WebApp.MVC/DevStore.WebApp.MVC.csproj", "src/web/DevStore.WebApp.MVC/"] -COPY ["src/building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "src/building-blocks/DevStore.WebAPI.Core/"] -COPY ["src/building-blocks/DevStore.Core/DevStore.Core.csproj", "src/building-blocks/DevStore.Core/"] -RUN dotnet restore "src/web/DevStore.WebApp.MVC/DevStore.WebApp.MVC.csproj" +COPY ["web/DevStore.WebApp.MVC/DevStore.WebApp.MVC.csproj", "web/DevStore.WebApp.MVC/"] +COPY ["building-blocks/DevStore.WebAPI.Core/DevStore.WebAPI.Core.csproj", "building-blocks/DevStore.WebAPI.Core/"] +COPY ["building-blocks/DevStore.Core/DevStore.Core.csproj", "building-blocks/DevStore.Core/"] +RUN dotnet restore "web/DevStore.WebApp.MVC/DevStore.WebApp.MVC.csproj" COPY . . -WORKDIR "/src/src/web/DevStore.WebApp.MVC" +WORKDIR "web/DevStore.WebApp.MVC" RUN dotnet build "DevStore.WebApp.MVC.csproj" -c Release -o /app/build FROM build AS publish diff --git a/src/web/DevStore.WebApp.MVC/Program.cs b/src/web/DevStore.WebApp.MVC/Program.cs index 651ff8b..5d77a1f 100644 Binary files a/src/web/DevStore.WebApp.MVC/Program.cs and b/src/web/DevStore.WebApp.MVC/Program.cs differ diff --git a/src/web/DevStore.WebApp.MVC/Startup.cs b/src/web/DevStore.WebApp.MVC/Startup.cs deleted file mode 100644 index aef8408..0000000 Binary files a/src/web/DevStore.WebApp.MVC/Startup.cs and /dev/null differ diff --git a/src/web/DevStore.WebApp.MVC/appsettings.Docker.json b/src/web/DevStore.WebApp.MVC/appsettings.Docker.json new file mode 100644 index 0000000..b144818 --- /dev/null +++ b/src/web/DevStore.WebApp.MVC/appsettings.Docker.json @@ -0,0 +1,14 @@ +{ + "AuthUrl": "https://devstore-api-identity:5101", + "CatalogUrl": "https://devstore-api-catalog:5301", + "CustomerUrl": "https://devstore-api-customers:5401", + "CheckoutBffUrl": "https://devstore-api-bff-checkout:5501", + + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} \ No newline at end of file