Created
January 6, 2014 22:58
-
-
Save robwormald/8291437 to your computer and use it in GitHub Desktop.
schema stufss
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
/** | |
* Employee | |
* | |
* @module :: Model | |
* @description :: A short summary of how this model works and what it represents. | |
* @docs :: http://sailsjs.org/#!documentation/models | |
*/ | |
var uuid = require('node-uuid') | |
module.exports = { | |
attributes: { | |
id : { | |
type : 'string', | |
primaryKey : true, | |
required : true, | |
}, | |
// domain : { | |
// model : 'domain' | |
// }, | |
employeeNumber : { | |
type: 'string', | |
}, | |
employeeName : { | |
type : 'string', | |
}, | |
email : { | |
type : 'string', | |
}, | |
title : { | |
type : 'string', | |
}, | |
firstName : { | |
type : 'string', | |
}, | |
middleName : { | |
type : 'string', | |
}, | |
lastName : { | |
type : 'string', | |
}, | |
suffix : { | |
type : 'string', | |
}, | |
gender : { | |
type : 'string', | |
}, | |
hireDate : { | |
type : 'date' | |
}, | |
birthday : { | |
type : 'date' | |
}, | |
//virtual getter/setter | |
timelogs : { | |
collection : 'timelog' | |
} | |
/* e.g. | |
nickname: 'string' | |
*/ | |
}, | |
beforeCreate : function(values,cb){ | |
if(!values.id){ | |
values.id = uuid.v4(); | |
} | |
cb() | |
} | |
}; |
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
"_model": "timeactivity", | |
"_attributes": { | |
"id": { | |
"type": "string", | |
"primaryKey": true, | |
"required": true | |
}, | |
"user": { | |
"model": "user", | |
"required": true | |
}, | |
"employee": { | |
"model": "employee" | |
}, | |
"customer": { | |
"model": "customer" | |
}, | |
"item": { | |
"model": "item" | |
}, | |
"job": { | |
"model": "job" | |
}, | |
"start": { | |
"type": "datetime" | |
}, | |
"end": { | |
"type": "datetime" | |
}, | |
"duration_minutes": { | |
"type": "integer" | |
}, | |
"approvalStatus": { | |
"type": "string" | |
}, | |
"createdAt": { | |
"type": "datetime", | |
"default": "NOW" | |
}, | |
"updatedAt": { | |
"type": "datetime", | |
"default": "NOW" | |
} | |
} |
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
/** | |
* TimeLog | |
* | |
* @module :: Model | |
* @description :: A short summary of how this model works and what it represents. | |
* @docs :: http://sailsjs.org/#!documentation/models | |
*/ | |
var uuid = require('node-uuid') | |
module.exports = { | |
//tableName : 'time_log_dev', | |
// migrate : 'safe', | |
attributes: { | |
id : { | |
type : 'string', | |
primaryKey : true, | |
required : true, | |
}, | |
end : { | |
type : 'datetime', | |
columnName : 'time_end' | |
}, | |
start : { | |
type : 'datetime', | |
columnName : 'time_start' | |
}, | |
//-> has one (stored in db) | |
employee : { | |
model : 'employee', | |
type : 'string' | |
}, | |
//-> has one (stored in db) | |
project : { | |
model : 'project', | |
type : 'string' | |
}, | |
operationcode : { | |
model : 'operationcode', | |
type : 'string' | |
}, | |
beforeCreate : function(values,cb){ | |
if(!values.id){ | |
values.id = uuid.v4(); | |
} | |
cb() | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment