Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
a307398
chat and user chat entities updated
kolosovpetro Mar 12, 2023
b8e8300
chat entity tests
kolosovpetro Mar 12, 2023
d0d046b
workflow fix
kolosovpetro Mar 12, 2023
895a1ba
add coverlet msbuild
kolosovpetro Mar 12, 2023
ef81709
chat image test
kolosovpetro Mar 12, 2023
5e7fa6b
chat entity validator
kolosovpetro Mar 12, 2023
dd0c106
user chat entity validator and tests
kolosovpetro Mar 12, 2023
24198ee
add logging
ketteiteki Mar 12, 2023
97b0484
Merge pull request #417 from Ketteiteki/validation-flow
kolosovpetro Mar 12, 2023
a8dffeb
login | register | change password
kolosovpetro Mar 12, 2023
ac37d7b
integration tests fix
kolosovpetro Mar 12, 2023
0926b7f
refactors in integration tests
kolosovpetro Mar 12, 2023
ad9acee
minor fixes
kolosovpetro Mar 12, 2023
b24d343
work in progress
kolosovpetro Mar 12, 2023
acd1eb7
work in progress
kolosovpetro Mar 12, 2023
5bbae46
minor cleanups
kolosovpetro Mar 12, 2023
dda1704
minor clean ups
kolosovpetro Mar 13, 2023
c641cd6
work in progress
kolosovpetro Mar 13, 2023
225ccc8
message order bugfix
kolosovpetro Mar 13, 2023
ce0f47d
typo fix in reply service
kolosovpetro Mar 13, 2023
d5dbb4f
commented code removed
kolosovpetro Mar 13, 2023
26d7572
work in progress
kolosovpetro Mar 13, 2023
c55a6b2
migrations squash
kolosovpetro Mar 13, 2023
3a336a0
domain documentation update
kolosovpetro Mar 13, 2023
785e4bb
Merge pull request #416 from MangoInstantMessenger/remove-identity
kolosovpetro Mar 13, 2023
199d6b2
chat entities moved out of folder
kolosovpetro Mar 13, 2023
629e249
user entity encapsulated
kolosovpetro Mar 13, 2023
3ec45ee
user entity validator
kolosovpetro Mar 13, 2023
4343456
user entity unit tests
kolosovpetro Mar 13, 2023
7240f81
message entity unit tests
kolosovpetro Mar 13, 2023
00b3991
work in progress
kolosovpetro Mar 13, 2023
c84e363
work in progress
kolosovpetro Mar 13, 2023
235ff30
personal information entity tests
kolosovpetro Mar 13, 2023
b84ffc5
session tests
kolosovpetro Mar 13, 2023
8b0344f
azure pipelines run unit tests
kolosovpetro Mar 13, 2023
b6b12e7
unit tests step update
kolosovpetro Mar 13, 2023
692969b
unit tests az pipelines
kolosovpetro Mar 13, 2023
6a014ae
az pipelines unit tests
kolosovpetro Mar 13, 2023
7941427
ci updates
kolosovpetro Mar 13, 2023
97ff2ef
send message in progress
kolosovpetro Mar 13, 2023
3390cbc
separate realtime controller
kolosovpetro Mar 13, 2023
e5ce82f
when new group created picture displayed ok
kolosovpetro Mar 14, 2023
f2692ac
update display name chat description
kolosovpetro Mar 14, 2023
52ee8f0
new user dummy info add | typo fix
kolosovpetro Mar 14, 2023
d10aabe
error notification service
kolosovpetro Mar 14, 2023
d142a82
work in progress
kolosovpetro Mar 14, 2023
70a2092
work in progress
kolosovpetro Mar 14, 2023
cd143f8
work in progress
kolosovpetro Mar 14, 2023
d68c9ab
clean up
kolosovpetro Mar 14, 2023
551f810
code format
kolosovpetro Mar 14, 2023
c870a31
work in progress
kolosovpetro Mar 14, 2023
69b051b
work in progress
kolosovpetro Mar 14, 2023
586080e
more default avatars added
kolosovpetro Mar 14, 2023
a2b8c3e
code cleanups
kolosovpetro Mar 14, 2023
269ff62
commented code removed
kolosovpetro Mar 14, 2023
2f099c4
Merge pull request #426 from MangoInstantMessenger/chats-component-re…
kolosovpetro Mar 14, 2023
ad40b89
realtime handlers refactors
kolosovpetro Mar 14, 2023
5fa6885
fixes issue 422
kolosovpetro Mar 14, 2023
ce5e08b
fixes 423
kolosovpetro Mar 14, 2023
8906c03
fixes 424
kolosovpetro Mar 15, 2023
6b670fb
delete and leave chat buttons
kolosovpetro Mar 15, 2023
25ce04e
leave group bugfix
kolosovpetro Mar 15, 2023
765d895
angular bump to v14
kolosovpetro Mar 15, 2023
f2f1e51
typescript version updated v4.8
kolosovpetro Mar 15, 2023
5142b95
angular bump to v15.2.2
kolosovpetro Mar 15, 2023
f0be431
Merge pull request #432 from MangoInstantMessenger/angular-bump
kolosovpetro Mar 15, 2023
ee2c95e
commented code removed | readme versions update
kolosovpetro Mar 15, 2023
c8c69ff
angular build workflow update
kolosovpetro Mar 15, 2023
335c5f9
angular workflow fix
kolosovpetro Mar 15, 2023
c274319
angular build action update
kolosovpetro Mar 15, 2023
bc8a70b
azure pipelines angular build update
kolosovpetro Mar 15, 2023
c27cf3d
azure pipelines fix
kolosovpetro Mar 15, 2023
04e46e5
azure pipelines build
kolosovpetro Mar 15, 2023
25a1fae
ng build warning fix | redundant assets removed
kolosovpetro Mar 15, 2023
afec9af
fixes 431
kolosovpetro Mar 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@ root = true
# noinspection EditorConfigKeyCorrectness
[*.cs]
dotnet_diagnostic.CA1824.severity = warning

# code format
dotnet_diagnostic.IDE0005.severity = warning

dotnet_diagnostic.CA1707.severity = warning
dotnet_diagnostic.CA1822.severity = warning
dotnet_diagnostic.CA1416.severity = warning
dotnet_diagnostic.IDE0072.severity = warning
dotnet_diagnostic.IDE0270.severity = warning
dotnet_diagnostic.CA1825.severity = warning

# explicit type
dotnet_diagnostic.IDE0007.severity = warning

# populate switch
dotnet_diagnostic.IDE0010.severity = warning
Expand Down
33 changes: 25 additions & 8 deletions .github/workflows/build-angular.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ on:
jobs:
build-angular:
name: Build Angular
runs-on: 'ubuntu-latest'
runs-on: ${{ matrix.environment }}
strategy:
matrix:
environment:
- ubuntu-latest
- windows-latest

steps:
- name: 'Checkout'
Expand All @@ -26,17 +31,29 @@ jobs:
node-version: '16.x'
cache: 'npm'
cache-dependency-path: 'MangoAPI.Client/package-lock.json'

- name: Npm ci

- name: 'Print current node version'
run: node -v

- name: 'Print current npm version'
run: npm -v

- name: 'Npm ci'
working-directory: './MangoAPI.Client'
run: npm ci

- name: Npm build prod

- name: 'Install angular cli 15.2.2'
run: npm install -g @angular/cli@15.2.2

- name: 'Print current angular cli version'
run: ng version

- name: 'Angular build'
working-directory: './MangoAPI.Client'
run: npm run build --production
run: ng build

- name: Drop artifact
- name: 'Drop artifact'
uses: actions/upload-artifact@v3
with:
name: 'angular-build'
name: 'angular-build-${{ matrix.environment }}'
path: './MangoAPI.Presentation/wwwroot'
10 changes: 10 additions & 0 deletions .github/workflows/build-test-coverage-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ jobs:
- name: Build .NET Project
run: |
dotnet build --no-restore /p:ContinuousIntegrationBuild=true --configuration Release

- name: Run unit tests
run: |
dotnet test MangoAPI.UnitTests/MangoAPI.UnitTests.csproj --configuration Release --no-build
env:
CollectCoverage: true
CoverletOutputFormat: lcov
ThresholdStat: total
ThresholdType: Line
CoverletOutput: TestResults/

- name: Install and Run Azurite
shell: bash
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ AuthWorkingDirectory/
CngWorkingDirectory/
OpenSslWorkingDirectory/
wwwroot/
dist/

# sonar scanner
MangoAPI.Client/.scannerwork/*
Expand Down
10 changes: 10 additions & 0 deletions MangoAPI.Application/Interfaces/IPasswordService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using MangoAPI.Domain.Entities;

namespace MangoAPI.Application.Interfaces;

public interface IPasswordService
{
bool ValidateCredentials(UserEntity user, string currentPassword);

UserEntity ChangePassword(UserEntity user, string newPassword);
}
10 changes: 0 additions & 10 deletions MangoAPI.Application/Interfaces/ISignInManagerService.cs

This file was deleted.

16 changes: 0 additions & 16 deletions MangoAPI.Application/Interfaces/IUserManagerService.cs

This file was deleted.

2 changes: 1 addition & 1 deletion MangoAPI.Application/MangoAPI.Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MangoAPI.Domain\MangoAPI.Domain.csproj"/>
<ProjectReference Include="..\MangoAPI.Domain\MangoAPI.Domain.csproj" />
</ItemGroup>
</Project>
7 changes: 6 additions & 1 deletion MangoAPI.Application/Services/AvatarService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ public class AvatarService : IAvatarService
"animetyanpic14.jpg",
"animetyanpic15.jpg",
"animetyanpic16.jpg",
"animetyanpic17.jpg"
"animetyanpic17.jpg",
"animetyanpic18.jpg",
"animetyanpic19.jpg",
"animetyanpic20.jpg",
"animetyanpic21.jpg",
"animetyanpic22.jpg",
};

public string GetRandomAvatar()
Expand Down
2 changes: 1 addition & 1 deletion MangoAPI.Application/Services/CorrelationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public Guid GetUserId()
{
var context = httpContextAccessor.HttpContext;

var correlationContextUserId = context.User.FindFirstValue(JwtRegisteredClaimNames.Jti);
var correlationContextUserId = context?.User.FindFirstValue(JwtRegisteredClaimNames.Jti);

var parsed = Guid.TryParse(correlationContextUserId, out var parsedUserId);

Expand Down
2 changes: 1 addition & 1 deletion MangoAPI.Application/Services/JwtGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private string GenerateJwtToken(UserEntity userEntity, int lifetimeMinutes)
var claims = new List<Claim>
{
new Claim(JwtRegisteredClaimNames.Jti, userEntity.Id.ToString()),
new Claim(JwtRegisteredClaimNames.Name, userEntity.UserName),
new Claim(JwtRegisteredClaimNames.Name, userEntity.Username),
};

var credentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
Expand Down
14 changes: 0 additions & 14 deletions MangoAPI.Application/Services/PasswordHashService.cs

This file was deleted.

41 changes: 41 additions & 0 deletions MangoAPI.Application/Services/PasswordService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using MangoAPI.Application.Interfaces;
using MangoAPI.Domain.Entities;
using System.Security.Cryptography;
using System.Text;

namespace MangoAPI.Application.Services;

public class PasswordService : IPasswordService
{
public bool ValidateCredentials(UserEntity user, string currentPassword)
{
var hmac = new HMACSHA512(user.PasswordSalt);

var computedHash = hmac.ComputeHash(Encoding.UTF8.GetBytes(currentPassword));

var result = true;

for (var i = 0; i < computedHash.Length; i++)
{
if (computedHash[i] != user.PasswordHash[i])
{
result = false;
}
}

return result;
}

public UserEntity ChangePassword(UserEntity user, string newPassword)
{
var hmac = new HMACSHA512();

var passwordSalt = hmac.Key;

var passwordHash = hmac.ComputeHash(Encoding.UTF8.GetBytes(newPassword));

user.UpdatePassword(passwordHash, passwordSalt);

return user;
}
}
26 changes: 0 additions & 26 deletions MangoAPI.Application/Services/SignInManagerService.cs

This file was deleted.

44 changes: 0 additions & 44 deletions MangoAPI.Application/Services/UserManagerService.cs

This file was deleted.

16 changes: 13 additions & 3 deletions MangoAPI.BusinessLogic/ApiCommands/CommonFileValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ public class CommonFileValidator : AbstractValidator<IFormFile>
{
private readonly List<string> allowedExtensions = new()
{
"jpg", "JPG", "txt", "TXT", "pdf", "PDF", "png", "PNG", "jpeg", "JPEG",
"jpg",
"JPG",
"txt",
"TXT",
"pdf",
"PDF",
"png",
"PNG",
"jpeg",
"JPEG",
};

public CommonFileValidator()
Expand All @@ -25,12 +34,13 @@ public CommonFileValidator()
.NotEmpty()
.Must(HaveAllowedExtension)
.WithMessage(
$"File extension is not allowed. Allowed extensions: {string.Join(", ", allowedExtensions)}.");
$"File extension is not allowed. Allowed extensions: {string.Join(", ", allowedExtensions)}.")
.Length(1, 50);
}

private bool HaveAllowedExtension(string str)
{
var extension = str.Split('.').Last();
return allowedExtensions.Contains(extension);
}
}
}
2 changes: 1 addition & 1 deletion MangoAPI.BusinessLogic/ApiCommands/CommonImageValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ private bool HaveAllowedExtension(string str)
var extension = str.Split('.').Last();
return allowedExtensions.Contains(extension);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public async Task<Result<ResponseBase>> Handle(
return responseFactory.ConflictResponse(errorMessage, details);
}

chat.IsArchived = !chat.IsArchived;
chat.Archive();

dbContext.UserChats.Update(chat);

Expand Down
Loading