Skip to content

TaskView is a self-hosted project and task management platform focused on clarity, ownership, and control. TaskView is built for teams that want a transparent, self-hosted alternative to SaaS task managers.

fix: types

Nikolai Giman5149e7101e36
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<Task, 'goalId' | 'description'>
& Partial<Omit<Task, NotAllowedToUpdate | 'subtasks' | 'tags' | 'assignedUsers' | 'creatorId' | 'amount'>>
- //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'),
});