mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
Initial Commit
This commit is contained in:
25
app/model/client.js
Normal file
25
app/model/client.js
Normal file
@ -0,0 +1,25 @@
|
||||
var mongoose = require('mongoose'),
|
||||
Schema = mongoose.Schema,
|
||||
ObjectId = Schema.ObjectId;
|
||||
|
||||
var clientSchema = new Schema({
|
||||
name: String,
|
||||
identifier: String,
|
||||
address: {
|
||||
street1: String,
|
||||
street2: String,
|
||||
city: String,
|
||||
state: String,
|
||||
zip: String
|
||||
},
|
||||
contacts: [{
|
||||
name: String,
|
||||
phone: String,
|
||||
email: String
|
||||
}],
|
||||
frequencies: {},
|
||||
workorders: [{ type: ObjectId, ref: 'Workorder' }],
|
||||
deleted: { type: Boolean, default: false }
|
||||
});
|
||||
|
||||
module.exports = mongoose.model('Client', clientSchema);
|
12
app/model/counter.js
Normal file
12
app/model/counter.js
Normal file
@ -0,0 +1,12 @@
|
||||
var mongoose = require('mongoose'),
|
||||
Schema = mongoose.Schema,
|
||||
ObjectId = Schema.ObjectId;
|
||||
|
||||
var counterSchema = new Schema({
|
||||
name: String,
|
||||
seq: { type: Number, default: 0 }
|
||||
});
|
||||
|
||||
counterSchema.index({ field: 1, model: 1 }, { unique: true, required: true, index: -1 });
|
||||
|
||||
module.exports = mongoose.model('Counter', counterSchema);
|
24
app/model/user.js
Normal file
24
app/model/user.js
Normal file
@ -0,0 +1,24 @@
|
||||
var mongoose = require('mongoose'),
|
||||
Schema = mongoose.Schema,
|
||||
ObjectId = Schema.ObjectId;
|
||||
|
||||
var userSchema = new Schema({
|
||||
name: {
|
||||
first: String,
|
||||
last: String
|
||||
},
|
||||
email: String,
|
||||
picture: String,
|
||||
refreshToken: String,
|
||||
accessToken: String,
|
||||
|
||||
groups: [String],
|
||||
perms: [String],
|
||||
deleted: { type: Boolean, default: false }
|
||||
});
|
||||
|
||||
userSchema.methods.hasPermission = function(perm) {
|
||||
return this.perms.indexOf(perm) != -1;
|
||||
}
|
||||
|
||||
var User = module.exports = mongoose.model('User', userSchema);
|
27
app/model/workorder.js
Normal file
27
app/model/workorder.js
Normal file
@ -0,0 +1,27 @@
|
||||
var mongoose = require('mongoose')
|
||||
Schema = mongoose.Schema,
|
||||
ObjectId = Schema.ObjectId;
|
||||
|
||||
var workorderSchema = new Schema({
|
||||
biomedId: Number,
|
||||
client: { type: ObjectId, ref: 'Client' },
|
||||
createdOn: Date,
|
||||
createdBy: { type: ObjectId, ref: 'User' },
|
||||
reason: String,
|
||||
remarks: String,
|
||||
status: String,
|
||||
scheduling: {
|
||||
start: Date,
|
||||
end: Date
|
||||
},
|
||||
calendarId: String,
|
||||
techs: [{ type: ObjectId, ref: 'User' }],
|
||||
history: [{
|
||||
oldValues: {},
|
||||
newValues: {},
|
||||
modifiedBy: { type: ObjectId, ref: 'User' }
|
||||
}],
|
||||
deleted: { type: Boolean, default: false }
|
||||
});
|
||||
|
||||
module.exports = mongoose.model('Workorder', workorderSchema);
|
Reference in New Issue
Block a user