added file upload handler to tasks
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
taskFields,
|
||||
taskModel,
|
||||
UpdateTaskInput,
|
||||
UploadTaskInput,
|
||||
} from "./task.schema";
|
||||
|
||||
export async function createTask(
|
||||
@@ -227,3 +228,22 @@ export async function searchTasks(params: PageQueryParams, tenantId: string) {
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export async function newUpload(
|
||||
id: string,
|
||||
newUpload: UploadTaskInput,
|
||||
user: AuthenticatedUser
|
||||
) {
|
||||
return await taskModel.findOneAndUpdate(
|
||||
{ pid: id, tenantId: user.tenantId },
|
||||
{
|
||||
$push: {
|
||||
documents: {
|
||||
files: newUpload.files,
|
||||
createdAt: new Date(),
|
||||
createdBy: user.userId,
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user