Skip to content

Instantly share code, notes, and snippets.

@wayne-o
Created April 18, 2015 10:06
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 wayne-o/653183531bc78a1a0ec9 to your computer and use it in GitHub Desktop.
Save wayne-o/653183531bc78a1a0ec9 to your computer and use it in GitHub Desktop.
With column names
/**
* ListingEvent.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/#!documentation/models
*/
module.exports = {
tableName: 'listingEvent',
attributes: {
name: { type: 'string' },
timeZone: { type: 'string' },
tzOffset: { type: 'string' },
slug: { type: 'string' },
start: { type: 'string' },
end: { type: 'string' },
eventInstanceSlug: { type: 'string' },
location: {
model:'location',
columnName:'locationId'
},
eventInstance: {
model:'eventInstance',
columnName:'eventInstanceId'
},
artist: {
model: 'artist',
columnName:'artistId'
},
users: {
collection: 'user',
via: 'listingEvents'
},
artistSlug: function(){
return this.artists[0].slug;
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment