Pinned documents (#608)
* Migrations and API for pinned documents * Documentation * Add pin icon * Fin. * v0.2.0 * Remove pin from DocumentPreview, add general menu Add Pinned documents header * Tidy * Fixed: Drafts appearing on collection home
This commit is contained in:
@ -85,20 +85,6 @@ const Document = sequelize.define(
|
||||
revisionCount: { type: DataTypes.INTEGER, defaultValue: 0 },
|
||||
publishedAt: DataTypes.DATE,
|
||||
parentDocumentId: DataTypes.UUID,
|
||||
createdById: {
|
||||
type: DataTypes.UUID,
|
||||
allowNull: false,
|
||||
references: {
|
||||
model: 'users',
|
||||
},
|
||||
},
|
||||
lastModifiedById: {
|
||||
type: DataTypes.UUID,
|
||||
allowNull: false,
|
||||
references: {
|
||||
model: 'users',
|
||||
},
|
||||
},
|
||||
collaboratorIds: DataTypes.ARRAY(DataTypes.UUID),
|
||||
},
|
||||
{
|
||||
@ -129,6 +115,10 @@ Document.associate = models => {
|
||||
as: 'updatedBy',
|
||||
foreignKey: 'lastModifiedById',
|
||||
});
|
||||
Document.belongsTo(models.User, {
|
||||
as: 'pinnedBy',
|
||||
foreignKey: 'pinnedById',
|
||||
});
|
||||
Document.hasMany(models.Revision, {
|
||||
as: 'revisions',
|
||||
onDelete: 'cascade',
|
||||
|
Reference in New Issue
Block a user