let user add note when creating task
This commit is contained in:
@@ -56,6 +56,7 @@ const createTaskInput = z.object({
|
|||||||
currentStage: z.number(),
|
currentStage: z.number(),
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
|
note: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const updateTaskInput = z.object({
|
const updateTaskInput = z.object({
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { AuthenticatedUser } from "../auth";
|
import { AuthenticatedUser } from "../auth";
|
||||||
|
import { createNote } from "../note/note.service";
|
||||||
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 { taskPipeline } from "../utils/pipeline";
|
||||||
@@ -30,6 +31,16 @@ export async function createTask(
|
|||||||
createdBy: user.userId ?? null,
|
createdBy: user.userId ?? null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (input.note) {
|
||||||
|
await createNote(
|
||||||
|
{
|
||||||
|
content: input.note,
|
||||||
|
},
|
||||||
|
task.pid,
|
||||||
|
user
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return await taskModel
|
return await taskModel
|
||||||
.findOne({ pid: task.pid })
|
.findOne({ pid: task.pid })
|
||||||
.populate({ path: "createdBy", select: "pid name avatar" })
|
.populate({ path: "createdBy", select: "pid name avatar" })
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ const createTaskInput = z.object({
|
|||||||
currentStage: z.number(),
|
currentStage: z.number(),
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
|
note: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const updateTaskInput = z.object({
|
const updateTaskInput = z.object({
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { AuthenticatedUser } from "../auth";
|
import { AuthenticatedUser } from "../auth";
|
||||||
|
import { createNote } from "../note/note.service";
|
||||||
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 { taskPipeline } from "../utils/pipeline";
|
||||||
@@ -29,6 +30,16 @@ export async function createTask(
|
|||||||
createdBy: user.userId ?? null,
|
createdBy: user.userId ?? null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (input.note) {
|
||||||
|
await createNote(
|
||||||
|
{
|
||||||
|
content: input.note,
|
||||||
|
},
|
||||||
|
task.pid,
|
||||||
|
user
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return await taskModel
|
return await taskModel
|
||||||
.findOne({ pid: task.pid })
|
.findOne({ pid: task.pid })
|
||||||
.populate({ path: "createdBy", select: "pid name avatar" })
|
.populate({ path: "createdBy", select: "pid name avatar" })
|
||||||
|
|||||||
Reference in New Issue
Block a user