Skip to content

Commit

Permalink
Fixed data sources
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalii-bezuhlyi committed Nov 6, 2024
1 parent 889b250 commit c1aa368
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Apps.Magento/Actions/ProductActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public async Task<ProductResponse> UpdateProductBySkuAsHtmlAsync(
[Action("Delete product", Description = "Delete product by specified SKU")]
public async Task DeleteProductBySkuAsync([ActionParameter] ProductIdentifier identifier)
{
var endpoint = $"/rest/default/V1/products/{identifier.Sku}";
var endpoint = $"/rest/V1/products/{identifier.Sku}";
await Client.ExecuteWithErrorHandling(
new ApiRequest(endpoint, Method.Delete, Creds));
}
Expand Down
2 changes: 1 addition & 1 deletion Apps.Magento/Apps.Magento.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<Product>Adobe Commerce - Magento [Beta]</Product>
<Description>Magento is the leading platform for open commerce innovation. It’s designed to be flexible and scalable, able to support businesses of all sizes – from small startups to large enterprises.</Description>
<Version>1.0.4</Version>
<Version>1.0.5</Version>
<AssemblyName>Apps.Magento</AssemblyName>
<RootNamespace>Apps.Magento</RootNamespace>
<PackageId>Apps.Magento</PackageId>
Expand Down
2 changes: 1 addition & 1 deletion Apps.Magento/DataSources/AttributeSetDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class AttributeSetDataSource(InvocationContext invocationContext) : AppIn
{
public async Task<Dictionary<string, string>> GetDataAsync(DataSourceContext context, CancellationToken cancellationToken)
{
var request = new ApiRequest("/rest/default/V1/eav/attribute-sets/list?searchCriteria", Method.Get, Creds);
var request = new ApiRequest("/rest/V1/eav/attribute-sets/list?searchCriteria", Method.Get, Creds);
var storeViews = await Client.ExecuteWithErrorHandling<AttributeSetPaginationDto>(request);
return storeViews.Items
.Where(x => context.SearchString == null || BuildReadableName(x).Contains(context.SearchString))
Expand Down
3 changes: 2 additions & 1 deletion Apps.Magento/DataSources/ProductAttributeDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ public class ProductAttributeDataSource(InvocationContext invocationContext) : A
{
public async Task<Dictionary<string, string>> GetDataAsync(DataSourceContext context, CancellationToken cancellationToken)
{
var request = new ApiRequest("/rest/default/V1/products/attributes?searchCriteria", Method.Get, Creds);
var request = new ApiRequest("/rest/V1/products/attributes?searchCriteria", Method.Get, Creds);
var productAttributes = await Client.ExecuteWithErrorHandling<ProductAttributesDto>(request);
return productAttributes.Items
.Where(x => context.SearchString == null || x.DefaultFrontendLabel.Contains(context.SearchString))
.Where(x => x.FrontendInput == "text" || x.FrontendInput == "textarea")
.ToDictionary(x => x.AttributeCode, x => x.DefaultFrontendLabel);
}
}
2 changes: 1 addition & 1 deletion Apps.Magento/DataSources/ProductTypeDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ProductTypeDataSource(InvocationContext invocationContext) : AppInv
{
public async Task<Dictionary<string, string>> GetDataAsync(DataSourceContext context, CancellationToken cancellationToken)
{
var request = new ApiRequest("/rest/default/V1/products/types", Method.Get, Creds);
var request = new ApiRequest("/rest/V1/products/types", Method.Get, Creds);
var storeViews = await Client.ExecuteWithErrorHandling<List<ProductTypeDto>>(request);
return storeViews
.Where(x => context.SearchString == null || x.Name.Contains(context.SearchString))
Expand Down
2 changes: 1 addition & 1 deletion Apps.Magento/DataSources/StoreViewDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class StoreViewDataSource(InvocationContext invocationContext) : AppInvoc
{
public virtual async Task<Dictionary<string, string>> GetDataAsync(DataSourceContext context, CancellationToken cancellationToken)
{
var request = new ApiRequest("/rest/default/V1/store/storeViews", Method.Get, Creds);
var request = new ApiRequest("/rest/V1/store/storeViews", Method.Get, Creds);
var storeViews = await Client.ExecuteWithErrorHandling<List<StoreViewDto>>(request);
return storeViews
.Where(x => context.SearchString == null || x.Name.Contains(context.SearchString))
Expand Down
2 changes: 2 additions & 0 deletions Apps.Magento/Models/Dtos/ProductAttributesDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ public class ProductAttributeDto
public string AttributeCode { get; set; } = string.Empty;

public string DefaultFrontendLabel { get; set; } = string.Empty;

public string FrontendInput { get; set; } = string.Empty;
}

0 comments on commit c1aa368

Please sign in to comment.