Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 Honamic.Framework.sln
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "03.Facade", "03.Facade", "{
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Honamic.IdentityPlus.Facade", "src\IdentityPlus\Facade\Honamic.IdentityPlus.Facade.csproj", "{D7D9D8C5-EBDF-480C-A693-E6ED04143FFA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Honamic.Framework.Applications.Abstractions", "src\Core\Applications.Abstractions\Honamic.Framework.Applications.Abstractions.csproj", "{29C37841-0CA2-9A52-9A08-90CA63C5E63A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -299,6 +301,10 @@ Global
{D7D9D8C5-EBDF-480C-A693-E6ED04143FFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7D9D8C5-EBDF-480C-A693-E6ED04143FFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7D9D8C5-EBDF-480C-A693-E6ED04143FFA}.Release|Any CPU.Build.0 = Release|Any CPU
{29C37841-0CA2-9A52-9A08-90CA63C5E63A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{29C37841-0CA2-9A52-9A08-90CA63C5E63A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{29C37841-0CA2-9A52-9A08-90CA63C5E63A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{29C37841-0CA2-9A52-9A08-90CA63C5E63A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -365,6 +371,7 @@ Global
{8F5EAEEB-467C-412D-B131-D7469C70D375} = {3F098285-E155-4D9A-9371-E7C4CAEA17F3}
{82C3E682-28F0-4F65-93F1-A646085A9198} = {7ACD81EB-9F97-44A5-B91B-2E12C5F45607}
{D7D9D8C5-EBDF-480C-A693-E6ED04143FFA} = {82C3E682-28F0-4F65-93F1-A646085A9198}
{29C37841-0CA2-9A52-9A08-90CA63C5E63A} = {BC728FCA-02C3-4522-A7EB-7403B8674BBA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E15D83FC-8F5C-4D9C-9DCD-D114F5609922}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

<ItemGroup>

<ProjectReference Include="..\..\..\src\Core\Applications.Abstractions\Honamic.Framework.Applications.Abstractions.csproj" />

<ProjectReference Include="..\..\..\src\Core\Commands.Abstractions\Honamic.Framework.Commands.Abstractions.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@

using Honamic.Framework.Applications.Results;
using Honamic.Framework.Commands;

namespace Honamic.Todo.Application.TodoItems.Commands;
public record CreateTodoItemCommand(string title, string content, List<string> tags) : ICommand;




public record CreateTodoItem2Command(string title, string content, List<string> tags)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

بهتره در یک فایل جدا نگهداری شود

: ICommand<Result<CreateTodoItem2ResultCommand>>;



public class CreateTodoItem2ResultCommand
{
public long Id { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Honamic.Framework.Tools.IdGenerators;
using Honamic.Todo.Application.TodoItems.EventHandlers;
using Honamic.IdentityPlus.Domain.Users;
using Honamic.Framework.Applications.Results;

namespace Honamic.Todo.Application.Extensions;

Expand All @@ -25,6 +26,11 @@ private static void AddCommandHandlers(this IServiceCollection services)
{
services.AddCommandHandler<DeleteTodoItemCommand, DeleteTodoItemCommandHandler>();
services.AddCommandHandler<CreateTodoItemCommand, CreateTodoItemCommandHandler>();
services.AddCommandHandler<
CreateTodoItem2Command,
CreateTodoItem2CommandHandler,
Result<CreateTodoItem2ResultCommand>>();

services.AddCommandHandler<MakeCompletedTodoItemCommand, MakeCompletedTodoItemCommandHandler>();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Honamic.Framework.Applications.Results;
using Honamic.Framework.Commands;
using Honamic.Framework.Domain;
using Honamic.Todo.Application.TodoItems.Commands;
using Honamic.Todo.Domain.TodoItems;

namespace Honamic.Todo.Application.TodoItems.CommandHandlers;
internal class CreateTodoItem2CommandHandler :
ICommandHandler<CreateTodoItem2Command, Result<CreateTodoItem2ResultCommand>>
{
private readonly ITodoItemRepository _todoItemRepository;
private readonly IIdGenerator _idGenerator;

public CreateTodoItem2CommandHandler(ITodoItemRepository todoItemRepository, IIdGenerator idGenerator)
{
_todoItemRepository = todoItemRepository;
_idGenerator = idGenerator;
}

public async Task<Result<CreateTodoItem2ResultCommand>> HandleAsync(CreateTodoItem2Command command, CancellationToken cancellationToken)
{
var todoItem = new TodoItem(_idGenerator.GetNewId(), command.title, command.content, command.tags);
await _todoItemRepository.InsertAsync(todoItem);

var result = new CreateTodoItem2ResultCommand
{
Id = todoItem.Id
};

return result;
}

}
2 changes: 1 addition & 1 deletion TodoSample/Core/Domain/Honamic.Todo.Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.1">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.16">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.1" />
<PackageReference Include="MudBlazor" Version="6.15.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Honamic.Framework.Applications.Results;
using Honamic.Framework.Commands;
using Honamic.Todo.Application.TodoItems.Commands;
using Microsoft.AspNetCore.Mvc;

namespace Honamic.Todo.Endpoints.WebApi.Controllers;

[Route("api/[controller]")]
[ApiController]
public class TodoItems2Controller : ControllerBase
{
private readonly ILogger<TodoItemsController> _logger;
private readonly ICommandBus _commandBus;

public TodoItems2Controller(ILogger<TodoItemsController> logger, ICommandBus commandBus)
{
_logger = logger;
_commandBus = commandBus;
}

[HttpPost]
public async Task<Result<CreateTodoItem2ResultCommand>> Post([FromBody] CreateTodoItem2Command model, CancellationToken cancellationToken)
{
return await _commandBus
.DispatchAsync<CreateTodoItem2Command, Result<CreateTodoItem2ResultCommand>>
(model, cancellationToken);
}


}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Honamic.Framework.Facade.Results;
using Honamic.Framework.Applications.Results;
using Honamic.Framework.Queries;
using Honamic.Todo.Application.TodoItems.Commands;
using Honamic.Todo.Facade.TodoItems;
Expand Down Expand Up @@ -37,6 +37,12 @@ public Task<Result<TodoItemQuery>> Get(long id, CancellationToken cancellationTo

}

[HttpPost("Create")]
public Task<Result<long>> Create([FromBody] CreateTodoItemCommand model, CancellationToken cancellationToken)
{
return _todoItemFacade.Create(model, cancellationToken);
}

[HttpPost]
public Task<Result<long>> Post([FromBody] CreateTodoItemCommand model, CancellationToken cancellationToken)
{
Expand Down
2 changes: 1 addition & 1 deletion TodoSample/Facade/Honamic.Todo.Facade.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.16" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions TodoSample/Facade/TodoItems/ITodoItemFacade.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Honamic.Framework.Facade;
using Honamic.Framework.Facade.Results;
using Honamic.Framework.Applications.Results;
using Honamic.Framework.Facade;
using Honamic.Todo.Application.TodoItems.Commands;

namespace Honamic.Todo.Facade.TodoItems;
Expand Down
4 changes: 2 additions & 2 deletions TodoSample/Facade/TodoItems/ITodoItemQueryFacade.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Honamic.Framework.Facade;
using Honamic.Framework.Facade.Results;
using Honamic.Framework.Applications.Results;
using Honamic.Framework.Facade;
using Honamic.Framework.Queries;
using Honamic.Todo.Query.Domain.TodoItems.Models;
using Honamic.Todo.Query.Domain.TodoItems.Queries;
Expand Down
4 changes: 2 additions & 2 deletions TodoSample/Facade/TodoItems/TodoItemFacade.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Honamic.Framework.Commands;
using Honamic.Framework.Applications.Results;
using Honamic.Framework.Commands;
using Honamic.Framework.Events;
using Honamic.Framework.Facade;
using Honamic.Framework.Facade.Results;
using Honamic.Todo.Application.TodoItems.Commands;
using Honamic.Todo.Domain.TodoItems;
using Microsoft.Extensions.Logging;
Expand Down
2 changes: 1 addition & 1 deletion TodoSample/Facade/TodoItems/TodoItemQueryFacade.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Honamic.Framework.Facade;
using Honamic.Framework.Facade.Results;
using Honamic.Framework.Queries;
using Microsoft.Extensions.Logging;
using System.ComponentModel;
using Honamic.Todo.Query.Domain.TodoItems.Models;
using Honamic.Todo.Query.Domain.TodoItems.Queries;
using Honamic.Todo.Query.Domain.TodoItems;
using Honamic.Framework.Applications.Results;

namespace Honamic.Todo.Facade.TodoItems;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@


<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.1">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.16" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.16" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.16">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
</ItemGroup>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@


<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.1">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.16" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.16">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Honamic.Framework.Facade.Exceptions;
namespace Honamic.Framework.Applications.Exceptions;

public class UnauthenticatedException : Exception
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Honamic.Framework.Facade.Exceptions;
namespace Honamic.Framework.Applications.Exceptions;

public class UnauthorizedException : Exception
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>$(MSBuildProjectName.Replace(" ", "_").Replace(".Abstractions", ""))</RootNamespace>
Copy link

Copilot AI May 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider documenting or extracting the MSBuild expression used for RootNamespace generation to improve clarity and maintainability.

Suggested change
<RootNamespace>$(MSBuildProjectName.Replace(" ", "_").Replace(".Abstractions", ""))</RootNamespace>
<!-- Define a property to generate the RootNamespace by replacing spaces with underscores and removing ".Abstractions" -->
<GeneratedRootNamespace>$(MSBuildProjectName.Replace(" ", "_").Replace(".Abstractions", ""))</GeneratedRootNamespace>
<RootNamespace>$(GeneratedRootNamespace)</RootNamespace>

Copilot uses AI. Check for mistakes.
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Honamic.Framework.Facade.Results;
namespace Honamic.Framework.Applications.Results;

public static class HttpStatusCodes
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.ObjectModel;

namespace Honamic.Framework.Facade.Results;
namespace Honamic.Framework.Applications.Results;

public class Result
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Honamic.Framework.Facade.Results;
namespace Honamic.Framework.Applications.Results;

public class ResultMessage
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Honamic.Framework.Facade.Results;
namespace Honamic.Framework.Applications.Results;

public static class ResultMessagesExtensions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Honamic.Framework.Facade.Results;
namespace Honamic.Framework.Applications.Results;

public enum ResultStatus
{
Expand Down
Loading