mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
adding uuid's for the posts, users, settings
This commit is contained in:
parent
057791893f
commit
a5b9274bb5
8 changed files with 37 additions and 6 deletions
File diff suppressed because one or more lines are too long
|
@ -5,6 +5,7 @@
|
|||
var Post,
|
||||
Posts,
|
||||
_ = require('underscore'),
|
||||
uuid = require('node-uuid'),
|
||||
when = require('when'),
|
||||
Showdown = require('showdown'),
|
||||
converter = new Showdown.converter(),
|
||||
|
@ -17,8 +18,11 @@
|
|||
|
||||
hasTimestamps: true,
|
||||
|
||||
defaults: {
|
||||
status: 'draft'
|
||||
defaults: function () {
|
||||
return {
|
||||
uuid: uuid.v4(),
|
||||
status: 'draft'
|
||||
};
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
var Settings,
|
||||
GhostBookshelf = require('./base'),
|
||||
uuid = require('node-uuid'),
|
||||
_ = require('underscore'),
|
||||
when = require('when');
|
||||
|
||||
|
@ -10,7 +11,12 @@
|
|||
// but the overlying API treats them as a single key:value mapping
|
||||
Settings = GhostBookshelf.Model.extend({
|
||||
tableName: 'settings',
|
||||
hasTimestamps: true
|
||||
hasTimestamps: true,
|
||||
defaults: function () {
|
||||
return {
|
||||
uuid: uuid.v4()
|
||||
};
|
||||
}
|
||||
}, {
|
||||
read: function (_key) {
|
||||
// Allow for just passing the key instead of attributes
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
UserRole,
|
||||
// UserRoles,
|
||||
_ = require('underscore'),
|
||||
uuid = require('node-uuid'),
|
||||
when = require('when'),
|
||||
nodefn = require('when/node/function'),
|
||||
bcrypt = require('bcrypt-nodejs'),
|
||||
|
@ -27,6 +28,12 @@
|
|||
|
||||
hasTimestamps: true,
|
||||
|
||||
defaults: function () {
|
||||
return {
|
||||
uuid: uuid.v4()
|
||||
};
|
||||
},
|
||||
|
||||
posts: function () {
|
||||
return this.hasMany(Posts, 'created_by');
|
||||
},
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
PostModel.add(newPost).then(function (createdPost) {
|
||||
should.exist(createdPost);
|
||||
|
||||
createdPost.has('uuid').should.equal(true);
|
||||
createdPost.get('status').should.equal('draft');
|
||||
createdPost.get('title').should.equal(newPost.title, "title is correct");
|
||||
createdPost.get('content').should.equal(newPost.content, "content is correct");
|
||||
|
|
|
@ -137,7 +137,7 @@
|
|||
SettingsModel.add(newSetting).then(function (createdSetting) {
|
||||
|
||||
should.exist(createdSetting);
|
||||
|
||||
createdSetting.has('uuid').should.equal(true);
|
||||
createdSetting.attributes.key.should.equal(newSetting.key, "key is correct");
|
||||
createdSetting.attributes.value.should.equal(newSetting.value, "value is correct");
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
when(helpers.resetData()).then(function (result) {
|
||||
UserModel.add(userData).then(function (createdUser) {
|
||||
should.exist(createdUser);
|
||||
createdUser.has('uuid').should.equal(true);
|
||||
createdUser.attributes.password.should.not.equal(userData.password, "password was hashed");
|
||||
createdUser.attributes.email_address.should.eql(userData.email_address, "email address corred");
|
||||
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
"underscore": "1.4.x",
|
||||
"showdown": "0.3.x",
|
||||
"sqlite3": "2.1.x",
|
||||
"bookshelf": "0.1.x",
|
||||
"bookshelf": ">=0.1.6",
|
||||
"knex": "0.1.x",
|
||||
"when": "2.1.x",
|
||||
"bcrypt-nodejs": "0.0.3"
|
||||
"bcrypt-nodejs": "0.0.3",
|
||||
"node-uuid": "~1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.1",
|
||||
|
|
Loading…
Add table
Reference in a new issue