From 471a82b9f57e9eba794a4278390df6aa66420d94 Mon Sep 17 00:00:00 2001 From: Nikolai Giman Date: Sun, 8 Feb 2026 22:06:49 +0100 Subject: [PATCH 1/2] fix: fix issues --- api/src/tv-modules/tasks/TasksRepository.ts | 8 +++++--- api/src/tv-modules/tasks/tasks.server.types.ts | 3 ++- taskview-packages/taskview-api/src/api/tasks.api.types.ts | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/api/src/tv-modules/tasks/TasksRepository.ts b/api/src/tv-modules/tasks/TasksRepository.ts index e2169bb..6bef241 100644 --- a/api/src/tv-modules/tasks/TasksRepository.ts +++ b/api/src/tv-modules/tasks/TasksRepository.ts @@ -274,7 +274,7 @@ export class TasksRepository { async fetchSubtasks(taskId: number): Promise { const result = await callWithCatch(() => - this.db.dbDrizzle.select().from(TasksSchema).where(eq(TasksSchema.parentId, taskId)) + this.db.dbDrizzle.select().from(TasksSchema).where(eq(TasksSchema.parentId, taskId)).orderBy(asc(TasksSchema.id)) ); return result ?? []; @@ -560,8 +560,10 @@ export class TasksRepository { } // complete - if (data.showCompleted === 0) conditions.push(eq(TasksSchema.complete, false)); - else if (data.showCompleted === 1) conditions.push(eq(TasksSchema.complete, true)); + if (!data.ignoreCompleted) { + if (data.showCompleted === 0) conditions.push(eq(TasksSchema.complete, false)); + else if (data.showCompleted === 1) conditions.push(eq(TasksSchema.complete, true)); + } // assignee filter — через EXISTS if (data.filters?.selectedUser) { diff --git a/api/src/tv-modules/tasks/tasks.server.types.ts b/api/src/tv-modules/tasks/tasks.server.types.ts index fa42c8a..6f2eaac 100644 --- a/api/src/tv-modules/tasks/tasks.server.types.ts +++ b/api/src/tv-modules/tasks/tasks.server.types.ts @@ -12,7 +12,7 @@ export const TaskArkTypeUpdate = type({ 'parentId?': 'number|null', 'description?': 'string', 'complete?': 'boolean', - 'goalListId?': 'number', + 'goalListId?': 'number|null', // 'creatorId?': 'number', 'note?': 'string', 'priorityId?': '1|2|3|null', @@ -64,6 +64,7 @@ export const TaskArkTypeFetchTasksNew = type({ }) .pipe(TaskArkTypeFetchTasksNewFilters), 'unlimited?': type('string').pipe((v) => v === 'true'), + 'ignoreCompleted?': type('string').pipe((v) => v === 'true'), }); export type TaskArgFetchTasksNew = typeof TaskArkTypeFetchTasksNew.infer; diff --git a/taskview-packages/taskview-api/src/api/tasks.api.types.ts b/taskview-packages/taskview-api/src/api/tasks.api.types.ts index 89fa08f..bbe3ef8 100644 --- a/taskview-packages/taskview-api/src/api/tasks.api.types.ts +++ b/taskview-packages/taskview-api/src/api/tasks.api.types.ts @@ -77,6 +77,7 @@ export type TaskArgFetch = { searchText?: string; filters?: TaskFilters; unlimited?: boolean; + ignoreCompleted?: boolean; }; export type TaskResponseFetch = Task[]; From 5149e7101e36bf8ef8270afbedf60fc2e48eafc8 Mon Sep 17 00:00:00 2001 From: Nikolai Giman Date: Sat, 14 Feb 2026 19:03:09 +0100 Subject: [PATCH 2/2] fix: types --- api/dev-containers-test/.env.taskview | 1 + api/src/tv-modules/tasks/tasks.server.types.ts | 2 +- .../taskview-api/src/api/tasks.api.types.ts | 10 ++++------ .../taskview-db-schemas/src/schemas/tasks.schema.ts | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/api/dev-containers-test/.env.taskview b/api/dev-containers-test/.env.taskview index 818e13c..890cb1a 100644 --- a/api/dev-containers-test/.env.taskview +++ b/api/dev-containers-test/.env.taskview @@ -16,6 +16,7 @@ SMTP_PASSWORD="smtp-password" SMTP_ENCRYPTION="ssl" SMTP_FROM_NAME="TaskViewApiServer" SMTP_FROM_EMAIL="smtp" +CORS_ALLOWED_ORIGINS="http://localhost:5173,http://127.0.0.1:5173,http://localhost:3000,http://127.0.0.1:3000" # Constant value APP_URL="https://taskview.handscream.com" \ No newline at end of file diff --git a/api/src/tv-modules/tasks/tasks.server.types.ts b/api/src/tv-modules/tasks/tasks.server.types.ts index 6f2eaac..1a504ef 100644 --- a/api/src/tv-modules/tasks/tasks.server.types.ts +++ b/api/src/tv-modules/tasks/tasks.server.types.ts @@ -23,7 +23,7 @@ export const TaskArkTypeUpdate = type({ 'statusId?': 'number|null', 'taskOrder?': 'number', 'kanbanOrder?': 'number', - 'amount?': 'number|null', + 'amount?': 'string|null', 'transactionType?': '1|0|null', 'nodeGraphPosition?': 'object|null', }); diff --git a/taskview-packages/taskview-api/src/api/tasks.api.types.ts b/taskview-packages/taskview-api/src/api/tasks.api.types.ts index bbe3ef8..c24517c 100644 --- a/taskview-packages/taskview-api/src/api/tasks.api.types.ts +++ b/taskview-packages/taskview-api/src/api/tasks.api.types.ts @@ -2,7 +2,6 @@ export const TaskIncomeType = 1; export const TaskExpenseType = 0; export type TaskTransactionTypes = typeof TaskIncomeType | typeof TaskExpenseType | null; -//TODO add optional type for fields that can be not allowed by permissions (subtasks, note) export interface TaskBase { id: number; description: string; @@ -26,8 +25,8 @@ export interface TaskBase { statusId: number | null; taskOrder: number | null; kanbanOrder: number | null; - //we add amount as number but got as string from API - amount: number | string | null; //string bec JS not working with numbers like 3.43 + + amount: number | string | null; transactionType: TaskTransactionTypes; nodeGraphPosition: Record<'x' | 'y', number> | null; creatorId: number | null; @@ -36,7 +35,7 @@ export interface TaskBase { export interface Task extends TaskBase { tags: number[]; historyId: null | number; - assignedUsers: number[]; //TODO how we update assigned users? maybe we need to do it in different module + assignedUsers: number[]; }; // we can not update defined fields @@ -47,8 +46,7 @@ export type TaskResponseUpdate = Task | null; export type TaskArgAdd = Pick & Partial> - //we add amount as number but got as string from API - & { amount?: number | null }; + & { amount?: number | string | null }; export type TaskResponseAdd = Task | null; diff --git a/taskview-packages/taskview-db-schemas/src/schemas/tasks.schema.ts b/taskview-packages/taskview-db-schemas/src/schemas/tasks.schema.ts index 713c94b..e51d6f8 100644 --- a/taskview-packages/taskview-db-schemas/src/schemas/tasks.schema.ts +++ b/taskview-packages/taskview-db-schemas/src/schemas/tasks.schema.ts @@ -1,4 +1,4 @@ -import { integer, pgSchema, varchar, boolean, date, time, jsonb } from "drizzle-orm/pg-core"; +import { integer, numeric, pgSchema, varchar, boolean, date, time, jsonb } from "drizzle-orm/pg-core"; import { createInsertSchema } from 'drizzle-arktype'; import { UsersSchema } from "./users.schema"; @@ -20,7 +20,7 @@ export const TasksSchema = pgSchema('tasks').table('tasks', { statusId: integer('status_id'), //kanban column id taskOrder: integer('task_order'), kanbanOrder: integer('kanban_order'), - amount: integer(), + amount: numeric({ precision: 10, scale: 2 }), transactionType: integer('transaction_type').$type<1 | 0 | null>(), nodeGraphPosition: jsonb('node_graph_position'), });