Skip to content

Instantly share code, notes, and snippets.

@harry-jones
Created March 17, 2017 13:38
Show Gist options
  • Save harry-jones/6aabfa3d7e767888062129d3ac6e9320 to your computer and use it in GitHub Desktop.
Save harry-jones/6aabfa3d7e767888062129d3ac6e9320 to your computer and use it in GitHub Desktop.
/**
* Customer.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: {
name: {
type: 'string',
required: true,
defaultsTo: ''
},
email: {
type: 'email',
unique: true,
required: true,
defaultsTo: ''
},
phone: {
type: 'string',
required: true,
defaultsTo: ''
},
postcode: {
type: 'string',
required: true,
defaultsTo: ''
},
// add reference to vehicles
vehicles: {
collection: 'vehicle',
via: 'owners'
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment