Skip to content

Commit 1ccbdb7

Browse files
authored
Merge pull request fullstackhero#1 from blazorhero/master
Update 2.2
2 parents 4305d29 + 8120baa commit 1ccbdb7

File tree

267 files changed

+23471
-366
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

267 files changed

+23471
-366
lines changed

.vscode/launch.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Launch and Debug Standalone Blazor WebAssembly App",
6+
"type": "blazorwasm",
7+
"request": "launch",
8+
"cwd": "${workspaceFolder}/src/Server"
9+
}
10+
]
11+
}

.vscode/tasks.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "build",
8+
"command": "dotnet",
9+
"type": "shell",
10+
"args": [
11+
"build",
12+
"${workspaceFolder}/BlazorHero.CleanArchitecture.sln",
13+
// Ask dotnet build to generate full paths for file names.
14+
"/property:GenerateFullPaths=true",
15+
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
16+
"/consoleloggerparameters:NoSummary"
17+
],
18+
"group": "build",
19+
"presentation": {
20+
"reveal": "silent"
21+
},
22+
"problemMatcher": "$msCompile"
23+
}
24+
]
25+
}

Features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- [x] Logout Users / Regenerate Token from Multiple Client Browsers when Permission Changes
1010
- [x] FIX: Token Issue Fixed from v1.0.1
1111
- [x] User Images in Chat Component
12-
- [x] Chat - Integrated with Identity to support Private Chats (Will require re-migrating the DB scehmas)
12+
- [x] Chat - Integrated with Identity to support Private Chats (Will require re-migrating the DB schemas)
1313
- [x] Notifications System using SignalR
1414
- [x] Document Management
1515
- [x] Export to Excel

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ So, here is an in-depth video that takes you through the BlazorHero Project! Do
7171
# What to Expect in BlazorHero 3.0?
7272

7373
- Modular Architecture
74-
- Cleaner Seperation Of Code
74+
- Cleaner Separation Of Code
7575
- Dedicated Documentation Website - [Here](https://blazorhero.github.io/docs/)
7676
- Tutorials to add new entities, controllers
7777
- UI Updates
@@ -88,7 +88,7 @@ So, here is an in-depth video that takes you through the BlazorHero Project! Do
8888
# Getting Started 🦸
8989

9090
> **Important**
91-
If you are already using Blazor Hero v1.x, make sure that you drop your existing database and re-update your database using the CLI as there are couple of new migrations added that may clash with your existing schema. Also, install the latest version of BlazorHero.
91+
If you are already using Blazor Hero v1.x, make sure that you drop your existing database and re-update your database using the CLI as there are a couple of new migrations added that might clash with your existing schema. Also, install the latest version of BlazorHero.
9292

9393
The easiest way to get started with Blazor Hero is to install the [NuGet package](https://www.nuget.org/packages/BlazorHero.CleanArchitecture/) and run `dotnet new BlazorHero.CleanArchitecture`:
9494

@@ -113,15 +113,15 @@ What to do next? Read the [entire guide on my blog](https://codewithmukesh.com/b
113113
- Now navigate back to the root of the BlazorHero Project on your local machine and run the following via terminal - `docker-compose -f 'docker-compose.yml' up --build`
114114
- This will start pulling MSSQL Server Image from Docker Hub if you don't already have this image. It's around 500+ Mbs of download.
115115
- Once that is done, dotnet SDKs and runtimes are downloaded, if not present already. That's almost 200+ more Mbs of download.
116-
- PS If you find any issues while Docker installs the nuget packages, it is most likelt that your ssl certificates are not intalled properly. Apart from that I also added the `--disable-parallel` in the `Server\Dockerfile`to ensure network issues don't pop-up. You can remove this option to speed up the build process.
116+
- PS If you find any issues while Docker installs the nuget packages, it is most likely that your ssl certificates are not installed properly. Apart from that I also added the `--disable-parallel` in the `Server\Dockerfile`to ensure network issues don't pop-up. You can remove this option to speed up the build process.
117117
- That's almost everything. Once the containers are available, migrations are updated in the MSSQL DB, default data is seeded.
118118
- Browse to https://localhost:5005/ to use your version of BlazorHero !
119119

120120
# Complete Documentation :rocket:
121121

122122
Getting started with Blazor Hero – A Clean Architecture Template built for Blazor WebAssembly using MudBlazor Components. This project will make your Blazor Learning Process much easier than you anticipate. Blazor Hero is meant to be an Enterprise Level Boilerplate, which comes free of cost, completely open sourced.
123123

124-
The provided documentation / guide will get you started with BlazorHero in no-time. It provides a complete walkthrough about the project with to-the-point guides and notes.
124+
The provided documentation / guide will get you started with BlazorHero in no time. It provides a complete walkthrough for the project with to-the-point guides and notes.
125125

126126
<a href="https://codewithmukesh.com/blog/blazor-hero-quick-start-guide/"><strong>Read the Quick Start Guide</strong></a>
127127

@@ -131,7 +131,7 @@ All the completed and the upcoming features are mentioned in the [Features.MD Fi
131131

132132
## Contributing
133133

134-
Contributions are what make the open-source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
134+
Contributions are what make the open-source community such an amazing place to be, learn, inspire, and create. Any contributions you make are **greatly appreciated**.
135135

136136
1. Fork the Project
137137
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
@@ -143,7 +143,7 @@ Here are the few contributions that I would highly appreciate ;)
143143

144144
- [ ] Need someone to add in the API Documentation for Swagger.
145145
- [ ] Need someone to implement localization throughout every Razor Component of the solution under the WASM(Client) Project. You can take the Pages/Authentication/Login.razor as the point of reference. It is as simple as adding `@inject Microsoft.Extensions.Localization.IStringLocalizer<Login> localizer` to every page, changing the texts to `@localizer["Text Here"]` and finally adding resx files to the Resources Folder as per the folder structure.
146-
- [ ] Need few contributors to add in various language transalations as per the implemented Location. I got time to only add a few transalations for French as of now.
146+
- [ ] Need few contributors to add in various language translations as per the implemented Location. I got time to only add a few translations for French as of now.
147147
- [ ] Need a UI contributor to look at the UX/UI of the entire project
148148
- [ ] Need someone to buildup a cool Material Logo for BlazorHero (BH):D Do contact me on LinkedIn (https://www.linkedin.com/in/iammukeshm/).
149149
- [ ] And finally, Stars from everyone! :D

src/Application/Application.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
<ItemGroup>
99
<PackageReference Include="AutoMapper" Version="10.1.1" />
1010
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
11-
<PackageReference Include="FluentValidation" Version="10.2.3" />
11+
<PackageReference Include="FluentValidation" Version="10.3.3" />
1212
<PackageReference Include="LazyCache" Version="2.1.3" />
1313
<PackageReference Include="MediatR" Version="9.0.0" />
1414
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="9.0.0" />
15-
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="5.0.7" />
16-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.7" />
15+
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="5.0.9" />
16+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.9" />
1717
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
18-
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.10" />
18+
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.12" />
1919
</ItemGroup>
2020
<ItemGroup>
2121
<ProjectReference Include="..\Domain\Domain.csproj" />

src/Application/Configurations/AppConfiguration.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@
33
public class AppConfiguration
44
{
55
public string Secret { get; set; }
6+
7+
public bool BehindSSLProxy { get; set; }
8+
9+
public string ProxyIP { get; set; }
10+
11+
public string ApplicationUrl { get; set; }
612
}
713
}

src/Application/Features/Brands/Commands/Import/ImportBrandsCommand.cs

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,31 +54,39 @@ public async Task<Result<int>> Handle(ImportBrandsCommand request, CancellationT
5454
{ _localizer["Name"], (row,item) => item.Name = row[_localizer["Name"]].ToString() },
5555
{ _localizer["Description"], (row,item) => item.Description = row[_localizer["Description"]].ToString() },
5656
{ _localizer["Tax"], (row,item) => item.Tax = decimal.TryParse(row[_localizer["Tax"]].ToString(), out var tax) ? tax : 1 }
57-
}, _localizer["Brands"])).ToList();
57+
}, _localizer["Brands"]));
5858

59-
var errors = new List<string>();
60-
var errorsOccurred = false;
61-
foreach(var item in result)
59+
if (result.Succeeded)
6260
{
63-
var validationResult = await _addBrandValidator.ValidateAsync(_mapper.Map<AddEditBrandCommand>(item), cancellationToken);
64-
if (validationResult.IsValid)
61+
var importedBrands = result.Data;
62+
var errors = new List<string>();
63+
var errorsOccurred = false;
64+
foreach (var brand in importedBrands)
6565
{
66-
await _unitOfWork.Repository<Brand>().AddAsync(item);
66+
var validationResult = await _addBrandValidator.ValidateAsync(_mapper.Map<AddEditBrandCommand>(brand), cancellationToken);
67+
if (validationResult.IsValid)
68+
{
69+
await _unitOfWork.Repository<Brand>().AddAsync(brand);
70+
}
71+
else
72+
{
73+
errorsOccurred = true;
74+
errors.AddRange(validationResult.Errors.Select(e => $"{(!string.IsNullOrWhiteSpace(brand.Name) ? $"{brand.Name} - " : string.Empty)}{e.ErrorMessage}"));
75+
}
6776
}
68-
else
77+
78+
if (errorsOccurred)
6979
{
70-
errorsOccurred = true;
71-
errors.AddRange(validationResult.Errors.Select(e => $"{(!string.IsNullOrWhiteSpace(item.Name) ? $"{item.Name} - " : string.Empty)}{e.ErrorMessage}"));
80+
return await Result<int>.FailAsync(errors);
7281
}
73-
}
7482

75-
if (errorsOccurred)
83+
await _unitOfWork.CommitAndRemoveCache(cancellationToken, ApplicationConstants.Cache.GetAllBrandsCacheKey);
84+
return await Result<int>.SuccessAsync(result.Data.Count(), result.Messages[0]);
85+
}
86+
else
7687
{
77-
return await Result<int>.FailAsync(errors);
88+
return await Result<int>.FailAsync(result.Messages);
7889
}
79-
80-
await _unitOfWork.CommitAndRemoveCache(cancellationToken, ApplicationConstants.Cache.GetAllBrandsCacheKey);
81-
return await Result<int>.SuccessAsync(result.Count, _localizer["Import Success"]);
8290
}
8391
}
8492
}

src/Application/Features/ExtendedAttributes/Commands/AddEdit/AddEditExtendedAttributeCommand.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,35 @@ public class AddEditExtendedAttributeCommand<TId, TEntityId, TEntity, TExtendedA
2727
where TExtendedAttribute : AuditableEntityExtendedAttribute<TId, TEntityId, TEntity>, IEntity<TId>
2828
where TId : IEquatable<TId>
2929
{
30+
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
3031
public TId Id { get; set; }
32+
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
33+
34+
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
3135
public TEntityId EntityId { get; set; }
36+
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
37+
3238
public EntityExtendedAttributeType Type { get; set; }
39+
3340
[Required(AllowEmptyStrings = false)]
41+
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
3442
public string Key { get; set; }
43+
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
44+
3545
public string? Text { get; set; }
46+
3647
public decimal? Decimal { get; set; }
48+
3749
public DateTime? DateTime { get; set; }
50+
3851
public string? Json { get; set; }
52+
3953
public string? ExternalId { get; set; }
54+
4055
public string? Group { get; set; }
56+
4157
public string? Description { get; set; }
58+
4259
public bool IsActive { get; set; }
4360
}
4461

@@ -64,7 +81,7 @@ public AddEditExtendedAttributeCommandHandler(
6481

6582
public async Task<Result<TId>> Handle(AddEditExtendedAttributeCommand<TId, TEntityId, TEntity, TExtendedAttribute> command, CancellationToken cancellationToken)
6683
{
67-
if (await _unitOfWork.Repository<TExtendedAttribute>().Entities.Where(x => !x.Id.Equals(command.Id) && x.EntityId.Equals(command.EntityId))
84+
if (await _unitOfWork.Repository<TExtendedAttribute>().Entities.Where(x => !x.Id.Equals(command.Id) && x.EntityId!.Equals(command.EntityId))
6885
.AnyAsync(p => p.Key == command.Key, cancellationToken))
6986
{
7087
return await Result<TId>.FailAsync(_localizer["Extended Attribute with this Key already exists."]);

src/Application/Features/ExtendedAttributes/Queries/GetAll/GetAllExtendedAttributesResponse.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,44 @@ namespace BlazorHero.CleanArchitecture.Application.Features.ExtendedAttributes.Q
77
{
88
public class GetAllExtendedAttributesResponse<TId, TEntityId> : IEntityAuditableExtendedAttribute
99
{
10+
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
1011
public TId Id { get; set; }
12+
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
13+
14+
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
1115
public TEntityId EntityId { get; set; }
16+
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
17+
1218
public EntityExtendedAttributeType Type { get; set; }
19+
20+
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
1321
public string Key { get; set; }
22+
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
23+
1424
public string? Text { get; set; }
25+
1526
public decimal? Decimal { get; set; }
27+
1628
public DateTime? DateTime { get; set; }
29+
1730
public string? Json { get; set; }
31+
1832
public string? ExternalId { get; set; }
33+
1934
public string? Group { get; set; }
35+
2036
public string? Description { get; set; }
37+
2138
public bool IsActive { get; set; }
39+
40+
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
2241
public string CreatedBy { get; set; }
42+
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
43+
2344
public DateTime CreatedOn { get; set; }
24-
public string LastModifiedBy { get; set; }
45+
46+
public string? LastModifiedBy { get; set; }
47+
2548
public DateTime? LastModifiedOn { get; set; }
2649
}
2750
}

src/Application/Features/ExtendedAttributes/Queries/GetAllByEntityId/GetAllExtendedAttributesByEntityIdResponse.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,44 @@ namespace BlazorHero.CleanArchitecture.Application.Features.ExtendedAttributes.Q
77
{
88
public class GetAllExtendedAttributesByEntityIdResponse<TId, TEntityId> : IEntityAuditableExtendedAttribute
99
{
10+
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
1011
public TId Id { get; set; }
12+
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
13+
14+
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
1115
public TEntityId EntityId { get; set; }
16+
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
17+
1218
public EntityExtendedAttributeType Type { get; set; }
19+
20+
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
1321
public string Key { get; set; }
22+
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
23+
1424
public string? Text { get; set; }
25+
1526
public decimal? Decimal { get; set; }
27+
1628
public DateTime? DateTime { get; set; }
29+
1730
public string? Json { get; set; }
31+
1832
public string? ExternalId { get; set; }
33+
1934
public string? Group { get; set; }
35+
2036
public string? Description { get; set; }
37+
2138
public bool IsActive { get; set; }
39+
40+
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
2241
public string CreatedBy { get; set; }
42+
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
43+
2344
public DateTime CreatedOn { get; set; }
24-
public string LastModifiedBy { get; set; }
45+
46+
public string? LastModifiedBy { get; set; }
47+
2548
public DateTime? LastModifiedOn { get; set; }
2649
}
2750
}

0 commit comments

Comments
 (0)