add stage, labels, priority fields to rts

This commit is contained in:
2025-06-17 15:22:57 +05:30
parent 4ff82dfc3a
commit 21868724c3
3 changed files with 18 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ import { generateId } from "../utils/id";
import { getFilterObject, getSortObject, PageQueryParams } from "../pagination";
import { getUserWithoutPopulate } from "../user/user.service";
import mongoose from "mongoose";
import { rtsPipeline } from "../utils/pipeline";
export async function createRts(
input: CreateRtsInput,
@@ -21,6 +22,13 @@ export async function createRts(
defaultClient = userInDb.orgId.toString();
}
if (!input.stage) {
input.stage = {
pipeline: rtsPipeline,
currentStage: 0,
};
}
const newRts = await rtsModel.create({
...input,
tenantId: user.tenantId,
@@ -104,7 +112,10 @@ export async function listRts(
documents: 1,
statusPipeline: 1,
createdAt: 1,
stage: 1,
status: 1,
labels: 1,
priority: 1,
county: {
$let: {
vars: { county: { $arrayElemAt: ["$countyRec", 0] } },