diff --git a/Habittodo.Console/Habittodo.Console.csproj b/Habittodo.Console/Habittodo.Console.csproj new file mode 100644 index 0000000..1d2d39a --- /dev/null +++ b/Habittodo.Console/Habittodo.Console.csproj @@ -0,0 +1,8 @@ + + + + Exe + net5.0 + + + diff --git a/Habittodo.Console/Program.cs b/Habittodo.Console/Program.cs new file mode 100644 index 0000000..9888123 --- /dev/null +++ b/Habittodo.Console/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace Habittodo.Console +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/Habittodo.Model/ChecklistItem.cs b/Habittodo.Model/ChecklistItem.cs new file mode 100644 index 0000000..88e347c --- /dev/null +++ b/Habittodo.Model/ChecklistItem.cs @@ -0,0 +1,15 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Habittodo.Model +{ + public class ChecklistItem + { + [JsonProperty("id")] + public string Id { get; set; } + [JsonProperty("text")] + public string Text { get; set; } + } +} diff --git a/Habittodo.Model/Due.cs b/Habittodo.Model/Due.cs new file mode 100644 index 0000000..e6cc312 --- /dev/null +++ b/Habittodo.Model/Due.cs @@ -0,0 +1,24 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Text; + +namespace Habittodo.Model +{ + public class Due + { + [JsonProperty("date")] + public string Date { get; set; } + [JsonProperty("timezone")] + public string Timezone { get; set; } + [JsonProperty("string")] + public string @String { get; set; } + + public string ToJavaScriptDateStr() + { + try { return Date + "T00:00:00.000Z"; } catch { } + return null; + } + } +} diff --git a/Habittodo.Model/HabitTodoLink.cs b/Habittodo.Model/HabitTodoLink.cs new file mode 100644 index 0000000..8ad41fa --- /dev/null +++ b/Habittodo.Model/HabitTodoLink.cs @@ -0,0 +1,28 @@ +using Microsoft.Azure.Cosmos.Table; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Habittodo.Model +{ + public class HabitTodoLink : TableEntity + { + public HabitTodoLink() { } + + public HabitTodoLink(string userId, string habiticaId, string todoistId, string habiticaParentId = null) + { + PartitionKey = userId; + RowKey = habiticaId; + HabiticaParentId = habiticaParentId; + TodoistId = todoistId; + } + + public string HabiticaParentId { get; set; } + public string TodoistId { get; set; } + + public TodoHabitLink Reverse() + { + return new TodoHabitLink(PartitionKey, TodoistId, RowKey); + } + } +} diff --git a/Habittodo.Model/Habittodo.Model.csproj b/Habittodo.Model/Habittodo.Model.csproj new file mode 100644 index 0000000..b3577fa --- /dev/null +++ b/Habittodo.Model/Habittodo.Model.csproj @@ -0,0 +1,11 @@ + + + + net5.0 + + + + + + + diff --git a/Habittodo.Model/Item.cs b/Habittodo.Model/Item.cs new file mode 100644 index 0000000..5e6cea3 --- /dev/null +++ b/Habittodo.Model/Item.cs @@ -0,0 +1,33 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Habittodo.Model +{ + public class Item + { + [JsonProperty("id")] + public string Id { get; set; } + [JsonProperty("content")] + public string Content { get; set; } + [JsonProperty("due")] + public Due Due { get; set; } + [JsonProperty("priority")] + public int Priority { get; set; } + [JsonProperty("parent_id")] + public string Parent_Id { get; set; } + [JsonProperty("is_deleted")] + public int Is_deleted { get; set; } + [JsonProperty("project_id")] + public string Project_id { get; set; } + [JsonProperty("date_completed")] + public string Date_completed { get; set; } + + /// + /// This field will always be false when an item is marked as deleted + /// + [JsonIgnore] + public bool IsChild => !string.IsNullOrEmpty(Parent_Id); + } +} diff --git a/Habittodo.Model/Task.cs b/Habittodo.Model/Task.cs new file mode 100644 index 0000000..da8cc60 --- /dev/null +++ b/Habittodo.Model/Task.cs @@ -0,0 +1,23 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Habittodo.Model +{ + public class Task + { + [JsonProperty("text")] + public string Text { get; set; } + [JsonProperty("type")] + public string Type { get; set; } + [JsonProperty("date")] + public string Date { get; set; } + [JsonProperty("priority")] + public string Priority { get; set; } + [JsonProperty("checklist", NullValueHandling = NullValueHandling.Ignore)] + public List Checklist { get; set; } + [JsonProperty("id")] + public string Id { get; set; } + } +} diff --git a/Habittodo.Model/TodoChange.cs b/Habittodo.Model/TodoChange.cs new file mode 100644 index 0000000..8db3af4 --- /dev/null +++ b/Habittodo.Model/TodoChange.cs @@ -0,0 +1,25 @@ +using Habitica.Todoist.Integration.Model.Storage.Enum; +using Microsoft.Azure.Cosmos.Table; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Habittodo.Model +{ + /* TODO: Rework structure */ + public class TodoChange : TableEntity + { + public TodoChange() { } + + public TodoChange(string userId, string todoId) + { + PartitionKey = userId; + RowKey = todoId; + } + + public TodoApp Application { get; set; } + public TodoAction Action { get; set; } + public bool Applied { get; set; } + public string JsonTodo { get; set; } + } +} diff --git a/Habittodo.Model/TodoHabitLink.cs b/Habittodo.Model/TodoHabitLink.cs new file mode 100644 index 0000000..0f98bdc --- /dev/null +++ b/Habittodo.Model/TodoHabitLink.cs @@ -0,0 +1,28 @@ +using Microsoft.Azure.Cosmos.Table; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Habittodo.Model +{ + public class TodoHabitLink : TableEntity + { + public TodoHabitLink() { } + + public TodoHabitLink(string userId, string todoistId, string habiticaId, string todoistParentId = null) + { + PartitionKey = userId; + RowKey = todoistId; + TodoistParentId = todoistParentId; + HabiticaId = habiticaId; + } + + public string TodoistParentId { get; set; } + public string HabiticaId { get; set; } + + public HabitTodoLink Reverse(string habiticaParentId = null) + { + return new HabitTodoLink(PartitionKey, HabiticaId, RowKey, habiticaParentId); + } + } +} diff --git a/Habittodo.Model/TodoistSync.cs b/Habittodo.Model/TodoistSync.cs new file mode 100644 index 0000000..ae37a43 --- /dev/null +++ b/Habittodo.Model/TodoistSync.cs @@ -0,0 +1,18 @@ +using Microsoft.Azure.Cosmos.Table; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Habittodo.Model +{ + public class TodoistSync : TableEntity + { + public TodoistSync() { } + + public TodoistSync(string userId, string syncToken) + { + PartitionKey = userId; + RowKey = syncToken; + } + } +} diff --git a/Habittodo.sln b/Habittodo.sln new file mode 100644 index 0000000..2746bc4 --- /dev/null +++ b/Habittodo.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.809.9 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Habittodo.Console", "Habittodo.Console\Habittodo.Console.csproj", "{42602C07-50C8-4334-AAB5-FD62EA208077}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Habittodo.Model", "Habittodo.Model\Habittodo.Model.csproj", "{871A5C5D-FBB9-4D2A-8D18-EC9923618C2C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {42602C07-50C8-4334-AAB5-FD62EA208077}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {42602C07-50C8-4334-AAB5-FD62EA208077}.Debug|Any CPU.Build.0 = Debug|Any CPU + {42602C07-50C8-4334-AAB5-FD62EA208077}.Release|Any CPU.ActiveCfg = Release|Any CPU + {42602C07-50C8-4334-AAB5-FD62EA208077}.Release|Any CPU.Build.0 = Release|Any CPU + {871A5C5D-FBB9-4D2A-8D18-EC9923618C2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {871A5C5D-FBB9-4D2A-8D18-EC9923618C2C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {871A5C5D-FBB9-4D2A-8D18-EC9923618C2C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {871A5C5D-FBB9-4D2A-8D18-EC9923618C2C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {173CA56B-3040-499A-8CC4-42ACF113665E} + EndGlobalSection +EndGlobal