init
This commit is contained in:
commit
ab2e20f7e1
72 changed files with 2000 additions and 0 deletions
5
Femto.Modules.Blog.Contracts/Dto/GetAuthorPostsDto.cs
Normal file
5
Femto.Modules.Blog.Contracts/Dto/GetAuthorPostsDto.cs
Normal file
|
@ -0,0 +1,5 @@
|
|||
namespace Femto.Modules.Blog.Contracts.Dto;
|
||||
|
||||
public record GetAuthorPostsDto(Guid PostId, string Text, IList<GetAuthorPostsMediaDto> Media);
|
||||
|
||||
public record GetAuthorPostsMediaDto(Uri Url);
|
|
@ -0,0 +1,8 @@
|
|||
using Femto.Common.Attributes;
|
||||
using Femto.Common.Integration;
|
||||
|
||||
namespace Femto.Modules.Blog.Contracts.Events;
|
||||
|
||||
[EventType("post.created")]
|
||||
public record PostCreatedIntegrationEvent(Guid EventId, Guid PostId, IEnumerable<Guid> MediaIds)
|
||||
: IIntegrationEvent;
|
|
@ -0,0 +1,20 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Queries\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MediatR" Version="12.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Femto.Common\Femto.Common.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
34
Femto.Modules.Blog.Contracts/Module.cs
Normal file
34
Femto.Modules.Blog.Contracts/Module.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System.Collections.Immutable;
|
||||
using System.Reflection;
|
||||
using Femto.Common.Attributes;
|
||||
using MediatR;
|
||||
|
||||
namespace Femto.Modules.Blog.Contracts;
|
||||
|
||||
public static class Module
|
||||
{
|
||||
public static IDictionary<string, Type> GetIntegrationEventTypes()
|
||||
{
|
||||
var mapping = new Dictionary<string, Type>();
|
||||
|
||||
var types = typeof(Module).Assembly.GetTypes();
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
if (!typeof(INotification).IsAssignableFrom(type) || type.IsAbstract || type.IsInterface)
|
||||
continue;
|
||||
|
||||
var attribute = type.GetCustomAttribute<EventTypeAttribute>();
|
||||
if (attribute == null)
|
||||
continue;
|
||||
|
||||
var eventName = attribute.Name;
|
||||
if (!string.IsNullOrWhiteSpace(eventName))
|
||||
{
|
||||
mapping.TryAdd(eventName, type);
|
||||
}
|
||||
}
|
||||
|
||||
return mapping;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue