mirror of
https://github.com/Gimanh/taskview-community.git
synced 2026-09-11 13:29:17 +00:00
@@ -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"
|
||||
@@ -274,7 +274,7 @@ export class TasksRepository {
|
||||
|
||||
async fetchSubtasks(taskId: number): Promise<TasksSchemaTypeForSelect[]> {
|
||||
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) {
|
||||
|
||||
@@ -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',
|
||||
@@ -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',
|
||||
});
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -77,6 +75,7 @@ export type TaskArgFetch = {
|
||||
searchText?: string;
|
||||
filters?: TaskFilters;
|
||||
unlimited?: boolean;
|
||||
ignoreCompleted?: boolean;
|
||||
};
|
||||
|
||||
export type TaskResponseFetch = Task[];
|
||||
|
||||
@@ -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'),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user