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 SurrealDb.Net;
|
||||
using TarninaHub.Application.Abstractions;
|
||||
using TarninaHub.Application.Dtos;
|
||||
|
||||
namespace TarninaHub.Infrastructure.Persistence;
|
||||
|
||||
public sealed class ChallengeService : IChallengeService
|
||||
{
|
||||
private readonly ISurrealDbClient _client;
|
||||
|
||||
public ChallengeService(ISurrealDbClient client)
|
||||
{
|
||||
_client = client;
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyList<SocialChallengeResponse>> ListAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var response = await _client.RawQuery(
|
||||
"SELECT type::string(id) AS id, name, description, order FROM social_challenge ORDER BY order;",
|
||||
cancellationToken: cancellationToken);
|
||||
response.EnsureAllOks();
|
||||
|
||||
var rows = response.GetValue<List<ChallengeRow>>(0) ?? [];
|
||||
|
||||
return rows
|
||||
.Select(row => new SocialChallengeResponse(row.Id, row.Name, row.Description, row.Order))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user