Структура

This commit is contained in:
Халимов Рустам
2026-03-30 00:09:12 +03:00
parent 0209802e9e
commit 89b2eeea6c
124 changed files with 623 additions and 599 deletions
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
namespace Knot.Modules.Auth.Contracts.Application.Abstractions;
namespace Knot.Contracts.Auth.Application.Abstractions;
public interface IAuthDbContext
{
@@ -1,7 +1,7 @@
using Knot.Modules.Auth.Contracts.Domain;
using Knot.Contracts.Auth.Domain;
using Knot.Shared.Kernel;
namespace Knot.Modules.Auth.Contracts.Application.Abstractions;
namespace Knot.Contracts.Auth.Application.Abstractions;
public interface IAuthUnitOfWork : IUnitOfWork
{
@@ -1,8 +1,9 @@
namespace Knot.Modules.Auth.Contracts.Application.Abstractions;
namespace Knot.Contracts.Auth.Application.Abstractions;
public interface IJwtTokenProvider
{
string GenerateAccessToken(Guid userId, string username);
string GenerateRefreshToken();
string Generate(Guid userId, string username, string displayName, string? avatar);
string Generate(Domain.UserContract user);
}
@@ -1,6 +1,6 @@
using Knot.Shared.Kernel;
using Knot.Shared.Kernel;
namespace Knot.Modules.Auth.Contracts.Application.Auth.DTOs;
namespace Knot.Contracts.Auth.Application.Auth.DTOs;
public static class AuthErrors
{
@@ -1,4 +1,4 @@
namespace Knot.Modules.Auth.Contracts.Application.Auth.DTOs;
namespace Knot.Contracts.Auth.Application.Auth.DTOs;
public class AuthResponseDto
{
@@ -0,0 +1,6 @@
using Knot.Contracts.Auth.Domain;
using MediatR;
namespace Knot.Contracts.Auth.Application.Users.GetMe;
public record GetMeQuery() : IRequest<UserContract>;
@@ -1,8 +1,8 @@
using Knot.Modules.Auth.Contracts.Application.Auth.DTOs;
using Knot.Contracts.Auth.Application.Auth.DTOs;
using Knot.Shared.Kernel;
using MediatR;
namespace Knot.Modules.Auth.Contracts.Application.Users.Login;
namespace Knot.Contracts.Auth.Application.Users.Login;
public record LoginUserCommand(
string Username,
@@ -0,0 +1,14 @@
using Knot.Contracts.Auth.Application.Auth.DTOs;
using Knot.Contracts.Auth.Domain;
using Knot.Shared.Kernel;
using MediatR;
namespace Knot.Contracts.Auth.Application.Users.Register;
public record RegisterUserCommand(
string Username,
string Password,
string DisplayName,
string? Email,
string? Bio
) : IRequest<Result<AuthResponseDto>>;
@@ -1,4 +1,4 @@
namespace Knot.Modules.Auth.Contracts.Domain;
namespace Knot.Contracts.Auth.Domain;
public interface IUserRepository
{
@@ -1,4 +1,4 @@
namespace Knot.Modules.Auth.Contracts.Domain;
namespace Knot.Contracts.Auth.Domain;
public class UserContract
{
@@ -12,6 +12,7 @@
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.4" />
</ItemGroup>
</Project>
@@ -12,6 +12,7 @@
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.4" />
</ItemGroup>
</Project>
@@ -12,6 +12,7 @@
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.4" />
</ItemGroup>
</Project>
@@ -12,6 +12,7 @@
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.4" />
</ItemGroup>
</Project>
@@ -1,9 +0,0 @@
using Microsoft.EntityFrameworkCore;
namespace Knot.Modules.Auth.Contracts.Application.Abstractions;
public interface IIdentityDbContext
{
DbSet<T> Set<T>() where T : class;
Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
}
@@ -1,9 +0,0 @@
using Knot.Modules.Auth.Contracts.Domain;
using Knot.Shared.Kernel;
namespace Knot.Modules.Auth.Contracts.Application.Abstractions;
public interface IIdentityUnitOfWork : IUnitOfWork
{
IUserRepository UserRepository { get; }
}
@@ -1,6 +0,0 @@
using Knot.Modules.Auth.Contracts.Domain;
using MediatR;
namespace Knot.Modules.Auth.Contracts.Application.Users.GetMe;
public record GetMeQuery() : IRequest<UserContract>;
@@ -1,14 +0,0 @@
using Knot.Modules.Auth.Contracts.Application.Auth.DTOs;
using Knot.Modules.Auth.Contracts.Domain;
using Knot.Shared.Kernel;
using MediatR;
namespace Knot.Modules.Auth.Contracts.Application.Users.Register;
public record RegisterUserCommand(
string Username,
string Password,
string DisplayName,
string? PhoneNumber,
bool IsBot = false
) : IRequest<Result<AuthResponseDto>>;
@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\Knot.Shared.Kernel\Knot.Shared.Kernel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
</ItemGroup>
</Project>
@@ -1,6 +0,0 @@
using Knot.Modules.Profiles.Contracts.Application.DTOs;
using MediatR;
namespace Knot.Modules.Profiles.Contracts.Application.Profiles.Search;
public record SearchProfilesQuery(string Query, int Limit = 20) : IRequest<List<UserProfileDto>>;
@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\Knot.Shared.Kernel\Knot.Shared.Kernel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
</ItemGroup>
</Project>
@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\Knot.Shared.Kernel\Knot.Shared.Kernel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
</ItemGroup>
</Project>
@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\Knot.Shared.Kernel\Knot.Shared.Kernel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
</ItemGroup>
</Project>
@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\Knot.Shared.Kernel\Knot.Shared.Kernel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
</ItemGroup>
</Project>
@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\Knot.Shared.Kernel\Knot.Shared.Kernel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
</ItemGroup>
</Project>
@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\Knot.Shared.Kernel\Knot.Shared.Kernel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
</ItemGroup>
</Project>
@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\Knot.Shared.Kernel\Knot.Shared.Kernel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
</ItemGroup>
</Project>
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\Knot.Shared.Kernel\Knot.Shared.Kernel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.4" />
</ItemGroup>
</Project>
@@ -1,6 +1,6 @@
using Knot.Shared.Kernel;
using Knot.Shared.Kernel;
namespace Knot.Modules.Profiles.Contracts.Application.DTOs;
namespace Knot.Contracts.Profiles.Application.DTOs;
public static class ProfilesErrors
{
@@ -1,6 +1,6 @@
using MediatR;
using MediatR;
namespace Knot.Modules.Profiles.Contracts.Application.DTOs;
namespace Knot.Contracts.Profiles.Application.DTOs;
public record SearchProfilesRequest(string Query, int Limit = 20) : IRequest<List<UserProfileDto>>;
@@ -1,4 +1,4 @@
namespace Knot.Modules.Profiles.Contracts.Application.DTOs;
namespace Knot.Contracts.Profiles.Application.DTOs;
public class UserProfileDto
{
@@ -1,7 +1,7 @@
using Knot.Shared.Kernel;
using Knot.Shared.Kernel;
using MediatR;
namespace Knot.Modules.Profiles.Contracts.Application.Profiles.Avatar;
namespace Knot.Contracts.Profiles.Application.Profiles.Avatar;
public record UploadAvatarCommand(Stream Stream, string FileName) : IRequest<Result<string>>;
@@ -1,8 +1,8 @@
using Knot.Modules.Profiles.Contracts.Application.DTOs;
using Knot.Contracts.Profiles.Application.DTOs;
using Knot.Shared.Kernel;
using MediatR;
namespace Knot.Modules.Profiles.Contracts.Application.Profiles.GetUser;
namespace Knot.Contracts.Profiles.Application.Profiles.GetUser;
public record GetProfileQuery(Guid UserId) : IRequest<Result<UserProfileDto>>;
@@ -0,0 +1,6 @@
using Knot.Contracts.Profiles.Application.DTOs;
using MediatR;
namespace Knot.Contracts.Profiles.Application.Profiles.Search;
public record SearchProfilesQuery(string Query, int Limit = 20) : IRequest<List<UserProfileDto>>;
@@ -1,8 +1,8 @@
using Knot.Modules.Profiles.Contracts.Application.DTOs;
using Knot.Contracts.Profiles.Application.DTOs;
using Knot.Shared.Kernel;
using MediatR;
namespace Knot.Modules.Profiles.Contracts.Application.Profiles.UpdateProfile;
namespace Knot.Contracts.Profiles.Application.Profiles.UpdateProfile;
public record UpdateProfileCommand(
string? DisplayName,
@@ -1,8 +1,8 @@
using Knot.Modules.Profiles.Contracts.Application.DTOs;
using Knot.Contracts.Profiles.Application.DTOs;
using Knot.Shared.Kernel;
using MediatR;
namespace Knot.Modules.Profiles.Contracts.Application.Profiles.UpdateSettings;
namespace Knot.Contracts.Profiles.Application.Profiles.UpdateSettings;
public record UpdateSettingsCommand(
bool? ShowLastSeen,
@@ -1,6 +1,6 @@
using Knot.Shared.Kernel.Storage;
using Knot.Shared.Kernel.Storage;
namespace Knot.Modules.Profiles.Contracts.Domain;
namespace Knot.Contracts.Profiles.Domain;
public interface IAvatarStorageService
{
@@ -1,7 +1,7 @@
using Knot.Modules.Profiles.Contracts.Application.DTOs;
using Knot.Contracts.Profiles.Application.DTOs;
using Knot.Shared.Kernel;
namespace Knot.Modules.Profiles.Contracts.Domain;
namespace Knot.Contracts.Profiles.Domain;
public interface IProfileRepository
{
@@ -1,6 +1,6 @@
using Knot.Shared.Kernel;
using Knot.Shared.Kernel;
namespace Knot.Modules.Profiles.Contracts.Domain;
namespace Knot.Contracts.Profiles.Domain;
public interface IProfilesUnitOfWork : IUnitOfWork
{
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\Knot.Shared.Kernel\Knot.Shared.Kernel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.4" />
</ItemGroup>
</Project>
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\Knot.Shared.Kernel\Knot.Shared.Kernel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.4" />
</ItemGroup>
</Project>
@@ -1,6 +1,6 @@
using Knot.Modules.Settings.Contracts.Application.DTOs;
using Knot.Contracts.Settings.Application.DTOs;
namespace Knot.Modules.Settings.Contracts.Application.Abstractions;
namespace Knot.Contracts.Settings.Application.Abstractions;
public interface ISettingsService
{
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.Collections.Generic;
namespace Knot.Modules.Settings.Contracts.Application.DTOs;
namespace Knot.Contracts.Settings.Application.DTOs;
public class SystemConfig
{
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\Knot.Shared.Kernel\Knot.Shared.Kernel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.4" />
</ItemGroup>
</Project>
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\Knot.Shared.Kernel\Knot.Shared.Kernel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.4" />
</ItemGroup>
</Project>
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\Knot.Shared.Kernel\Knot.Shared.Kernel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.4" />
</ItemGroup>
</Project>
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\Knot.Shared.Kernel\Knot.Shared.Kernel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.4" />
</ItemGroup>
</Project>
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Shared\Knot.Shared.Kernel\Knot.Shared.Kernel.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.4" />
</ItemGroup>
</Project>