feat!: convert projects to .net 5 wip

This commit is contained in:
2021-06-28 18:59:25 -04:00
parent d89739016a
commit a953521992
12 changed files with 256 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,12 @@
using System;
namespace Habittodo.Console
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

View File

@@ -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; }
}
}

24
Habittodo.Model/Due.cs Normal file
View File

@@ -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;
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Microsoft.Azure.Cosmos.Table" Version="1.0.8" />
</ItemGroup>
</Project>

33
Habittodo.Model/Item.cs Normal file
View File

@@ -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; }
/// <summary>
/// This field will always be false when an item is marked as deleted
/// </summary>
[JsonIgnore]
public bool IsChild => !string.IsNullOrEmpty(Parent_Id);
}
}

23
Habittodo.Model/Task.cs Normal file
View File

@@ -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<ChecklistItem> Checklist { get; set; }
[JsonProperty("id")]
public string Id { get; set; }
}
}

View File

@@ -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; }
}
}

View File

@@ -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);
}
}
}

View File

@@ -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;
}
}
}

31
Habittodo.sln Normal file
View File

@@ -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