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