mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-28 22:15:12 -04:00
Merge pull request #830 from SISheogorath/feature/GDPR
GDPR compliant part 1
This commit is contained in:
commit
56d78a7d6c
13 changed files with 216 additions and 30 deletions
|
@ -24,12 +24,16 @@ module.exports = function (sequelize, DataTypes) {
|
|||
Author.belongsTo(models.Note, {
|
||||
foreignKey: 'noteId',
|
||||
as: 'note',
|
||||
constraints: false
|
||||
constraints: false,
|
||||
onDelete: 'CASCADE',
|
||||
hooks: true
|
||||
})
|
||||
Author.belongsTo(models.User, {
|
||||
foreignKey: 'userId',
|
||||
as: 'user',
|
||||
constraints: false
|
||||
constraints: false,
|
||||
onDelete: 'CASCADE',
|
||||
hooks: true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,13 +85,15 @@ module.exports = function (sequelize, DataTypes) {
|
|||
type: DataTypes.DATE
|
||||
}
|
||||
}, {
|
||||
paranoid: true,
|
||||
paranoid: false,
|
||||
classMethods: {
|
||||
associate: function (models) {
|
||||
Note.belongsTo(models.User, {
|
||||
foreignKey: 'ownerId',
|
||||
as: 'owner',
|
||||
constraints: false
|
||||
constraints: false,
|
||||
onDelete: 'CASCADE',
|
||||
hooks: true
|
||||
})
|
||||
Note.belongsTo(models.User, {
|
||||
foreignKey: 'lastchangeuserId',
|
||||
|
|
|
@ -102,7 +102,9 @@ module.exports = function (sequelize, DataTypes) {
|
|||
Revision.belongsTo(models.Note, {
|
||||
foreignKey: 'noteId',
|
||||
as: 'note',
|
||||
constraints: false
|
||||
constraints: false,
|
||||
onDelete: 'CASCADE',
|
||||
hooks: true
|
||||
})
|
||||
},
|
||||
getNoteRevisions: function (note, callback) {
|
||||
|
|
|
@ -31,6 +31,10 @@ module.exports = function (sequelize, DataTypes) {
|
|||
refreshToken: {
|
||||
type: DataTypes.TEXT
|
||||
},
|
||||
deleteToken: {
|
||||
type: DataTypes.UUID,
|
||||
defaultValue: Sequelize.UUIDV4
|
||||
},
|
||||
email: {
|
||||
type: Sequelize.TEXT,
|
||||
validate: {
|
||||
|
@ -66,6 +70,9 @@ module.exports = function (sequelize, DataTypes) {
|
|||
})
|
||||
},
|
||||
getProfile: function (user) {
|
||||
if (!user) {
|
||||
return null
|
||||
}
|
||||
return user.profile ? User.parseProfile(user.profile) : (user.email ? User.parseProfileByEmail(user.email) : null)
|
||||
},
|
||||
parseProfile: function (profile) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue