chore: rename collection creatorId to createdById (#1794)

This commit is contained in:
Rubén Moya
2021-01-12 08:17:31 +01:00
committed by GitHub
parent d258082c5f
commit 47369dd968
10 changed files with 46 additions and 27 deletions

View File

@@ -103,7 +103,7 @@ Collection.associate = (models) => {
});
Collection.belongsTo(models.User, {
as: "user",
foreignKey: "creatorId",
foreignKey: "createdById",
});
Collection.belongsTo(models.Team, {
as: "team",
@@ -194,11 +194,11 @@ Collection.addHook("afterCreate", (model: Collection, options) => {
return CollectionUser.findOrCreate({
where: {
collectionId: model.id,
userId: model.creatorId,
userId: model.createdById,
},
defaults: {
permission: "read_write",
createdById: model.creatorId,
createdById: model.createdById,
},
transaction: options.transaction,
});