Last active
October 28, 2019 14:10
-
-
Save acomito/e341387da0d36435dd58bf3cbb316528 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ========================================== | |
// USERS | |
// ========================================== | |
const USERS = { | |
id: String, | |
firstName: String, | |
lastName: String, | |
email: String, | |
title: String, | |
employeeId: String, | |
createdAt: Number, | |
roles: { | |
type: [String], | |
enum: ['coEmployee', 'coAdmin', 'superAdmin'], // in some cases, users may have multiple roles... they may be a company employee and a company admin | |
}, | |
permissions: { | |
type: [String], | |
}, | |
}; | |
// ========================================== | |
// EMPLOYEES | |
// ========================================== | |
const EMPLOYEES = { | |
id: String, | |
firstName: String, | |
lastName: String, | |
email: String, | |
assignedId: String, // used if the company has some internal ID they use to identify a given employee | |
companyId: String, // tells us which company this employee belongs to | |
gender: { | |
type: String, | |
enum: ['male', 'female'], | |
}, | |
status: { | |
type: String, | |
enum: ['active', 'terminated'], | |
}, | |
dob: String, // timestamp date | |
hireDate: String, // timestamp date | |
ssn: String, | |
// location | |
street: String, | |
zip: String, | |
state: String, | |
city: String, | |
}); | |
// ========================================== | |
// CUSTOMERS (i.e. a company) | |
// ========================================== | |
const CUSTOMERS = { | |
id: String, | |
title: String, | |
companyType: { | |
type: String, | |
enum: ['llc', 'ccorp', 'scorp', 'llp', 'other'], // these can be displayed in the UI like "C-Corp" "LLC" it's just best to store them in the DB without dashes and in lower case | |
}, | |
ein: String, | |
status: { | |
type: String, | |
enum: ['pending', 'active', 'disabled', 'archived'], | |
}, | |
// LOCATION | |
street: String, | |
zip: String, | |
state: String, | |
city: String, | |
// OTHER STUFF | |
plan: ImageModel, // often a pdf but technically can be anything... pdf, png, mp3--- any type of file | |
documents: [ImageModel], // often a pdf but technically can be anything... pdf, png, mp3--- any type of file | |
// contacts is an array (i.e. list) of contacts, so you can add as many as you'd like. Could use a form similar, in concept, to this https://ant.design/components/form/#components-form-demo-dynamic-form-item but instead of adding a field, were adding a contact (i.e. everytime you hit "add contacnt" you'd see several fields pop up not just one) | |
contacts: [ | |
{ | |
firstName: String, | |
lastName: String, | |
title: String, | |
phone: String, | |
email: String, | |
}, | |
], | |
}; | |
// ========================================== | |
// BENEFITS | |
// ========================================== | |
const BENEFITS = { | |
id: String, | |
title: String, | |
description: String, | |
companyId: String, | |
vendorId: String, | |
type: String, // maybe this is where we store the type of benefit... which will dictate the specific math applied. | |
}; | |
// ========================================== | |
// VENDORS | |
// ========================================== | |
const VENDORS = { | |
id: String, | |
title: String, | |
// location | |
street: String, | |
zip: String, | |
state: String, | |
city: String, | |
// other | |
documents: [ImageModel], | |
contacts: [ | |
{ | |
firstName: String, | |
lastName: String, | |
title: String, | |
phone: String, | |
email: String, | |
}, | |
], | |
}; | |
// baseFields are fields that may be on all, or almost all, schemas | |
const baseFields = { | |
createdAt: String, // timestamp of when the record was created | |
updatedAt: String, // timestamp of when the record was last updated | |
createdBy: String, // userId of who created record originally | |
updatedBy: String // userId of who last updated the record | |
}; | |
// ImageModel is basically just a record for an image/file/video-- it works for really any media you want to store. Not all the fields are required, but they're available. | |
const ImageModel = { | |
url: String, | |
thumbnailUrl: String, | |
title: String, | |
description: String, | |
fileType: String, | |
base64: String, | |
filename: String, | |
createdAt: String, | |
createdByName: String | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment