wip: finish converting some more projects
This commit is contained in:
12
Habittodo.Model/Habitica/ChecklistItem.cs
Normal file
12
Habittodo.Model/Habitica/ChecklistItem.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Habittodo.Model.Habitica
|
||||
{
|
||||
public class ChecklistItem
|
||||
{
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
[JsonProperty("text")]
|
||||
public string Text { get; set; }
|
||||
}
|
||||
}
|
||||
8
Habittodo.Model/Habitica/Enums/ScoreAction.cs
Normal file
8
Habittodo.Model/Habitica/Enums/ScoreAction.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Habittodo.Model.Habitica.Enums
|
||||
{
|
||||
public enum ScoreAction
|
||||
{
|
||||
Up = 0,
|
||||
Down = 1
|
||||
}
|
||||
}
|
||||
10
Habittodo.Model/Habitica/Enums/TaskType.cs
Normal file
10
Habittodo.Model/Habitica/Enums/TaskType.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Habittodo.Model.Habitica.Enums
|
||||
{
|
||||
public enum TaskType
|
||||
{
|
||||
Habit = 0,
|
||||
Daily = 1,
|
||||
Todo = 2,
|
||||
Reward = 3
|
||||
}
|
||||
}
|
||||
14
Habittodo.Model/Habitica/Responses/HabiticaResponse.cs
Normal file
14
Habittodo.Model/Habitica/Responses/HabiticaResponse.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Habittodo.Model.Habitica.Responses
|
||||
{
|
||||
public class HabiticaReponse<T>
|
||||
{
|
||||
[JsonProperty("success")]
|
||||
public bool Success { get; set; }
|
||||
[JsonProperty("data")]
|
||||
public T Data { get; set; }
|
||||
[JsonProperty("notifications")]
|
||||
public object Notifications { get; set; }
|
||||
}
|
||||
}
|
||||
21
Habittodo.Model/Habitica/Task.cs
Normal file
21
Habittodo.Model/Habitica/Task.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Habittodo.Model.Habitica
|
||||
{
|
||||
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; }
|
||||
}
|
||||
}
|
||||
10
Habittodo.Model/Storage/Enums/TodoAction.cs
Normal file
10
Habittodo.Model/Storage/Enums/TodoAction.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Habittodo.Model.Storage.Enums
|
||||
{
|
||||
public enum TodoAction
|
||||
{
|
||||
Add = 1,
|
||||
Update = 2,
|
||||
Complete = 3,
|
||||
Delete = 4
|
||||
}
|
||||
}
|
||||
8
Habittodo.Model/Storage/Enums/TodoApp.cs
Normal file
8
Habittodo.Model/Storage/Enums/TodoApp.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Habittodo.Model.Storage.Enums
|
||||
{
|
||||
public enum TodoApp
|
||||
{
|
||||
Habitica = 1,
|
||||
Todoist = 2
|
||||
}
|
||||
}
|
||||
25
Habittodo.Model/Storage/HabitTodoLink.cs
Normal file
25
Habittodo.Model/Storage/HabitTodoLink.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Microsoft.Azure.Cosmos.Table;
|
||||
|
||||
namespace Habittodo.Model.Storage
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
22
Habittodo.Model/Storage/TodoChange.cs
Normal file
22
Habittodo.Model/Storage/TodoChange.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Habittodo.Model.Storage.Enums;
|
||||
using Microsoft.Azure.Cosmos.Table;
|
||||
|
||||
namespace Habittodo.Model.Storage
|
||||
{
|
||||
/* 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; }
|
||||
}
|
||||
}
|
||||
25
Habittodo.Model/Storage/TodoHabitLink.cs
Normal file
25
Habittodo.Model/Storage/TodoHabitLink.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Microsoft.Azure.Cosmos.Table;
|
||||
|
||||
namespace Habittodo.Model.Storage
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Habittodo.Model/Storage/TodoistSync.cs
Normal file
15
Habittodo.Model/Storage/TodoistSync.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Microsoft.Azure.Cosmos.Table;
|
||||
|
||||
namespace Habittodo.Model.Storage
|
||||
{
|
||||
public class TodoistSync : TableEntity
|
||||
{
|
||||
public TodoistSync() { }
|
||||
|
||||
public TodoistSync(string userId, string syncToken)
|
||||
{
|
||||
PartitionKey = userId;
|
||||
RowKey = syncToken;
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Habittodo.Model/Todoist/Due.cs
Normal file
20
Habittodo.Model/Todoist/Due.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Habittodo.Model.Todoist
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Habittodo.Model/Todoist/Item.cs
Normal file
33
Habittodo.Model/Todoist/Item.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Habittodo.Model.Todoist
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
17
Habittodo.Model/Todoist/Responses/SyncResponse.cs
Normal file
17
Habittodo.Model/Todoist/Responses/SyncResponse.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Habittodo.Model.Todoist.Responses
|
||||
{
|
||||
public class SyncResponse
|
||||
{
|
||||
[JsonProperty("sync_token")]
|
||||
public string Sync_token { get; set; }
|
||||
[JsonProperty("full_sync")]
|
||||
public bool Full_sync { get; set; }
|
||||
[JsonProperty("items")]
|
||||
public List<Item> Items { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user