Skip to content

Instantly share code, notes, and snippets.

@AskYous
Last active December 30, 2016 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AskYous/0ccaec850d30e7069afe9472c453cc33 to your computer and use it in GitHub Desktop.
Save AskYous/0ccaec850d30e7069afe9472c453cc33 to your computer and use it in GitHub Desktop.
/**
* Classes.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models
*/
module.exports = {
attributes: {
'number': { 'type': 'string' },
'name': { 'type': 'string' },
'sessions': {
'collection': 'sessions', // collection: <table name>
'via': 'classes',
'through': 'classsession'
}
}
};
/**
* ClassSession.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models
*/
module.exports = {
attributes: {
'classes': { 'model': 'classes', 'required': true },
'sessions': { 'model': 'sessions', 'required': true },
'name': { 'type': 'string' }
}
};
/**
* Sessions.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models
*/
module.exports = {
attributes: {
'startDateTime': { 'type': 'datetime' },
'endDateTime': { 'type': 'datetime' },
'name': { 'type': 'string' },
'classes':{
'collection': 'classes',
'via': 'sessions',
'through': 'classsession'
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment