You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Fipamo/brain/models/Post.js

122 lines
3.6 KiB
JavaScript

module.exports = function (sequelize, DataTypes) {
var Post = sequelize.define('Post', {
uuid: {
type: DataTypes.STRING(50),
unique: true,
allowNull: false
},
title: {
type: DataTypes.STRING(500),
allowNull: true
},
slug: {
type: DataTypes.STRING(500),
unique: false,
allowNull: true
},
tags: {
type: DataTypes.STRING(2000),
unique: false,
allowNull: true
},
entry_html: {
type: DataTypes.TEXT,
unique: false,
allowNull: true
},
entry_plaintext: {
type: DataTypes.TEXT,
unique: false,
allowNull: true
},
feature_image: {
type: DataTypes.STRING,
unique: false,
allowNull: true
},
page: {
type: DataTypes.BOOLEAN,
unique: false,
allowNull: true
},
author_id: {
type: DataTypes.INTEGER,
unique: false,
allowNull: true
},
origin_date: {
type: DataTypes.INTEGER,
unique: false,
allowNull: true
}
}, {
timestamps: true,
// don't delete database entries but set the newly added attribute deletedAt
// to the current date (when deletion was done). paranoid will only work if
// timestamps are enabled
paranoid: true,
// don't use camelcase for automatically added attributes but underscore style
// so updatedAt will be updated_at
underscored: true,
// disable the modification of table names; By default, sequelize will automatically
// transform all passed model names (first parameter of define) into plural.
// if you don't want that, set the following
freezeTableName: false,
// define the table's name
tableName: 'Posts',
// Enable optimistic locking. When enabled, sequelize will add a version count attriubte
// to the model and throw an OptimisticLockingError error when stale instances are saved.
// Set to true or a string with the attribute name you want to use to enable.
version: true
});
return Post;
};
/**
post: {
"id": "59711abc12d3ab0bd61c3abc",
"uuid": "ec630e45-3342-4d7f-a24c-e448263c975b",
"title": "Welcome to Ghost",
"slug": "welcome-to-ghost",
"mobiledoc": "{\"version\":\"0.3.1\",\"markups\":[],\"atoms\":[],\"cards\":[[\"card-markdown\",{\"cardName\":\"card-markdown\",\"markdown\":\"You're live nice!\"}]],\"sections\":[[10,0]]}",
"html": "<p>You're live! Nice.</p>",
"plaintext": "You're live! Nice.",
"amp": "Not what you think!",
"feature_image": "/content/images/2014/12/my-image.png",
"featured": false,
"page": false,
"status": "published",
"locale": null,
"visibility": "public",
"meta_title": null,
"meta_description": null,
"author_id": "59711abc78f1ab0bd61c3efg",
"created_at": "2014-04-15T12:36:28.353Z",
"created_by": "59711abc78f1ab0bd61c3efg",
"updated_at": "2014-04-15T12:36:28.353Z",
"updated_by": "59711abc78f1ab0bd61c3efg",
"published_at": "2014-04-15T12:36:28.363Z",
"published_by": "59711abc78f1ab0bd61c3efg",
"custom_excerpt": null,
"codeinjection_head": null,
"codeinjection_foot": null,
"og_image": null,
"og_title": null,
"og_description": null,
"twitter_image": null,
"twitter_title": null,
"twitter_description": null
}
**/