feat(backend): add knowledge base, innovation library and trends modules

Add knowledge item and innovation CRUD with search/filtering, published-only visibility for non-staff, admin publish/update, challenge dictionary, problem aggregation with trends (admin only) and canonical embedding text preparation for matchmaking.
This commit is contained in:
Rafał Tyński
2026-10-04 02:32:33 +02:00
parent fee137aee6
commit bad37a6ab9
19 changed files with 1074 additions and 0 deletions
@@ -0,0 +1,29 @@
using TarninaHub.Domain.Enums;
namespace TarninaHub.Application.Mappings;
public static class InnovationStageWire
{
private static readonly Dictionary<string, InnovationStage> ByWire = new(StringComparer.Ordinal)
{
["idea"] = InnovationStage.Idea,
["pilot"] = InnovationStage.Pilot,
["scaling"] = InnovationStage.Scaling,
["service"] = InnovationStage.Service,
};
public static bool IsValid(string? value) =>
!string.IsNullOrWhiteSpace(value) && ByWire.ContainsKey(value);
public static string ToWire(this InnovationStage stage) => stage switch
{
InnovationStage.Idea => "idea",
InnovationStage.Pilot => "pilot",
InnovationStage.Scaling => "scaling",
InnovationStage.Service => "service",
_ => throw new ArgumentOutOfRangeException(nameof(stage), stage, null),
};
public static InnovationStage? Parse(string? value) =>
value is not null && ByWire.TryGetValue(value, out var stage) ? stage : null;
}