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:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user