Initial commit.

This commit is contained in:
2025-12-11 10:20:10 +09:00
commit 057481803f
21 changed files with 1327 additions and 0 deletions

14
Models/AppConfigs.cs Normal file
View File

@@ -0,0 +1,14 @@
using Microsoft.Extensions.Options;
namespace TriliumMind.Models;
public class AppConfigs
{
public Dictionary<string, string> RuntimeConfigs;
public AppSettings AppSettings { get; set; }
public AppConfigs(IOptions<AppSettings> options)
{
RuntimeConfigs = new Dictionary<string, string>();
AppSettings = options.Value;
}
}

55
Models/AppSettings.cs Normal file
View File

@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace TriliumMind.Models;
public class AppSettings
{
public Trilium Trilium { get; set; } = new Trilium();
public Jira Jira { get; set; } = new Jira();
public Database Database { get; set; } = new Database();
}
public class Trilium
{
public string EtapiToken { get; set; } = string.Empty;
public string EtapiBaseUrl { get; set; } = "https://localhost/etapi";
public string JiraOpenedIssuePageId = string.Empty;
public string JiraWorkingIssuePageId = string.Empty;
public string JiraResolvedIssuePageId = string.Empty;
public string DividendPageId { get; set; } = String.Empty;
}
public class Jira
{
public string BaseUrl { get; set; } = string.Empty;
public string ApiBaseUrl { get; set; } = string.Empty;
public string AccessToken { get; set; } = string.Empty;
public List<string> TargetProjects { get; set; } = [];
public DateTime LastFetchDateTime { get; set; } = DateTime.Parse("2025-12-01T00:00:00Z");
public int FetchInterval { get; set; } = 60;
public string SearchFields { get; set; } = string.Empty;
}
public class Database
{
public string Type { get; set; } = "Sqlite"; // "Sqlite" or "Postgres"
public SqliteConfig Sqlite { get; set; } = new SqliteConfig();
public PostgresConfig Postgres { get; set; } = new PostgresConfig();
}
public class SqliteConfig
{
public string DatabaseFilePath { get; set; } = "TriliumMind.db";
}
public class PostgresConfig
{
public string Host { get; set; } = "localhost";
public int Port { get; set; } = 5432;
public string Database { get; set; } = "TriliumMind";
public string Username { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public string SslCertificatePath { get; set; } = string.Empty;
}

104
Models/JiraResponse.cs Normal file
View File

@@ -0,0 +1,104 @@
namespace TriliumMind.Models;
public class JiraResponse
{
public string expand { get; set; }
public int startAt { get; set; }
public int maxResults { get; set; }
public int total { get; set; }
public Issue[] issues { get; set; }
}
public class Issue
{
public string expand { get; set; }
public string id { get; set; }
public string self { get; set; }
public string key { get; set; }
public Fields fields { get; set; }
}
public class Fields
{
public string summary { get; set; } // Title
public Assignee assignee { get; set; }
public Reporter reporter { get; set; }
public string updated { get; set; }
public Status status { get; set; }
public Issuetype issuetype { get; set; }
public DateTimeOffset UpdatedAt
{
get
{
// "2025-09-03T15:31:51.000+0900" → "2025-09-03T15:31:51.000+09:00"
var fixedValue = updated.Insert(updated.Length - 2, ":");
return DateTimeOffset.Parse(fixedValue);
}
}
public DateTime? duedate { get; set; }
public Issue parent { get; set; }
public string customfield_10808 { get; set; } // Epic key
}
public class Assignee
{
public string self { get; set; }
public string name { get; set; }
public string key { get; set; }
public string emailAddress { get; set; }
public Avatarurls avatarUrls { get; set; }
public string displayName { get; set; } // Korean name
public bool active { get; set; }
public string timeZone { get; set; }
}
public class Reporter
{
public string self { get; set; }
public string name { get; set; }
public string key { get; set; }
public string emailAddress { get; set; }
public Avatarurls avatarUrls { get; set; }
public string displayName { get; set; } // Korean name
public bool active { get; set; }
public string timeZone { get; set; }
}
public class Avatarurls
{
public string _48x48 { get; set; }
public string _24x24 { get; set; }
public string _16x16 { get; set; }
public string _32x32 { get; set; }
}
public class Status
{
public string self { get; set; }
public string description { get; set; }
public string iconUrl { get; set; }
public string name { get; set; } // Status: Open InProgress ...
public string id { get; set; }
public Statuscategory statusCategory { get; set; }
}
public class Statuscategory
{
public string self { get; set; }
public int id { get; set; }
public string key { get; set; }
public string colorName { get; set; }
public string name { get; set; }
}
public class Issuetype
{
public string self { get; set; }
public string id { get; set; }
public string description { get; set; }
public string iconUrl { get; set; }
public string name { get; set; } // Type
public bool subtask { get; set; }
public int avatarId { get; set; }
}