worldshine-redesign/app/models/customer.model.js
2025-07-04 14:13:25 -04:00

121 lines
3.4 KiB
JavaScript

const uniqueValidator = require('mongoose-unique-validator');
module.exports = mongoose => {
var schema = mongoose.Schema(
{
username: {
type: String,
unique: true
},
name: String,
name_cn: String,
email: {
type: String,
unique: true
},
parent_id: String,
password: String,
care_provider: String,
emergency_contact: String,
emergency_contact2: String,
emergency_contact_name: String,
emergency_contact_phone: String,
emergency_contact_relationship: String,
emergency_contact2_name: String,
emergency_contact2_phone: String,
emergency_contact2_relationship: String,
medicare_number: String,
medicaid_number: String,
pharmacy: String,
birth_date: String,
firstname: String,
lastname: String,
address1: String,
address2: String,
address3: String,
address4: String,
address5: String,
street_address_1: String,
city1: String,
state1: String,
zip_code1: String,
street_address_2: String,
city2: String,
state2: String,
zip_code2: String,
street_address_3: String,
city3: String,
state3: String,
zip_code3: String,
street_address_4: String,
city4: String,
state4: String,
zip_code4: String,
street_address_5: String,
city5: String,
state5: String,
zip_code5: String,
phone: String,
mobile_phone: String,
type: String,
avatar: String,
special_needs: String,
note: String,
language: String,
status: String,
pickup_status: String,
create_by: String,
create_date: Date,
edit_by: String,
edit_date: Date,
password: String,
pharmacy_id: String,
pin: String,
admission_date: String,
home_phone: String,
seating: String,
vehicle_no: String,
caller: String,
roles: [{
type: String
}],
discharge_date: String,
placement: String,
nickname: String,
table_id: String,
salt: String,
groups: [{
type: String
}],
tags: [{
type: String
}],
api_token: String,
data: String,
title: String,
apartment: String,
private_note: String,
site: Number,
disability: Boolean,
height: String,
weight: String,
gender: String,
text_msg_enabled: Boolean,
health_condition: String,
allergy_info: String,
meal_requirement: String,
service_requirement: String,
payment_due_date: String,
payment_status: String,
join_reason: String,
discharge_reason: String
},
{ collection: 'customer', timestamps: true }
);
schema.method("toJSON", function() {
const { __v, _id, ...object } = this.toObject();
object.id = _id;
return object;
});
const Customer = mongoose.model("customer", schema);
return Customer;
};