feat: Sharing improvements (#1388)
* add migrations * first pass at API * feat: Updated share dialog UI * tests * test * styling tweaks * feat: Show share state on document * fix: Allow publishing share links for draft docs * test: shares.info
This commit is contained in:
@ -9,6 +9,7 @@ const Share = sequelize.define(
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true,
|
||||
},
|
||||
published: DataTypes.BOOLEAN,
|
||||
revokedAt: DataTypes.DATE,
|
||||
revokedById: DataTypes.UUID,
|
||||
},
|
||||
@ -30,10 +31,17 @@ Share.associate = models => {
|
||||
as: "team",
|
||||
foreignKey: "teamId",
|
||||
});
|
||||
Share.belongsTo(models.Document, {
|
||||
Share.belongsTo(models.Document.scope("withUnpublished"), {
|
||||
as: "document",
|
||||
foreignKey: "documentId",
|
||||
});
|
||||
Share.addScope("defaultScope", {
|
||||
include: [
|
||||
{ association: "user" },
|
||||
{ association: "document" },
|
||||
{ association: "team" },
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
Share.prototype.revoke = function(userId) {
|
||||
|
Reference in New Issue
Block a user