first commit
This commit is contained in:
89
models/Inspect.js
Normal file
89
models/Inspect.js
Normal file
@@ -0,0 +1,89 @@
|
||||
const mongoose = require("mongoose");
|
||||
|
||||
const inspectSchema = new mongoose.Schema(
|
||||
{
|
||||
place_key: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
user_id: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
province: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
license_type: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
document_number: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
issuer: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
economic_code: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
registration_number: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
ownership_type: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
unit_type: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
violation_amount: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
plaintiff_damage: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
infractions: {
|
||||
type: [
|
||||
{
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
required: false,
|
||||
},
|
||||
inspectors: {
|
||||
type: [
|
||||
{
|
||||
fullname: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
const Place = mongoose.model("Inspect", inspectSchema);
|
||||
|
||||
module.exports = Place;
|
||||
13
models/UpdateData.js
Normal file
13
models/UpdateData.js
Normal file
@@ -0,0 +1,13 @@
|
||||
const mongoose = require("mongoose");
|
||||
|
||||
const UpdateDataSchema = new mongoose.Schema({
|
||||
records: {
|
||||
type: Map,
|
||||
of: [mongoose.Schema.Types.Mixed],
|
||||
default: {},
|
||||
},
|
||||
});
|
||||
|
||||
const UpdateData = mongoose.model("UpdateData", UpdateDataSchema);
|
||||
|
||||
module.exports = UpdateData;
|
||||
48
models/herd.js
Normal file
48
models/herd.js
Normal file
@@ -0,0 +1,48 @@
|
||||
const mongoose = require("mongoose");
|
||||
|
||||
const inspectSchema = new mongoose.Schema({
|
||||
agent: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
birth_day: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
contractor_code: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
gender: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
herd_code: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
national_id_livestock_code: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
registering_date: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
registering_user: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
unique_identifier: {
|
||||
type: String,
|
||||
required: false,
|
||||
},
|
||||
});
|
||||
|
||||
const Herd = mongoose.model("Herds", inspectSchema);
|
||||
|
||||
module.exports = Herd;
|
||||
36
models/peopleInfo.js
Normal file
36
models/peopleInfo.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const mongoose = require("mongoose");
|
||||
|
||||
const peopleInfoSchema = new mongoose.Schema(
|
||||
{
|
||||
mobile: { type: String, required: false, index: true },
|
||||
name: { type: String, required: false, index: true },
|
||||
family: { type: String, required: false, index: true },
|
||||
birthdate: { type: String, required: false },
|
||||
nationalcode: { type: String, required: false, index: true },
|
||||
mellicard: { type: String, required: false },
|
||||
info1: { type: String, required: false },
|
||||
info2: { type: String, required: false },
|
||||
info3: { type: String, required: false },
|
||||
info4: { type: String, required: false },
|
||||
},
|
||||
{ timestamps: false }
|
||||
);
|
||||
|
||||
peopleInfoSchema.index({ nationalcode: 1 });
|
||||
peopleInfoSchema.index({ mobile: 1 });
|
||||
peopleInfoSchema.index({ name: 1, family: 1 });
|
||||
|
||||
peopleInfoSchema.index(
|
||||
{ name: "text", family: "text" },
|
||||
{
|
||||
default_language: "none",
|
||||
weights: { name: 10, family: 10 },
|
||||
}
|
||||
);
|
||||
|
||||
peopleInfoSchema.index({ name: 1 });
|
||||
peopleInfoSchema.index({ family: 1 });
|
||||
|
||||
const PeopleInfo = mongoose.model("PeopleInfo", peopleInfoSchema);
|
||||
|
||||
module.exports = PeopleInfo;
|
||||
27
models/place.js
Normal file
27
models/place.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const mongoose = require("mongoose");
|
||||
|
||||
const placeSchema = new mongoose.Schema(
|
||||
{
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
location: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
category: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
const Place = mongoose.model("Place", placeSchema);
|
||||
|
||||
module.exports = Place;
|
||||
15
models/user.js
Normal file
15
models/user.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const mongoose = require("mongoose");
|
||||
|
||||
const userSchema = new mongoose.Schema({
|
||||
mobile: { type: String, required: true, unique: true },
|
||||
password: { type: String, required: true },
|
||||
fullname: { type: String, required: true, unique: false },
|
||||
pic: { type: String, required: false },
|
||||
province: { type: String, required: true },
|
||||
city: { type: String, required: false },
|
||||
permissions: { type: Array, default: ["all"], required: false },
|
||||
});
|
||||
|
||||
const User = mongoose.model("User", userSchema);
|
||||
|
||||
module.exports = User;
|
||||
Reference in New Issue
Block a user