bug fixes, schema updates
This commit is contained in:
@@ -9,7 +9,26 @@ const taskSchema = new mongoose.Schema({
|
||||
pid: { type: String, required: true, unique: true },
|
||||
title: String,
|
||||
dueDate: Date,
|
||||
files: Object,
|
||||
documents: [
|
||||
new mongoose.Schema(
|
||||
{
|
||||
files: Array,
|
||||
createdAt: Date,
|
||||
createdBy: {
|
||||
type: mongoose.Types.ObjectId,
|
||||
ref: "user",
|
||||
},
|
||||
},
|
||||
{ _id: false }
|
||||
),
|
||||
],
|
||||
stage: new mongoose.Schema(
|
||||
{
|
||||
pipeline: Array,
|
||||
currentStage: Number,
|
||||
},
|
||||
{ _id: false }
|
||||
),
|
||||
createdAt: Date,
|
||||
createdBy: {
|
||||
type: mongoose.Types.ObjectId,
|
||||
@@ -32,6 +51,19 @@ const createTaskInput = z.object({
|
||||
dueDate: z.date().optional(),
|
||||
files: z.array(files).optional(),
|
||||
assignedTo: z.string().optional(),
|
||||
stage: z
|
||||
.object({
|
||||
pipeline: z.array(
|
||||
z.object({
|
||||
name: z.string(),
|
||||
date: z.date().nullable().optional(),
|
||||
description: z.string().optional(),
|
||||
comment: z.string().optional(),
|
||||
})
|
||||
),
|
||||
currentStage: z.number(),
|
||||
})
|
||||
.optional(),
|
||||
});
|
||||
|
||||
const updateTaskInput = z.object({
|
||||
@@ -39,6 +71,19 @@ const updateTaskInput = z.object({
|
||||
dueDate: z.date().optional(),
|
||||
files: z.array(files).optional(),
|
||||
assignedTo: z.string().optional(),
|
||||
stage: z
|
||||
.object({
|
||||
pipeline: z.array(
|
||||
z.object({
|
||||
name: z.string(),
|
||||
date: z.date().nullable().optional(),
|
||||
description: z.string().optional(),
|
||||
comment: z.string().optional(),
|
||||
})
|
||||
),
|
||||
currentStage: z.number(),
|
||||
})
|
||||
.optional(),
|
||||
});
|
||||
|
||||
export type CreateTaskInput = z.infer<typeof createTaskInput>;
|
||||
|
||||
@@ -87,6 +87,8 @@ export async function listTasks(params: PageQueryParams, tenantId: string) {
|
||||
$project: {
|
||||
_id: 1,
|
||||
pid: 1,
|
||||
title: 1,
|
||||
dueDate: 1,
|
||||
createdAt: 1,
|
||||
createdBy: {
|
||||
$let: {
|
||||
@@ -98,7 +100,7 @@ export async function listTasks(params: PageQueryParams, tenantId: string) {
|
||||
},
|
||||
},
|
||||
},
|
||||
client: {
|
||||
assignedTo: {
|
||||
$let: {
|
||||
vars: { assignedTo: { $arrayElemAt: ["$assignedTo", 0] } },
|
||||
in: {
|
||||
|
||||
Reference in New Issue
Block a user