Skip to content

Commit

Permalink
Merge pull request #158 from AntonioFalcao/release
Browse files Browse the repository at this point in the history
Updating
  • Loading branch information
AntonioFalcaoJr authored Mar 10, 2021
2 parents 76f68f3 + 1c3253d commit 207cec0
Show file tree
Hide file tree
Showing 26 changed files with 1,934 additions and 1,937 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Microsoft_DependencyInjection_Version>5.0.0</Microsoft_DependencyInjection_Version>

<!--EF Core-->
<Microsoft_EntityFrameworkCore_Version>5.0.3</Microsoft_EntityFrameworkCore_Version>
<Microsoft_EntityFrameworkCore_Version>6.0.0-preview.1.21102.2</Microsoft_EntityFrameworkCore_Version>

<!--GraphQL-->
<GraphQL_Server_Version>4.4.1</GraphQL_Server_Version>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ Based on cloud-native concepts, **Readiness** and **Liveness** integrity verific
> `/health/live`
> Check if the instance is running and all the dependencies too.

> `/health/ready`
> `/health/ready`
> Check if the instance and all the dependencies are ready to attend to all functionalities.

Web API
Expand Down
12 changes: 8 additions & 4 deletions src/Dotnet5.GraphQL3.CrossCutting/Application.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.Extensions.DependencyModel;

namespace Dotnet5.GraphQL3.CrossCutting
{
public static class Application
{
public static string Prefix { get; } = Assembly.GetEntryAssembly()?.FullName?.Substring(0, 16);
public static IEnumerable<Assembly> Assemblies { get; } =
AppDomain.CurrentDomain.GetAssemblies().Where(assembly => assembly.FullName?.StartsWith(Prefix) ?? false);

public static IEnumerable<Assembly> Assemblies { get; } =
DependencyContext.Default.RuntimeLibraries
.Where(library => library.Name.Contains(Prefix))
.SelectMany(library => library.GetDefaultAssemblyNames(DependencyContext.Default))
.Select(Assembly.Load);
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="FluentValidation" Version="$(FluentValidation_Version)" />
<PackageReference Include="GraphQL" Version="$(GraphQL_Version)" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(Microsoft_DependencyInjection_Version)" />
<PackageReference Include="FluentValidation" Version="$(FluentValidation_Version)"/>
<PackageReference Include="GraphQL" Version="$(GraphQL_Version)"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(Microsoft_DependencyInjection_Version)"/>
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="3.1.6"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="FluentValidation" Version="$(FluentValidation_Version)" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(Microsoft_DependencyInjection_Version)" />
<PackageReference Include="Scrutor" Version="$(Scrutor_Version)" />
<PackageReference Include="FluentValidation" Version="$(FluentValidation_Version)"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(Microsoft_DependencyInjection_Version)"/>
<PackageReference Include="Scrutor" Version="$(Scrutor_Version)"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Dotnet5.GraphQL3.CrossCutting\Dotnet5.GraphQL3.CrossCutting.csproj" />
<ProjectReference Include="..\Dotnet5.GraphQL3.CrossCutting\Dotnet5.GraphQL3.CrossCutting.csproj"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="AutoMapper" Version="$(AutoMapper_Version)" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(Microsoft_EntityFrameworkCore_Version)" />
<PackageReference Include="Scrutor" Version="$(Scrutor_Version)" />
<PackageReference Include="AutoMapper" Version="$(AutoMapper_Version)"/>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(Microsoft_EntityFrameworkCore_Version)"/>
<PackageReference Include="Scrutor" Version="$(Scrutor_Version)"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Dotnet5.GraphQL3.Store.Domain\Dotnet5.GraphQL3.Store.Domain.csproj" />
<ProjectReference Include="..\Dotnet5.GraphQL3.Store.Domain\Dotnet5.GraphQL3.Store.Domain.csproj"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="AutoMapper" Version="$(AutoMapper_Version)" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="$(AutoMapper_DependencyInjection_Version)" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(Microsoft_EntityFrameworkCore_Version)" />
<PackageReference Include="Scrutor" Version="$(Scrutor_Version)" />
<PackageReference Include="AutoMapper" Version="$(AutoMapper_Version)"/>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="$(AutoMapper_DependencyInjection_Version)"/>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(Microsoft_EntityFrameworkCore_Version)"/>
<PackageReference Include="Scrutor" Version="$(Scrutor_Version)"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Dotnet5.GraphQL3.CrossCutting\Dotnet5.GraphQL3.CrossCutting.csproj" />
<ProjectReference Include="..\Dotnet5.GraphQL3.Repositories.Abstractions\Dotnet5.GraphQL3.Repositories.Abstractions.csproj" />
<ProjectReference Include="..\Dotnet5.GraphQL3.Store.Domain\Dotnet5.GraphQL3.Store.Domain.csproj" />
<ProjectReference Include="..\Dotnet5.GraphQL3.CrossCutting\Dotnet5.GraphQL3.CrossCutting.csproj"/>
<ProjectReference Include="..\Dotnet5.GraphQL3.Repositories.Abstractions\Dotnet5.GraphQL3.Repositories.Abstractions.csproj"/>
<ProjectReference Include="..\Dotnet5.GraphQL3.Store.Domain\Dotnet5.GraphQL3.Store.Domain.csproj"/>
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Dotnet5.GraphQL3.Services.Abstractions/Models/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ namespace Dotnet5.GraphQL3.Services.Abstractions.Models
public abstract record Model<TId>
where TId : struct
{
private TId? Id { get; init; }
public TId? Id { get; init; }
}
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="FluentValidation" Version="$(FluentValidation_Version)" />
<PackageReference Include="FluentValidation" Version="$(FluentValidation_Version)"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Dotnet5.GraphQL3.Domain.Abstractions\Dotnet5.GraphQL3.Domain.Abstractions.csproj"/>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Resource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<Compile Update="Resource.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>DomainResource.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Dotnet5.GraphQL3.Domain.Abstractions\Dotnet5.GraphQL3.Domain.Abstractions.csproj" />
</ItemGroup>

</Project>
14 changes: 8 additions & 6 deletions src/Dotnet5.GraphQL3.Store.Domain/Entities/Products/Product.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ namespace Dotnet5.GraphQL3.Store.Domain.Entities.Products
{
public abstract class Product : Entity<Guid>, IProduct
{
protected Product(Guid id, string description, DateTimeOffset introduceAt, string name, string photoUrl, decimal price,
ProductType productType, int rating, int stock, Option option)
private readonly HashSet<Review> _reviews = new();

protected Product(Guid id, string description, DateTimeOffset introduceAt, string name, string photoUrl, decimal price, ProductType productType, int rating, int stock, Option option)
{
Id = id;
Description = description;
Expand All @@ -22,11 +23,13 @@ protected Product(Guid id, string description, DateTimeOffset introduceAt, strin
Rating = rating;
Stock = stock;
Option = option;
Reviews = new List<Review>();
}

protected Product() { }

public IReadOnlyCollection<Review> Reviews
=> _reviews;

public string Description { get; }
public DateTimeOffset IntroduceAt { get; }
public string Name { get; }
Expand All @@ -36,7 +39,6 @@ protected Product() { }
public ProductType ProductType { get; }
public int Rating { get; }
public int Stock { get; }
public ICollection<Review> Reviews { get; }

public void AddReview(Review review)
{
Expand All @@ -46,8 +48,8 @@ public void AddReview(Review review)
return;
}

if (Reviews.Contains(review)) return;
Reviews.Add(review);
if (_reviews.Contains(review)) return;
_reviews.Add(review);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
using Dotnet5.GraphQL3.Store.Domain.Entities.Products;
using Dotnet5.GraphQL3.Store.Domain.Entities.Products.Backpacks;
using Dotnet5.GraphQL3.Store.Domain.Enumerations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

namespace Dotnet5.GraphQL3.Store.Repositories.Configs.Products
{
public class BackpackConfig : IEntityTypeConfiguration<Backpack>
{
public void Configure(EntityTypeBuilder<Backpack> builder)
{
builder
.HasBaseType<Product>();

builder
.Property(x => x.BackpackType)
.HasConversion(new EnumToStringConverter<BackpackType>());
}
}
using Dotnet5.GraphQL3.Store.Domain.Entities.Products;
using Dotnet5.GraphQL3.Store.Domain.Entities.Products.Backpacks;
using Dotnet5.GraphQL3.Store.Domain.Enumerations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

namespace Dotnet5.GraphQL3.Store.Repositories.Configurations.Products
{
public class BackpackConfiguration : IEntityTypeConfiguration<Backpack>
{
public void Configure(EntityTypeBuilder<Backpack> builder)
{
builder
.HasBaseType<Product>();

builder
.Property(x => x.BackpackType)
.HasConversion(new EnumToStringConverter<BackpackType>());
}
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
using Dotnet5.GraphQL3.Store.Domain.Entities.Products;
using Dotnet5.GraphQL3.Store.Domain.Entities.Products.Boots;
using Dotnet5.GraphQL3.Store.Domain.Enumerations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

namespace Dotnet5.GraphQL3.Store.Repositories.Configs.Products
{
public class BootConfig : IEntityTypeConfiguration<Boot>
{
public void Configure(EntityTypeBuilder<Boot> builder)
{
builder
.HasBaseType<Product>();

builder
.Property(x => x.Size);

builder
.Property(x => x.BootType)
.HasConversion(new EnumToStringConverter<BootType>());
}
}
using Dotnet5.GraphQL3.Store.Domain.Entities.Products;
using Dotnet5.GraphQL3.Store.Domain.Entities.Products.Boots;
using Dotnet5.GraphQL3.Store.Domain.Enumerations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

namespace Dotnet5.GraphQL3.Store.Repositories.Configurations.Products
{
public class BootConfiguration : IEntityTypeConfiguration<Boot>
{
public void Configure(EntityTypeBuilder<Boot> builder)
{
builder
.HasBaseType<Product>();

builder
.Property(x => x.Size);

builder
.Property(x => x.BootType)
.HasConversion(new EnumToStringConverter<BootType>());
}
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
using Dotnet5.GraphQL3.Store.Domain.Entities.Products;
using Dotnet5.GraphQL3.Store.Domain.Entities.Products.Kayaks;
using Dotnet5.GraphQL3.Store.Domain.Enumerations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

namespace Dotnet5.GraphQL3.Store.Repositories.Configs.Products
{
public class KayakConfig : IEntityTypeConfiguration<Kayak>
{
public void Configure(EntityTypeBuilder<Kayak> builder)
{
builder
.HasBaseType<Product>();

builder
.Property(x => x.KayakType)
.HasConversion(new EnumToStringConverter<KayakType>());

builder
.Property(x => x.AmountOfPerson);
}
}
using Dotnet5.GraphQL3.Store.Domain.Entities.Products;
using Dotnet5.GraphQL3.Store.Domain.Entities.Products.Kayaks;
using Dotnet5.GraphQL3.Store.Domain.Enumerations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

namespace Dotnet5.GraphQL3.Store.Repositories.Configurations.Products
{
public class KayakConfiguration : IEntityTypeConfiguration<Kayak>
{
public void Configure(EntityTypeBuilder<Kayak> builder)
{
builder
.HasBaseType<Product>();

builder
.Property(x => x.KayakType)
.HasConversion(new EnumToStringConverter<KayakType>());

builder
.Property(x => x.AmountOfPerson);
}
}
}
Loading

0 comments on commit 207cec0

Please sign in to comment.