wip for todoist -> habitica syncing process

This commit is contained in:
2020-03-22 15:18:43 -04:00
parent 20bf4fe93f
commit d994d92d34
11 changed files with 131 additions and 12 deletions

View File

@@ -0,0 +1,41 @@
using Habitica.Todoist.Integration.Data;
using Habitica.Todoist.Integration.Model.Storage;
using Habitica.Todoist.Integration.Model.Todoist;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Habitica.Todoist.Integration.Services
{
public static class TodoistExtensions
{
public static IEnumerable<Item> WhereAdded(this List<Item> items, TableStorageClient storageClient, string userId)
{
return items
.Where(x => !storageClient
.Exists<TodoHabitLink>(userId, x.Id) && x.Is_deleted == 0);
}
public static IEnumerable<Item> WhereUpdated(this List<Item> items, TableStorageClient storageClient, string userId)
{
return items
.Where(x => storageClient
.Exists<TodoHabitLink>(userId, x.Id) && x.Is_deleted == 0 && x.Date_completed == null);
}
public static IEnumerable<Item> WhereCompleted(this List<Item> items, TableStorageClient storageClient, string userId)
{
return items
.Where(x => storageClient
.Exists<TodoHabitLink>(userId, x.Id) && x.Is_deleted == 0 && x.Date_completed != null);
}
public static IEnumerable<Item> WhereDeleted(this List<Item> items, TableStorageClient storageClient, string userId)
{
return items
.Where(x => storageClient
.Exists<TodoHabitLink>(userId, x.Id) && x.Is_deleted == 1);
}
}
}