-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #462 from dotnet/salvage-401
Update PointOfSale App
- Loading branch information
Showing
69 changed files
with
1,342 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
8.0/Apps/PointOfSale/src/PointOfSale.API/PointOfSale.API.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition=" '$(RunConfiguration)' == 'https' " /> | ||
<PropertyGroup Condition=" '$(RunConfiguration)' == 'http' " /> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Datasync" Version="5.0.12" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Datasync.EFCore" Version="5.0.12" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.Identity.Web" Version="2.0.7-preview" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) Microsoft Corporation. All Rights Reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using Microsoft.AspNetCore.Datasync; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.AspNetCore.Authentication.JwtBearer; | ||
using Microsoft.Identity.Web; | ||
//using TodoAppService.NET6.Db; | ||
|
||
var builder = WebApplication.CreateBuilder(args); | ||
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) | ||
.AddMicrosoftIdentityWebApi(builder.Configuration); | ||
builder.Services.AddAuthorization(); | ||
//var connectionString = builder.Configuration.GetConnectionString("DefaultConnection"); | ||
|
||
//if (connectionString == null) | ||
//{ | ||
// throw new ApplicationException("DefaultConnection is not set"); | ||
//} | ||
|
||
//builder.Services.AddDbContext<AppDbContext>(options => options.UseSqlServer(connectionString)); | ||
//builder.Services.AddDatasyncControllers(); | ||
|
||
var app = builder.Build(); | ||
|
||
// Initialize the database | ||
//using (var scope = app.Services.CreateScope()) | ||
//{ | ||
// var context = scope.ServiceProvider.GetRequiredService<AppDbContext>(); | ||
// await context.InitializeDatabaseAsync().ConfigureAwait(false); | ||
//} | ||
|
||
// Configure and run the web service. | ||
app.UseAuthentication(); | ||
app.UseAuthorization(); | ||
//app.MapControllers(); | ||
app.Run(); |
39 changes: 39 additions & 0 deletions
39
8.0/Apps/PointOfSale/src/PointOfSale.API/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/launchsettings.json", | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:64228", | ||
"sslPort": 44388 | ||
} | ||
}, | ||
"profiles": { | ||
"http": { | ||
"commandName": "Project", | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"applicationUrl": "http://localhost:5128", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"https": { | ||
"commandName": "Project", | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"applicationUrl": "https://localhost:7111;http://localhost:5128", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
8.0/Apps/PointOfSale/src/PointOfSale.API/appsettings.Development.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"AzureAD": { | ||
"Instance": "https://login.microsoftonline.com", | ||
"ClientId": "4c5a1b86-86f9-431a-a99d-999024e16848", | ||
"TenantId": "common" | ||
}, | ||
"ConnectionStrings": { | ||
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=TodoApp;Trusted_Connection=True" | ||
}, | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"AllowedHosts": "*" | ||
} | ||
|
164 changes: 164 additions & 0 deletions
164
8.0/Apps/PointOfSale/src/PointOfSale.API/azuredeploy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
"skuName": { | ||
"type": "string", | ||
"defaultValue": "F1", | ||
"allowedValues": [ | ||
"F1", | ||
"D1", | ||
"B1", | ||
"B2", | ||
"B3", | ||
"S1", | ||
"S2", | ||
"S3", | ||
"P1", | ||
"P2", | ||
"P3", | ||
"P4" | ||
], | ||
"metadata": { | ||
"description": "Describes plan's pricing tier and instance size. Check details at https://azure.microsoft.com/en-us/pricing/details/app-service/" | ||
} | ||
}, | ||
"skuCapacity": { | ||
"type": "int", | ||
"defaultValue": 1, | ||
"maxValue": 3, | ||
"minValue": 1, | ||
"metadata": { | ||
"description": "Describes plan's instance count" | ||
} | ||
}, | ||
"sqlAdministratorLogin": { | ||
"type": "string", | ||
"defaultValue": "appadmin", | ||
"metadata": { | ||
"description": "The admin user of the SQL Server" | ||
} | ||
}, | ||
"sqlPassword": { | ||
"type": "secureString", | ||
"metadata": { | ||
"description": "The password of the admin user of the SQL Server" | ||
} | ||
}, | ||
"location": { | ||
"type": "string", | ||
"defaultValue": "[resourceGroup().location]", | ||
"metadata": { | ||
"description": "Location for all resources." | ||
} | ||
} | ||
}, | ||
"variables": { | ||
"hostingPlanName": "[format('{0}hosting', uniqueString(resourceGroup().id))]", | ||
"websiteName": "[format('{0}-service', uniqueString(resourceGroup().id))]", | ||
"sqlserverName": "[format('{0}-dbserver', uniqueString(resourceGroup().id))]", | ||
"databaseName": "quickstart" | ||
}, | ||
"resources": [ | ||
{ | ||
"type": "Microsoft.Sql/servers", | ||
"apiVersion": "2021-02-01-preview", | ||
"name": "[variables('sqlserverName')]", | ||
"location": "[parameters('location')]", | ||
"properties": { | ||
"administratorLogin": "[parameters('sqlAdministratorLogin')]", | ||
"administratorLoginPassword": "[parameters('sqlPassword')]", | ||
"version": "12.0" | ||
} | ||
}, | ||
{ | ||
"type": "Microsoft.Sql/servers/databases", | ||
"apiVersion": "2021-02-01-preview", | ||
"name": "[format('{0}/{1}', variables('sqlserverName'), variables('databaseName'))]", | ||
"location": "[parameters('location')]", | ||
"sku": { | ||
"name": "Basic" | ||
}, | ||
"properties": { | ||
"collation": "SQL_Latin1_General_CP1_CI_AS", | ||
"maxSizeBytes": 1073741824 | ||
}, | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.Sql/servers', variables('sqlserverName'))]" | ||
] | ||
}, | ||
{ | ||
"type": "Microsoft.Sql/servers/firewallRules", | ||
"apiVersion": "2021-02-01-preview", | ||
"name": "[format('{0}/{1}', variables('sqlserverName'), 'AllowAllWindowsAzureIps')]", | ||
"properties": { | ||
"endIpAddress": "0.0.0.0", | ||
"startIpAddress": "0.0.0.0" | ||
}, | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.Sql/servers', variables('sqlserverName'))]" | ||
] | ||
}, | ||
{ | ||
"type": "Microsoft.Web/serverfarms", | ||
"apiVersion": "2021-03-01", | ||
"name": "[variables('hostingPlanName')]", | ||
"location": "[parameters('location')]", | ||
"tags": { | ||
"displayName": "HostingPlan" | ||
}, | ||
"sku": { | ||
"name": "[parameters('skuName')]", | ||
"capacity": "[parameters('skuCapacity')]" | ||
}, | ||
"properties": { | ||
"numberOfWorkers": 1 | ||
} | ||
}, | ||
{ | ||
"type": "Microsoft.Web/sites", | ||
"apiVersion": "2021-03-01", | ||
"name": "[variables('websiteName')]", | ||
"location": "[parameters('location')]", | ||
"tags": { | ||
"[format('hidden-related:{0}', resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName')))]": "empty", | ||
"displayName": "Website" | ||
}, | ||
"properties": { | ||
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]" | ||
}, | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]" | ||
] | ||
}, | ||
{ | ||
"type": "Microsoft.Web/sites/config", | ||
"apiVersion": "2021-03-01", | ||
"name": "[format('{0}/{1}', variables('websiteName'), 'connectionstrings')]", | ||
"properties": { | ||
"DefaultConnection": { | ||
"value": "[format('Data Source=tcp:{0},1433;Initial Catalog={1};User Id={2}@{3};Password={4};', reference(resourceId('Microsoft.Sql/servers', variables('sqlserverName'))).fullyQualifiedDomainName, variables('databaseName'), parameters('sqlAdministratorLogin'), reference(resourceId('Microsoft.Sql/servers', variables('sqlserverName'))).fullyQualifiedDomainName, parameters('sqlPassword'))]", | ||
"type": "SQLAzure" | ||
} | ||
}, | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.Sql/servers', variables('sqlserverName'))]", | ||
"[resourceId('Microsoft.Web/sites', variables('websiteName'))]" | ||
] | ||
} | ||
], | ||
"outputs": { | ||
"backendUrl": { | ||
"type": "string", | ||
"value": "[concat('https://', variables('websiteName'), '.azurewebsites.net')]" | ||
}, | ||
"sqlUsername": { | ||
"type": "string", | ||
"value": "[parameters('sqlAdministratorLogin')]" | ||
}, | ||
"sqlPassword": { | ||
"type": "string", | ||
"value": "[parameters('sqlPassword')]" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.