Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const mongoose = require("mongoose");
- const Schema = mongoose.Schema;
- const InstallationSchema = new Schema({
- installrefno: { type: String },
- installdate: { type: Date },
- serialno: {
- type: mongoose.Schema.Types.ObjectId,
- ref: "proreg"
- },
- installedby: {
- type: mongoose.Schema.Types.ObjectId,
- ref: "employees"
- },
- customer: {
- type: mongoose.Schema.Types.ObjectId,
- ref: "customer"
- },
- customertype: {
- type: mongoose.Schema.Types.ObjectId,
- ref: "customertype"
- },
- department: {
- type: mongoose.Schema.Types.ObjectId,
- ref: "customersubdepartment"
- },
- contactperson: { type: String },
- contactno: { type: Number },
- address: { type: String },
- remarks: { type: String },
- filename: { type: String },
- installdoc: { type: String }
- });
- module.exports = InstallationDetails = mongoose.model(
- "installation",
- InstallationSchema
- );
- const mongoose = require("mongoose");
- const Schema = mongoose.Schema;
- // Create Schema
- const ProRegSchema = new Schema({
- refno1: {
- type: String
- },
- refno2: {
- type: String
- },
- date: {
- type: Date
- },
- customer: {
- type: mongoose.Schema.Types.ObjectId,
- ref: "customer"
- },
- customertype: {
- type: mongoose.Schema.Types.ObjectId,
- ref: "customertype"
- },
- department: {
- type: mongoose.Schema.Types.ObjectId,
- ref: "customersubdepartment"
- },
- products: [
- {
- oem: {
- type: Schema.Types.ObjectId,
- ref: "company"
- },
- category: {
- type: mongoose.Schema.Types.ObjectId,
- ref: "productcategory"
- },
- subcategory: {
- type: mongoose.Schema.Types.ObjectId,
- ref: "productsubcategory"
- },
- modelno: {
- type: String
- },
- serialno: {
- type: String,
- required: true
- },
- warrantyfrom: {
- type: Date,
- default: "01-01-2019"
- },
- warrantyto: {
- type: Date,
- default: "01-01-2019"
- },
- oemwarrantyfrom: {
- type: Date,
- default: "01-01-2019"
- },
- oemwarrantyto: {
- type: Date,
- default: "01-01-2019"
- }
- }
- ],
- date: {
- type: Date,
- default: Date.now
- }
- });
- module.exports = ProReg = mongoose.model("proreg", ProRegSchema);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement