Files
Hy2026/backend/Infrastructure/Persistence/SurrealRows.cs
T
Rafał Tyński 127ca92f63 feat(ideas): add idea creator, grant calls and applications
Implement the idea creator and application generator: idea status workflow, social canvas card, grant call windows with 409 when closed, and an LLM-backed idea assistant with offline fallback.
2026-10-04 03:13:45 +02:00

216 lines
7.0 KiB
C#

using Dahomey.Cbor.Attributes;
namespace TarninaHub.Infrastructure.Persistence;
internal sealed class UserRow
{
[CborProperty("id")] public string Id { get; set; } = string.Empty;
[CborProperty("phone")] public string Phone { get; set; } = string.Empty;
[CborProperty("email")] public string? Email { get; set; }
[CborProperty("role")] public string Role { get; set; } = string.Empty;
[CborProperty("organization")] public string? Organization { get; set; }
}
internal sealed class PasswordCheckRow
{
[CborProperty("password_ok")] public bool PasswordOk { get; set; }
}
internal sealed class ConsentRow
{
[CborProperty("id")] public string Id { get; set; } = string.Empty;
[CborProperty("user")] public string User { get; set; } = string.Empty;
[CborProperty("scope")] public string Scope { get; set; } = string.Empty;
[CborProperty("granted_at")] public DateTimeOffset GrantedAt { get; set; }
[CborProperty("expires_at")] public DateTimeOffset? ExpiresAt { get; set; }
[CborProperty("revoked_at")] public DateTimeOffset? RevokedAt { get; set; }
}
internal sealed class SubmissionRow
{
[CborProperty("id")] public string Id { get; set; } = string.Empty;
[CborProperty("problem")] public string Problem { get; set; } = string.Empty;
[CborProperty("status")] public string Status { get; set; } = string.Empty;
[CborProperty("keywords")] public List<string> Keywords { get; set; } = [];
[CborProperty("created_at")] public DateTimeOffset CreatedAt { get; set; }
[CborProperty("updated_at")] public DateTimeOffset? UpdatedAt { get; set; }
[CborProperty("title")] public string Title { get; set; } = string.Empty;
[CborProperty("description")] public string Description { get; set; } = string.Empty;
[CborProperty("challenge")] public string Challenge { get; set; } = string.Empty;
[CborProperty("location")] public string Location { get; set; } = string.Empty;
[CborProperty("author")] public string Author { get; set; } = string.Empty;
}
internal sealed class CountRow
{
[CborProperty("count")] public int Count { get; set; }
}
internal sealed class ChallengeRow
{
[CborProperty("id")] public string Id { get; set; } = string.Empty;
[CborProperty("name")] public string Name { get; set; } = string.Empty;
[CborProperty("description")] public string Description { get; set; } = string.Empty;
[CborProperty("order")] public int Order { get; set; }
}
internal sealed class KnowledgeItemRow
{
[CborProperty("id")] public string Id { get; set; } = string.Empty;
[CborProperty("title")] public string Title { get; set; } = string.Empty;
[CborProperty("kind")] public string Kind { get; set; } = string.Empty;
[CborProperty("challenge")] public string? Challenge { get; set; }
[CborProperty("source_url")] public string? SourceUrl { get; set; }
[CborProperty("attachments")] public List<Dictionary<string, object?>> Attachments { get; set; } = [];
[CborProperty("published")] public bool Published { get; set; }
[CborProperty("updated_at")] public DateTimeOffset? UpdatedAt { get; set; }
}
internal sealed class InnovationRow
{
[CborProperty("id")] public string Id { get; set; } = string.Empty;
[CborProperty("title")] public string Title { get; set; } = string.Empty;
[CborProperty("summary")] public string Summary { get; set; } = string.Empty;
[CborProperty("description")] public string Description { get; set; } = string.Empty;
[CborProperty("challenge")] public string Challenge { get; set; } = string.Empty;
[CborProperty("stage")] public string Stage { get; set; } = string.Empty;
[CborProperty("cost")] public string? Cost { get; set; }
[CborProperty("contact")] public Dictionary<string, object?>? Contact { get; set; }
[CborProperty("media")] public List<Dictionary<string, object?>> Media { get; set; } = [];
[CborProperty("published")] public bool Published { get; set; }
[CborProperty("updated_at")] public DateTimeOffset? UpdatedAt { get; set; }
[CborProperty("embedding")] public List<float>? Embedding { get; set; }
}
internal sealed class ProblemRow
{
[CborProperty("id")] public string Id { get; set; } = string.Empty;
[CborProperty("title")] public string Title { get; set; } = string.Empty;
[CborProperty("description")] public string Description { get; set; } = string.Empty;
[CborProperty("challenge")] public string Challenge { get; set; } = string.Empty;
[CborProperty("location")] public string Location { get; set; } = string.Empty;
[CborProperty("author")] public string Author { get; set; } = string.Empty;
[CborProperty("embedding")] public List<float>? Embedding { get; set; }
}
internal sealed class TrendRow
{
[CborProperty("challenge")] public string Challenge { get; set; } = string.Empty;
[CborProperty("count")] public int Count { get; set; }
}
internal sealed class TrendSubmissionRow
{
[CborProperty("challenge")] public string Challenge { get; set; } = string.Empty;
}
internal sealed class IdRow
{
[CborProperty("id")] public string Id { get; set; } = string.Empty;
}
internal sealed class IdeaRow
{
[CborProperty("id")] public string Id { get; set; } = string.Empty;
[CborProperty("title")] public string Title { get; set; } = string.Empty;
[CborProperty("description")] public string Description { get; set; } = string.Empty;
[CborProperty("author")] public string Author { get; set; } = string.Empty;
[CborProperty("status")] public string Status { get; set; } = string.Empty;
[CborProperty("updated_at")] public DateTimeOffset? UpdatedAt { get; set; }
}
internal sealed class IdeaCardRow
{
[CborProperty("id")] public string Id { get; set; } = string.Empty;
[CborProperty("idea")] public string Idea { get; set; } = string.Empty;
[CborProperty("essence")] public string Essence { get; set; } = string.Empty;
[CborProperty("audience")] public string Audience { get; set; } = string.Empty;
[CborProperty("stage")] public string Stage { get; set; } = string.Empty;
}
internal sealed class GrantCallRow
{
[CborProperty("id")] public string Id { get; set; } = string.Empty;
[CborProperty("name")] public string Name { get; set; } = string.Empty;
[CborProperty("opens_at")] public DateTimeOffset OpensAt { get; set; }
[CborProperty("closes_at")] public DateTimeOffset ClosesAt { get; set; }
[CborProperty("status")] public string Status { get; set; } = string.Empty;
[CborProperty("external_id")] public string? ExternalId { get; set; }
}
internal sealed class ApplicationRow
{
[CborProperty("id")] public string Id { get; set; } = string.Empty;
[CborProperty("grant_call")] public string GrantCall { get; set; } = string.Empty;
[CborProperty("idea")] public string Idea { get; set; } = string.Empty;
[CborProperty("content")] public Dictionary<string, string?> Content { get; set; } = [];
[CborProperty("status")] public string Status { get; set; } = string.Empty;
[CborProperty("created_at")] public DateTimeOffset CreatedAt { get; set; }
}