Merge branch 'dev' into update-WebStatus
This commit is contained in:
commit
eb7abbc984
@ -3,7 +3,8 @@
|
|||||||
declare -x path=$1
|
declare -x path=$1
|
||||||
|
|
||||||
if [ -z "$path" ]; then
|
if [ -z "$path" ]; then
|
||||||
$path="$(pwd)/../src";
|
$path="$(pwd)/../src";
|
||||||
|
echo -e "\e[33mNo path passed. Will use $path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare -a projectList=(
|
declare -a projectList=(
|
||||||
@ -30,9 +31,9 @@ do
|
|||||||
echo -e "\e[33m\tRemoving old publish output"
|
echo -e "\e[33m\tRemoving old publish output"
|
||||||
pushd $path/$project
|
pushd $path/$project
|
||||||
rm -rf obj/Docker/publish
|
rm -rf obj/Docker/publish
|
||||||
echo -e "\e[33m\tRestoring project"
|
echo -e "\e[33m\tRestoring project $project"
|
||||||
dotnet restore
|
dotnet restore
|
||||||
echo -e "\e[33m\tBuilding and publishing projects"
|
echo -e "\e[33m\tBuilding and publishing $project"
|
||||||
dotnet publish -o obj/Docker/publish
|
dotnet publish -o obj/Docker/publish
|
||||||
popd
|
popd
|
||||||
done
|
done
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
version: '2'
|
version: '2.1'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
sql.data:
|
sql.data:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
version: '2'
|
version: '2.1'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
ci-build:
|
ci-build:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
version: '2'
|
version: '2.1'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
basket.api:
|
basket.api:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
version: '3'
|
version: '2.1'
|
||||||
|
|
||||||
# The default docker-compose.override file can use the "localhost" as the external name for testing web apps within the same dev machine.
|
# The default docker-compose.override file can use the "localhost" as the external name for testing web apps within the same dev machine.
|
||||||
# The ESHOP_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like:
|
# The ESHOP_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
version: '3'
|
version: '2.1'
|
||||||
|
|
||||||
# The Production docker-compose file has to have the external/real IPs or DNS names for the services
|
# The Production docker-compose file has to have the external/real IPs or DNS names for the services
|
||||||
# The ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like:
|
# The ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
version: '3'
|
version: '2.1'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
basket.api:
|
basket.api:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
version: '3'
|
version: '2.1'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
basket.api:
|
basket.api:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
version: '3'
|
version: '2.1'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
graceperiodmanager:
|
graceperiodmanager:
|
||||||
|
@ -22,19 +22,32 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
|||||||
_catalogContext = catalogContext;
|
_catalogContext = catalogContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{filename}")]
|
[HttpGet("{id}")]
|
||||||
// GET: /<controller>/
|
// GET: /<controller>/
|
||||||
public IActionResult GetImage(string filename)
|
public async Task<IActionResult> GetImage(int id)
|
||||||
{
|
{
|
||||||
var webRoot = _env.WebRootPath;
|
if (id <= 0)
|
||||||
var path = Path.Combine(webRoot, filename);
|
{
|
||||||
|
return BadRequest();
|
||||||
|
}
|
||||||
|
|
||||||
string imageFileExtension = Path.GetExtension(filename);
|
var item = await _catalogContext.CatalogItems
|
||||||
string mimetype = GetImageMimeTypeFromImageFileExtension(imageFileExtension);
|
.SingleOrDefaultAsync(ci => ci.Id == id);
|
||||||
|
|
||||||
var buffer = System.IO.File.ReadAllBytes(path);
|
if (item != null)
|
||||||
|
{
|
||||||
|
var webRoot = _env.WebRootPath;
|
||||||
|
var path = Path.Combine(webRoot, item.PictureFileName);
|
||||||
|
|
||||||
return File(buffer, mimetype);
|
string imageFileExtension = Path.GetExtension(item.PictureFileName);
|
||||||
|
string mimetype = GetImageMimeTypeFromImageFileExtension(imageFileExtension);
|
||||||
|
|
||||||
|
var buffer = System.IO.File.ReadAllBytes(path);
|
||||||
|
|
||||||
|
return File(buffer, mimetype);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetImageMimeTypeFromImageFileExtension(string extension)
|
private string GetImageMimeTypeFromImageFileExtension(string extension)
|
||||||
@ -43,29 +56,29 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
|||||||
|
|
||||||
switch (extension)
|
switch (extension)
|
||||||
{
|
{
|
||||||
case "png":
|
case ".png":
|
||||||
mimetype = "image/png";
|
mimetype = "image/png";
|
||||||
break;
|
break;
|
||||||
case "gif":
|
case ".gif":
|
||||||
mimetype = "image/gif";
|
mimetype = "image/gif";
|
||||||
break;
|
break;
|
||||||
case "jpg":
|
case ".jpg":
|
||||||
case "jpeg":
|
case ".jpeg":
|
||||||
mimetype = "image/jpeg";
|
mimetype = "image/jpeg";
|
||||||
break;
|
break;
|
||||||
case "bmp":
|
case ".bmp":
|
||||||
mimetype = "image/bmp";
|
mimetype = "image/bmp";
|
||||||
break;
|
break;
|
||||||
case "tiff":
|
case ".tiff":
|
||||||
mimetype = "image/tiff";
|
mimetype = "image/tiff";
|
||||||
break;
|
break;
|
||||||
case "wmf":
|
case ".wmf":
|
||||||
mimetype = "image/wmf";
|
mimetype = "image/wmf";
|
||||||
break;
|
break;
|
||||||
case "jp2":
|
case ".jp2":
|
||||||
mimetype = "image/jp2";
|
mimetype = "image/jp2";
|
||||||
break;
|
break;
|
||||||
case "svg":
|
case ".svg":
|
||||||
mimetype = "image/svg+xml";
|
mimetype = "image/svg+xml";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -189,7 +189,7 @@
|
|||||||
string[] csvheaders;
|
string[] csvheaders;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string[] requiredHeaders = { "catalogtypename", "catalogbrandname", "description", "name", "price", "pictureuri" };
|
string[] requiredHeaders = { "catalogtypename", "catalogbrandname", "description", "name", "price", "pictureFileName" };
|
||||||
string[] optionalheaders = { "availablestock", "restockthreshold", "maxstockthreshold", "onreorder" };
|
string[] optionalheaders = { "availablestock", "restockthreshold", "maxstockthreshold", "onreorder" };
|
||||||
csvheaders = GetHeaders(csvFileCatalogItems, requiredHeaders, optionalheaders );
|
csvheaders = GetHeaders(csvFileCatalogItems, requiredHeaders, optionalheaders );
|
||||||
}
|
}
|
||||||
@ -320,18 +320,18 @@
|
|||||||
{
|
{
|
||||||
return new List<CatalogItem>()
|
return new List<CatalogItem>()
|
||||||
{
|
{
|
||||||
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Bot Black Hoodie", Name = ".NET Bot Black Hoodie", Price = 19.5M, PictureUri = "1.png", AvailableStock = 100 },
|
new CatalogItem { CatalogTypeId = 2, CatalogBrandId = 2, Description = ".NET Bot Black Hoodie", Name = ".NET Bot Black Hoodie", Price = 19.5M, PictureFileName = "1.png" },
|
||||||
new CatalogItem() { CatalogTypeId=1,CatalogBrandId=2, Description = ".NET Black & White Mug", Name = ".NET Black & White Mug", Price= 8.50M, PictureUri = "2.png", AvailableStock = 100 },
|
new CatalogItem { CatalogTypeId = 1, CatalogBrandId = 2, Description = ".NET Black & White Mug", Name = ".NET Black & White Mug", Price= 8.50M, PictureFileName = "2.png" },
|
||||||
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUri = "3.png", AvailableStock = 100 },
|
new CatalogItem { CatalogTypeId = 2, CatalogBrandId = 5, Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureFileName = "3.png" },
|
||||||
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Foundation T-shirt", Name = ".NET Foundation T-shirt", Price = 12, PictureUri = "4.png", AvailableStock = 100 },
|
new CatalogItem { CatalogTypeId = 2, CatalogBrandId = 2, Description = ".NET Foundation T-shirt", Name = ".NET Foundation T-shirt", Price = 12, PictureFileName = "4.png" },
|
||||||
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=5, Description = "Roslyn Red Sheet", Name = "Roslyn Red Sheet", Price = 8.5M, PictureUri = "5.png", AvailableStock = 100 },
|
new CatalogItem { CatalogTypeId = 3, CatalogBrandId = 5, Description = "Roslyn Red Sheet", Name = "Roslyn Red Sheet", Price = 8.5M, PictureFileName = "5.png" },
|
||||||
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Blue Hoodie", Name = ".NET Blue Hoodie", Price = 12, PictureUri = "6.png", AvailableStock = 100 },
|
new CatalogItem { CatalogTypeId = 2, CatalogBrandId = 2, Description = ".NET Blue Hoodie", Name = ".NET Blue Hoodie", Price = 12, PictureFileName = "6.png" },
|
||||||
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUri = "7.png", AvailableStock = 100 },
|
new CatalogItem { CatalogTypeId = 2, CatalogBrandId = 5, Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureFileName = "7.png" },
|
||||||
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Kudu Purple Hoodie", Name = "Kudu Purple Hoodie", Price = 8.5M, PictureUri = "8.png", AvailableStock = 100 },
|
new CatalogItem { CatalogTypeId = 2, CatalogBrandId = 5, Description = "Kudu Purple Hoodie", Name = "Kudu Purple Hoodie", Price = 8.5M, PictureFileName = "8.png" },
|
||||||
new CatalogItem() { CatalogTypeId=1,CatalogBrandId=5, Description = "Cup<T> White Mug", Name = "Cup<T> White Mug", Price = 12, PictureUri = "9.png", AvailableStock = 100 },
|
new CatalogItem { CatalogTypeId = 1, CatalogBrandId = 5, Description = "Cup<T> White Mug", Name = "Cup<T> White Mug", Price = 12, PictureFileName = "9.png" },
|
||||||
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = ".NET Foundation Sheet", Name = ".NET Foundation Sheet", Price = 12, PictureUri = "10.png", AvailableStock = 100 },
|
new CatalogItem { CatalogTypeId = 3, CatalogBrandId = 2, Description = ".NET Foundation Sheet", Name = ".NET Foundation Sheet", Price = 12, PictureFileName = "10.png" },
|
||||||
new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = "Cup<T> Sheet", Name = "Cup<T> Sheet", Price = 8.5M, PictureUri = "11.png", AvailableStock = 100 },
|
new CatalogItem { CatalogTypeId = 3, CatalogBrandId = 2, Description = "Cup<T> Sheet", Name = "Cup<T> Sheet", Price = 8.5M, PictureFileName = "11.png" },
|
||||||
new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White TShirt", Name = "Prism White TShirt", Price = 12, PictureUri = "12.png", AvailableStock = 100 }
|
new CatalogItem { CatalogTypeId = 2, CatalogBrandId = 5, Description = "Prism White TShirt", Name = "Prism White TShirt", Price = 12, PictureFileName = "12.png" },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
CatalogTypeName,CatalogBrandName,Description,Name,Price,PictureUri,availablestock,onreorder
|
CatalogTypeName,CatalogBrandName,Description,Name,Price,PictureFileName,availablestock,onreorder
|
||||||
T-Shirt,.NET,".NET Bot Black Hoodie, and more",.NET Bot Black Hoodie,19.5,1.png,100,false
|
T-Shirt,.NET,".NET Bot Black Hoodie, and more",.NET Bot Black Hoodie,19.5,1.png,100,false
|
||||||
Mug,.NET,.NET Black & White Mug,.NET Black & White Mug,8.50,2.png,89,true
|
Mug,.NET,.NET Black & White Mug,.NET Black & White Mug,8.50,2.png,89,true
|
||||||
T-Shirt,Other,Prism White T-Shirt,Prism White T-Shirt,12,3.png,56,false
|
T-Shirt,Other,Prism White T-Shirt,Prism White T-Shirt,12,3.png,56,false
|
||||||
|
Can't render this file because it contains an unexpected character in line 8 and column 52.
|
Loading…
x
Reference in New Issue
Block a user