worldshine-redesign/app/models/customer.model.js
2025-04-14 16:29:36 -04:00

86 lines
2.3 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,
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,
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
},
{ 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;
};