fix task model

This commit is contained in:
2025-02-14 13:13:11 +05:30
parent 5276f2a6cb
commit 167e89b464

View File

@@ -1,6 +1,7 @@
import { AuthenticatedUser } from "../auth";
import { getFilterObject, getSortObject, PageQueryParams } from "../pagination";
import { generateId } from "../utils/id";
import { taskPipeline } from "../utils/pipeline";
import {
CreateTaskInput,
taskFields,
@@ -13,6 +14,13 @@ export async function createTask(
input: CreateTaskInput,
user: AuthenticatedUser
) {
if (!input.stage) {
input.stage = {
pipeline: taskPipeline,
currentStage: 0,
};
}
if (!input.files) {
return await taskModel.create({
...input,
@@ -90,6 +98,8 @@ export async function listTasks(params: PageQueryParams, tenantId: string) {
pid: 1,
title: 1,
dueDate: 1,
documents: 1,
stage: 1,
createdAt: 1,
createdBy: {
$let: {
@@ -181,6 +191,8 @@ export async function searchTasks(params: PageQueryParams, tenantId: string) {
pid: 1,
title: 1,
dueDate: 1,
documents: 1,
stage: 1,
createdAt: 1,
createdBy: {
$let: {
@@ -246,4 +258,4 @@ export async function newUpload(
},
}
);
}
}