From 7f4114b7032c24d9305c7c731ad1fef2f9390dcd Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Tue, 18 Oct 2022 16:26:35 +0200 Subject: [PATCH] feat: move useGanttTaskList in separate file --- src/composables/taskList.ts | 2 +- src/helpers/time/parseDateProp.ts | 4 +- src/services/taskCollection.ts | 18 +++- src/types/PartialWithId.ts | 2 +- src/views/list/ListGantt.vue | 6 +- src/views/list/helpers/useGanttFilter.ts | 107 ++++----------------- src/views/list/helpers/useGanttTaskList.ts | 89 +++++++++++++++++ 7 files changed, 134 insertions(+), 94 deletions(-) create mode 100644 src/views/list/helpers/useGanttTaskList.ts diff --git a/src/composables/taskList.ts b/src/composables/taskList.ts index e23f10087..85fdc23b7 100644 --- a/src/composables/taskList.ts +++ b/src/composables/taskList.ts @@ -2,7 +2,7 @@ import {ref, shallowReactive, watch, computed} from 'vue' import {useRoute} from 'vue-router' import TaskCollectionService from '@/services/taskCollection' -import type { ITask } from '@/modelTypes/ITask' +import type {ITask} from '@/modelTypes/ITask' // FIXME: merge with DEFAULT_PARAMS in filters.vue export const getDefaultParams = () => ({ diff --git a/src/helpers/time/parseDateProp.ts b/src/helpers/time/parseDateProp.ts index 4ee954f16..9e426df25 100644 --- a/src/helpers/time/parseDateProp.ts +++ b/src/helpers/time/parseDateProp.ts @@ -1,5 +1,5 @@ -import type {DateISO} from "@/types/DateISO" -import type {DateKebab} from "@/types/DateKebab" +import type {DateISO} from '@/types/DateISO' +import type {DateKebab} from '@/types/DateKebab' export function parseDateProp(kebabDate: DateKebab | undefined): string | undefined { try { diff --git a/src/services/taskCollection.ts b/src/services/taskCollection.ts index bc460e346..8533bd2a9 100644 --- a/src/services/taskCollection.ts +++ b/src/services/taskCollection.ts @@ -1,7 +1,21 @@ -import AbstractService from './abstractService' -import TaskModel from '../models/task' import {formatISO} from 'date-fns' +import AbstractService from '@/services/abstractService' +import TaskModel from '@/models/task' + +import type {ITask} from '@/modelTypes/ITask' + +// FIXME: unite with other filter params types +export interface GetAllTasksParams { + sort_by: ('start_date' | 'done' | 'id')[], + order_by: ('asc' | 'asc' | 'desc')[], + filter_by: 'start_date'[], + filter_comparator: ('greater_equals' | 'less_equals')[], + filter_value: [string, string] // [dateFrom, dateTo], + filter_concat: 'and', + filter_include_nulls: boolean, +} + export default class TaskCollectionService extends AbstractService { constructor() { super({ diff --git a/src/types/PartialWithId.ts b/src/types/PartialWithId.ts index e9c279ff5..3d72b8f40 100644 --- a/src/types/PartialWithId.ts +++ b/src/types/PartialWithId.ts @@ -1 +1 @@ -export type PartialWithId = Pick & Omit, 'id'> \ No newline at end of file +export type PartialWithId = Pick & Omit, 'id'> \ No newline at end of file diff --git a/src/views/list/ListGantt.vue b/src/views/list/ListGantt.vue index 738165b20..48159840d 100644 --- a/src/views/list/ListGantt.vue +++ b/src/views/list/ListGantt.vue @@ -43,7 +43,6 @@