add stage, labels, priority fields to rts
This commit is contained in:
@@ -42,6 +42,8 @@ const rtsSchema = new mongoose.Schema({
|
||||
{ _id: false }
|
||||
),
|
||||
status: String,
|
||||
labels: [String],
|
||||
priority: String,
|
||||
createdAt: Date,
|
||||
createdBy: {
|
||||
type: mongoose.Types.ObjectId,
|
||||
@@ -64,6 +66,8 @@ const rtsCreateInput = z.object({
|
||||
client: z.string().optional(),
|
||||
files: z.array(files).optional(),
|
||||
permitType: z.string().optional(),
|
||||
labels: z.array(z.string()).optional(),
|
||||
priority: z.string().optional(),
|
||||
stage: z
|
||||
.object({
|
||||
pipeline: z.array(
|
||||
@@ -85,6 +89,8 @@ const rtsUpdateInput = z.object({
|
||||
county: z.string().optional(),
|
||||
client: z.string().optional(),
|
||||
permitType: z.string().optional(),
|
||||
labels: z.array(z.string()).optional(),
|
||||
priority: z.string().optional(),
|
||||
stage: z
|
||||
.object({
|
||||
pipeline: z.array(
|
||||
|
||||
@@ -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] } },
|
||||
|
||||
@@ -112,7 +112,7 @@ export const rtsPipeline: Pipeline = [
|
||||
comment: "",
|
||||
},
|
||||
{
|
||||
name: "Review",
|
||||
name: "In Review",
|
||||
date: null,
|
||||
description: "",
|
||||
comment: "",
|
||||
|
||||
Reference in New Issue
Block a user