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