-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Mstaheri/develop
Develop
- Loading branch information
Showing
47 changed files
with
7,144 additions
and
134 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,45 @@ | ||
name: dotnet package | ||
name: Mstaheri Development pipeline | ||
|
||
on: [push] | ||
on: | ||
push: | ||
branches: ["develop"] | ||
pull_request: | ||
branches: ["develop"] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
dotnet-version: [ '3.1.x', '6.0.x' ] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup dotnet ${{ matrix.dotnet-version }} | ||
- uses: actions/checkout@v3 | ||
|
||
- name: setup .Net | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: ${{ matrix.dotnet-version }} | ||
# You can test your matrix by printing the current dotnet version | ||
- name: Display dotnet version | ||
run: dotnet --version | ||
dotnet-version: 7.0.x | ||
|
||
- name: Restore Dependency | ||
run: dotnet restore MSTSandogh.sln | ||
|
||
- name: Build | ||
run: dotnet build MSTSandogh.sln --no-restore | ||
|
||
- name: Test | ||
run: dotnet test MSTSandogh.sln --no-build --verbosity normal | ||
|
||
- name: Publish | ||
run: dotnet publish MSTSandogh.sln -c release --output ./Release | ||
|
||
- name: App Setting Variable | ||
uses: microsoft/variable-substitution@v1 | ||
with: | ||
files: './Release/appsettings.json' | ||
env: | ||
ConnectionStrings.sqlServer: ${{secrets.CONNECTION_STRING}} | ||
|
||
- name: FTP Deploy | ||
uses: SamKirkland/FTP-Deploy-Action@v4.3.4 | ||
with: | ||
server: ${{secrets.ftp_server}} | ||
username: ${{secrets.ftp_user}} | ||
password: ${{secrets.ftp_password}} | ||
local-dir: ./Release/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
Application/Services/ChatRoom/Commands/AddChatRoom/AddChatRoomCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Domain.Exceptions; | ||
using MediatR; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Application.Services.ChatRoom.Commands.AddChatRoom | ||
{ | ||
public record AddChatRoomCommand : IRequest<OperationResult<Guid>> | ||
{ | ||
public required string ConnectionId { get; init; } | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
Application/Services/ChatRoom/Commands/AddChatRoom/AddChatRoomCommandHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using Application.Services.Loan.Commands.AddLoan; | ||
using Application.UnitOfWork; | ||
using Domain.Entity; | ||
using Domain.Exceptions; | ||
using Domain.IRepositories; | ||
using Glimpse.Core.Extensibility; | ||
using MediatR; | ||
using Microsoft.Extensions.Logging; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Application.Services.ChatRoom.Commands.AddChatRoom | ||
{ | ||
public class AddChatRoomCommandHandler | ||
: IRequestHandler<AddChatRoomCommand, OperationResult<Guid>> | ||
{ | ||
public AddChatRoomCommandHandler(IUnitOfWork unitOfWork, | ||
IChatRoomRepositorie chatRoomRepositorie, | ||
ILogger<AddChatRoomCommandHandler> logger) | ||
{ | ||
_unitOfWork = unitOfWork; | ||
_chatRoomRepositorie = chatRoomRepositorie; | ||
_logger = logger; | ||
} | ||
private readonly IUnitOfWork _unitOfWork; | ||
private readonly IChatRoomRepositorie _chatRoomRepositorie; | ||
private readonly ILogger<AddChatRoomCommandHandler> _logger; | ||
public async Task<OperationResult<Guid>> Handle(AddChatRoomCommand request, CancellationToken cancellationToken) | ||
{ | ||
try | ||
{ | ||
var chatRomm = new Domain.Entity.ChatRoom(request.ConnectionId); | ||
await _chatRoomRepositorie.AddAsync(chatRomm); | ||
await _unitOfWork.SaveChangesAsync(cancellationToken); | ||
|
||
string message = string.Format(ConstMessages.Successfully | ||
, chatRomm.ConnectionId | ||
, nameof(AddChatRoomCommandHandler)); | ||
_logger.LogInformation(message); | ||
return new OperationResult<Guid>(true, null , chatRomm.Id); | ||
} | ||
catch (Exception ex) | ||
{ | ||
_logger.LogError(ex, ex.Message); | ||
return new OperationResult<Guid>(false, ex.Message , Guid.Empty); | ||
} | ||
|
||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
Application/Services/ChatRoom/Commands/AddChatRoom/AddChatRoomCommandValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Application.Services.Loan.Commands.AddLoan; | ||
using Domain.Exceptions; | ||
using FluentValidation; | ||
using FluentValidation.Results; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Application.Services.ChatRoom.Commands.AddChatRoom | ||
{ | ||
public class AddChatRoomCommandValidator : AbstractValidator<AddChatRoomCommand> | ||
{ | ||
public AddChatRoomCommandValidator() | ||
{ | ||
RuleFor(p => p.ConnectionId) | ||
.NotNull().WithMessage(string.Format(ConstMessages.IsNull, "ConnectionId")) | ||
.MaximumLength(23).WithMessage(string.Format(ConstMessages.MaximumLength, "ConnectionId", "23")); | ||
} | ||
|
||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...ion/Services/ChatRoom/Queries/GetChatRoomByConnectionId/GetChatRoomByConnectionIdQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using MediatR; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Application.Services.ChatRoom.Queries.GetChatRoomByConnectionId | ||
{ | ||
public record GetChatRoomByConnectionIdQuery : IRequest<Guid> | ||
{ | ||
public required string ConnectionId { get; init; } | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...vices/ChatRoom/Queries/GetChatRoomByConnectionId/GetChatRoomByConnectionIdQueryHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using Application.Services.Loan.Queries.GetAllLoan; | ||
using Application.Services.Loan.Queries.GetByCodeLoan; | ||
using Domain.Exceptions; | ||
using Domain.IRepositories; | ||
using MediatR; | ||
using Microsoft.Extensions.Logging; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Application.Services.ChatRoom.Queries.GetChatRoomByConnectionId | ||
{ | ||
public class GetChatRoomByConnectionIdQueryHandler : | ||
IRequestHandler<GetChatRoomByConnectionIdQuery, Guid> | ||
{ | ||
private readonly IChatRoomRepositorie _chatRoomRepositorie; | ||
private readonly ILogger<GetChatRoomByConnectionIdQueryHandler> _logger; | ||
public GetChatRoomByConnectionIdQueryHandler(IChatRoomRepositorie chatRoomRepositorie | ||
, ILogger<GetChatRoomByConnectionIdQueryHandler> logger) | ||
{ | ||
_chatRoomRepositorie = chatRoomRepositorie; | ||
_logger = logger; | ||
} | ||
public async Task<Guid> Handle(GetChatRoomByConnectionIdQuery request, CancellationToken cancellationToken) | ||
{ | ||
try | ||
{ | ||
var result = await _chatRoomRepositorie.GetChatRoomByConnectionId | ||
(request.ConnectionId, cancellationToken); | ||
string message = string.Format(ConstMessages.Successfully | ||
, nameof(GetChatRoomByConnectionIdQueryHandler) | ||
, ""); | ||
_logger.LogInformation(message); | ||
if (result != null) | ||
{ | ||
return result.Id; | ||
} | ||
else | ||
{ | ||
return Guid.Empty; | ||
} | ||
|
||
} | ||
catch (Exception ex) | ||
{ | ||
_logger.LogError(ex, ex.Message); | ||
return Guid.Empty; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Domain.Attributes; | ||
using Domain.Common; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Domain.Entity | ||
{ | ||
[AudiTable] | ||
public class ChatRoom : IEntity | ||
{ | ||
public ChatRoom(string connectionId) | ||
{ | ||
Id = Guid.NewGuid(); | ||
ConnectionId = connectionId; | ||
} | ||
public Guid Id { get; private set; } | ||
public string ConnectionId { get; private set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Domain.Entity; | ||
using Domain.Exceptions; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Domain.IRepositories | ||
{ | ||
public interface IChatRoomRepositorie | ||
{ | ||
ValueTask AddAsync(ChatRoom chatRoom); | ||
Task<ChatRoom> GetChatRoomByConnectionId(string connectionId , CancellationToken cancellationToken); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.