Abstract
This page mainly covers the design of the new data models of the Dashboard under Mongoose. This new model should provide a more extendable data storage for the OpenMRS ID.
The goals for this data model is in-line with the Dashboard, that is to provide a one-site service.
For now they're only the most basic one that could cover the old data.
Will Be Updated
User
I'll just paste my code simply just write some specifications here.
Code Block | ||||
---|---|---|---|---|
| ||||
var userSchema = new/// user Schema({ username: String,<String> // not empty, unique username , only contain number and characters, currently at least has a length of 2 firstName: <String> String,// no requirement lastName: <String> String,// no requirement displayName: String <String> // no requirement, primaryEmail: <String> // firstName + ' ' + lastName by default primaryEmail: String, // Used for notifications displayEmail: String, // Used for displaying emailList: [String], // All the users' Emails password: String, //hashed password }); |
not empty, unique, valid email address, one of emailList
displayEmail: <String> // valid email address
emailList: < [String] > // array of valid email address, not empty, all members are unique
password: <String> // not empty, a hashed String
groups: < [String] > // no duplicates in the Array, items in this array must be in Groups collection. could only be edited by admin user.
locked: <Boolean> // not empty
extra: <Mixed> // any JSON form data
/// additionally all email should be in lowercase
/// and username as well
/// special flag used to sync with LDAP
inLDAP: <Boolean> // if false, then store it in LDAP, if true then sync the modifications
skipLDAP: <Boolean> // used to skip the sync procedure
createdAt: <Date> // It is only used to expire(delete) this user, if it is not verified for a long time. |
Groups
This model describes user groups.
Code Block |
---|
groupName: <String> // not empty, unique
description: <String> // no requirement
member: < [UserRef] > // no duplicate items
///
UserRef:
objId: <ObjectId> // user document id
username: <String> // username |