Skip to content

Commit

Permalink
Fixing some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
babisque committed Jun 5, 2024
1 parent 5681a5e commit 231f2a3
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Catalog/Catalog.Core/DTO/Category/CategoryGetRes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ namespace Catalog.Core.DTO.Category;
public class CategoryGetRes
{
public int Id { get; set; }
public string Name { get; set; }
public required string? Name { get; set; }
}
2 changes: 1 addition & 1 deletion Catalog/Catalog.Core/DTO/Category/CategoryUpdateReq.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ namespace Catalog.Core.DTO.Category;

public class CategoryUpdateReq
{
public string Name { get; set; }
public required string? Name { get; set; }
}
2 changes: 1 addition & 1 deletion Catalog/Catalog.Core/DTO/Product/ProductPostReq.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ public class ProductPostReq
public string? Name { get; set; }
public string? Description { get; set; }
public decimal Price { get; set; }
public List<int> Categories { get; set; }
public List<int> Categories { get; set; } = [];
public int Stock { get; set; }
}
2 changes: 1 addition & 1 deletion Catalog/Catalog.Core/DTO/Product/ProductUpdateReq.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ public class ProductUpdateReq
public string? Name { get; set; }
public string? Description { get; set; }
public decimal? Price { get; set; }
public List<Entities.Category> Categories { get; set; }
public List<Entities.Category> Categories { get; set; } = [];
public int? Stock { get; set; }
}
5 changes: 2 additions & 3 deletions Catalog/Catalog.Core/Entities/Category.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ namespace Catalog.Core.Entities;

public class Category : EntityBase
{
public string Name { get; set; }
[JsonIgnore]
public List<Product> Products { get; set; }
public string? Name { get; set; }
[JsonIgnore] public List<Product> Products { get; set; } = [];
}
4 changes: 0 additions & 4 deletions Catalog/Catalog.Test/CategoryControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,6 @@ public async void Delete_NonExistingId_ReturnsNotFount()
{
// Arrange
var category = new Category();
var categoryReq = new CategoryUpdateReq
{
Name = "Category"
};

_categoryRepositoryMock.Setup(repo => repo.GetByIdAsync(1))
.ReturnsAsync(category);
Expand Down

0 comments on commit 231f2a3

Please sign in to comment.