add stage, labels, priority fields to rts
This commit is contained in:
@@ -42,6 +42,8 @@ const rtsSchema = new mongoose.Schema({
|
|||||||
{ _id: false }
|
{ _id: false }
|
||||||
),
|
),
|
||||||
status: String,
|
status: String,
|
||||||
|
labels: [String],
|
||||||
|
priority: String,
|
||||||
createdAt: Date,
|
createdAt: Date,
|
||||||
createdBy: {
|
createdBy: {
|
||||||
type: mongoose.Types.ObjectId,
|
type: mongoose.Types.ObjectId,
|
||||||
@@ -64,6 +66,8 @@ const rtsCreateInput = z.object({
|
|||||||
client: z.string().optional(),
|
client: z.string().optional(),
|
||||||
files: z.array(files).optional(),
|
files: z.array(files).optional(),
|
||||||
permitType: z.string().optional(),
|
permitType: z.string().optional(),
|
||||||
|
labels: z.array(z.string()).optional(),
|
||||||
|
priority: z.string().optional(),
|
||||||
stage: z
|
stage: z
|
||||||
.object({
|
.object({
|
||||||
pipeline: z.array(
|
pipeline: z.array(
|
||||||
@@ -85,6 +89,8 @@ const rtsUpdateInput = z.object({
|
|||||||
county: z.string().optional(),
|
county: z.string().optional(),
|
||||||
client: z.string().optional(),
|
client: z.string().optional(),
|
||||||
permitType: z.string().optional(),
|
permitType: z.string().optional(),
|
||||||
|
labels: z.array(z.string()).optional(),
|
||||||
|
priority: z.string().optional(),
|
||||||
stage: z
|
stage: z
|
||||||
.object({
|
.object({
|
||||||
pipeline: z.array(
|
pipeline: z.array(
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { generateId } from "../utils/id";
|
|||||||
import { getFilterObject, getSortObject, PageQueryParams } from "../pagination";
|
import { getFilterObject, getSortObject, PageQueryParams } from "../pagination";
|
||||||
import { getUserWithoutPopulate } from "../user/user.service";
|
import { getUserWithoutPopulate } from "../user/user.service";
|
||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
|
import { rtsPipeline } from "../utils/pipeline";
|
||||||
|
|
||||||
export async function createRts(
|
export async function createRts(
|
||||||
input: CreateRtsInput,
|
input: CreateRtsInput,
|
||||||
@@ -21,6 +22,13 @@ export async function createRts(
|
|||||||
defaultClient = userInDb.orgId.toString();
|
defaultClient = userInDb.orgId.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!input.stage) {
|
||||||
|
input.stage = {
|
||||||
|
pipeline: rtsPipeline,
|
||||||
|
currentStage: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const newRts = await rtsModel.create({
|
const newRts = await rtsModel.create({
|
||||||
...input,
|
...input,
|
||||||
tenantId: user.tenantId,
|
tenantId: user.tenantId,
|
||||||
@@ -104,7 +112,10 @@ export async function listRts(
|
|||||||
documents: 1,
|
documents: 1,
|
||||||
statusPipeline: 1,
|
statusPipeline: 1,
|
||||||
createdAt: 1,
|
createdAt: 1,
|
||||||
|
stage: 1,
|
||||||
status: 1,
|
status: 1,
|
||||||
|
labels: 1,
|
||||||
|
priority: 1,
|
||||||
county: {
|
county: {
|
||||||
$let: {
|
$let: {
|
||||||
vars: { county: { $arrayElemAt: ["$countyRec", 0] } },
|
vars: { county: { $arrayElemAt: ["$countyRec", 0] } },
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ export const rtsPipeline: Pipeline = [
|
|||||||
comment: "",
|
comment: "",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Review",
|
name: "In Review",
|
||||||
date: null,
|
date: null,
|
||||||
description: "",
|
description: "",
|
||||||
comment: "",
|
comment: "",
|
||||||
|
|||||||
Reference in New Issue
Block a user