add archive script, proccessed routes
This commit is contained in:
80
src/processed/processed.schema.ts
Normal file
80
src/processed/processed.schema.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
import mongoose from "mongoose";
|
||||
import { pageQueryParams } from "../pagination";
|
||||
import { buildJsonSchemas } from "fastify-zod";
|
||||
|
||||
const processedSchema = new mongoose.Schema({
|
||||
tenantId: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
pid: {
|
||||
type: String,
|
||||
unique: true,
|
||||
},
|
||||
permitNumber: String,
|
||||
county: Object,
|
||||
client: {
|
||||
type: mongoose.Types.ObjectId,
|
||||
ref: "organization",
|
||||
},
|
||||
clientData: Object,
|
||||
permitDate: Date,
|
||||
stage: new mongoose.Schema(
|
||||
{
|
||||
pipeline: Array,
|
||||
currentStage: Number,
|
||||
},
|
||||
{ _id: false }
|
||||
),
|
||||
status: String,
|
||||
assignedTo: {
|
||||
type: mongoose.Types.ObjectId,
|
||||
ref: "user",
|
||||
},
|
||||
link: String,
|
||||
address: Object,
|
||||
recordType: String,
|
||||
description: String,
|
||||
applicationDetails: Object,
|
||||
applicationInfo: Object,
|
||||
applicationInfoTable: Object,
|
||||
conditions: Array,
|
||||
ownerDetails: String,
|
||||
parcelInfo: Object,
|
||||
paymentData: Object,
|
||||
professionalsList: Array,
|
||||
inspections: Object,
|
||||
createdAt: Date,
|
||||
createdBy: {
|
||||
type: mongoose.Types.ObjectId,
|
||||
ref: "user",
|
||||
},
|
||||
newProcessingStatus: Array,
|
||||
newPayment: Array,
|
||||
newConditions: Array,
|
||||
professionals: Object,
|
||||
recordId: String,
|
||||
relatedRecords: Object,
|
||||
accelaStatus: String,
|
||||
openDate: Date,
|
||||
lastUpdateDate: Date,
|
||||
statusUpdated: Date,
|
||||
transferDate: Date,
|
||||
}).index({ tenantId: 1, permitNumber: 1 }, { unique: true });
|
||||
|
||||
export const processedFields = Object.keys(processedSchema.paths).filter(
|
||||
(path) => path !== "__v"
|
||||
);
|
||||
|
||||
export const processedModel = mongoose.model(
|
||||
"processed",
|
||||
processedSchema,
|
||||
"processed"
|
||||
);
|
||||
|
||||
export const { schemas: processedSchemas, $ref: $processed } = buildJsonSchemas(
|
||||
{
|
||||
pageQueryParams,
|
||||
},
|
||||
{ $id: "processed" }
|
||||
);
|
||||
Reference in New Issue
Block a user