-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ed39c3
commit e320a79
Showing
189 changed files
with
2,593 additions
and
2,581 deletions.
There are no files selected for viewing
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
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
2 changes: 1 addition & 1 deletion
2
....Application/Common/Messaging/ICommand.cs → src/Mint.Application/Interfaces/ICommand.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
2 changes: 1 addition & 1 deletion
2
...ture/Services/Interfaces/IEmailService.cs → ...t.Application/Interfaces/IEmailService.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
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 System.Linq.Expressions; | ||
|
||
namespace Mint.Application.Interfaces; | ||
|
||
/// <summary> | ||
/// Общий репозиторий для чтения сущности типа <typeparamref name="T"></typeparamref>. | ||
/// </summary> | ||
/// <typeparam name="T">Тип сущности, с которым работает данный репозиторий.</typeparam> | ||
public interface IGenericReadRepository<T> where T : class | ||
{ | ||
Task<List<T>> GetAllAsync(CancellationToken cancellationToken = default); | ||
|
||
Task<T?> FirstOrDefaultAsync(Expression<Func<T, bool>> func, CancellationToken cancellationToken = default); | ||
|
||
Task<T?> SingleOrDefaultAsync(Expression<Func<T, bool>> func, CancellationToken cancellationToken = default); | ||
|
||
Task<int> CountAsync(CancellationToken cancellationToken = default); | ||
|
||
Task<int> CountAsync(Expression<Func<T, bool>> func, CancellationToken cancellationToken = default); | ||
|
||
Task<bool> AnyAsync(Expression<Func<T, bool>> func, CancellationToken cancellationToken = default); | ||
} |
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,44 @@ | ||
namespace Mint.Application.Interfaces; | ||
|
||
/// <summary> | ||
/// Общий репозиторий для сущности типа <typeparamref name="T"></typeparamref>. | ||
/// </summary> | ||
/// <typeparam name="T">Тип сущности, с которым работает данный репозиторий.</typeparam> | ||
public interface IGenericRepository<T> : IGenericReadRepository<T> where T : class | ||
{ | ||
/// <summary> | ||
/// Добавляет указанную сущность в базу данных. | ||
/// </summary> | ||
/// <param name="entity">Добавляемая сущность.</param> | ||
Task AddAsync(T entity, CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Добавляет указанные сущности в базу данных. | ||
/// </summary> | ||
/// <param name="entities">Добавляемые сущности.</param> | ||
Task AddRangeAsync(IEnumerable<T> entities, CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Обновляет указанную сущность в базе данных. | ||
/// </summary> | ||
/// <param name="entity">Обновляемая сущность.</param> | ||
void Update(T entity); | ||
|
||
/// <summary> | ||
/// Обновляет указанные сущности в базе данных. | ||
/// </summary> | ||
/// <param name="entities">Обновляемые сущности.</param> | ||
Task UpdateRange(IEnumerable<T> entities, CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Удаляет указанную сущность из базы данных. | ||
/// </summary> | ||
/// <param name="entity">Удаляемая сущность.</param> | ||
void Remove(T entity); | ||
|
||
/// <summary> | ||
/// Удаляет указанные сущности из базы данных. | ||
/// </summary> | ||
/// <param name="entities">Удаляемые сущности.</param> | ||
Task RemoveRangeAsync(IEnumerable<T> entities, CancellationToken cancellationToken = default); | ||
} |
2 changes: 1 addition & 1 deletion
2
...ucture/Services/Interfaces/IJwtService.cs → ...int.Application/Interfaces/IJwtService.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
2 changes: 1 addition & 1 deletion
2
...in.Application/Common/Messaging/IQuery.cs → src/Mint.Application/Interfaces/IQuery.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
106 changes: 106 additions & 0 deletions
106
src/Mint.Application/Interfaces/IStorageCloudService.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,106 @@ | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace Mint.Application.Interfaces; | ||
|
||
/// <summary> | ||
/// Service for interacting with MinIO storage service. | ||
/// </summary> | ||
public interface IStorageCloudService | ||
{ | ||
/// <summary> | ||
/// Retrieves a pre-signed URL for downloading a file from the specified bucket. | ||
/// </summary> | ||
/// <param name="name"></param> | ||
/// <param name="bucket"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
Task<string?> GetFileLinkAsync(string name, string bucket, CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Retrieves an array of pre-signed URLs for downloading multiple files from the specified bucket. | ||
/// </summary> | ||
/// <param name="names"></param> | ||
/// <param name="bucket"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
Task<string[]> GetFilesLinkAsync(string[] names, string bucket, CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Creates a new bucket with the specified name | ||
/// </summary> | ||
/// <param name="bucket"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
Task<bool> CreateBucketAsync(string bucket, CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Uploads a file to the specified bucket. | ||
/// </summary> | ||
/// <param name="file"></param> | ||
/// <param name="name"></param> | ||
/// <param name="bucket"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
Task<string> UploadFileAsync(IFormFile file, string name, string bucket, CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Uploads a file from the provided stream. | ||
/// </summary> | ||
/// <param name="stream"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
Task<string> UploadFileAsync(Stream stream, CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Uploads a file from the provided stream. | ||
/// </summary> | ||
/// <param name="file"></param> | ||
/// <param name="currentFileName"></param> | ||
/// <param name="newFileName"></param> | ||
/// <param name="bucket"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
Task<string> UpdateFileAsync(IFormFile file, string currentFileName, string newFileName, string bucket, CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Deletes a file from the specified bucket. | ||
/// </summary> | ||
/// <param name="name"></param> | ||
/// <param name="bucket"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
Task<bool> DeleteFileAsync(string name, string bucket, CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Deletes multiple files from their respective buckets. | ||
/// </summary> | ||
/// <param name="names"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
Task<bool> DeleteFilesAsync(string[] names, CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Deletes a bucket with the specified name. | ||
/// </summary> | ||
/// <param name="name"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
Task<bool> DeleteBucketAsync(string name, CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Checks if a file with the specified name exists. | ||
/// </summary> | ||
/// <param name="bucket"></param> | ||
/// <param name="name"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
Task<bool> IsFileExists(string bucket, string name, CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Checks if a bucket with the specified name exists. | ||
/// </summary> | ||
/// <param name="bucket"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
Task<bool> IsBucketExists(string bucket, CancellationToken cancellationToken = default); | ||
} |
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,21 @@ | ||
namespace Mint.Application.Interfaces; | ||
|
||
/// <summary> | ||
/// Представляет абстракцию над транзакцией базы данных. | ||
/// </summary> | ||
public interface ITransaction | ||
{ | ||
/// <summary> | ||
/// Завершает транзакцию с успехом. | ||
/// </summary> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
Task CommitAsync(CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Откатывает изменения транзакции. | ||
/// </summary> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
Task RollbackAsync(CancellationToken cancellationToken = default); | ||
} |
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,21 @@ | ||
namespace Mint.Application.Interfaces; | ||
|
||
/// <summary> | ||
/// Единица работы с базой данных Mint. | ||
/// </summary> | ||
public interface IUnitOfWork | ||
{ | ||
/// <summary> | ||
/// Асинхронно создает транзакцию базы данных. | ||
/// </summary> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns>Объект представляющий созданную транзакцию <see cref="ITransaction"/>.</returns> | ||
Task<ITransaction> BeginTransactionAsync(CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Сохраняет изменения. | ||
/// </summary> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns>Количество измененных строк в базе данных.</returns> | ||
Task<int> SaveChangesAsync(CancellationToken cancellationToken = default); | ||
} |
2 changes: 1 addition & 1 deletion
2
...min.Application/Common/LoggingBehavior.cs → src/Mint.Application/LoggingBehavior.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
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,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="MediatR" Version="12.2.0" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="3.1.32" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Mint.Domain\Mint.Domain.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.