chore: rename collection creatorId to createdById (#1794)
This commit is contained in:
@@ -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,
|
||||
});
|
||||
|
||||
@@ -131,9 +131,9 @@ describe("#updateDocument", () => {
|
||||
parentDocumentId: document.id,
|
||||
collectionId: collection.id,
|
||||
teamId: collection.teamId,
|
||||
userId: collection.creatorId,
|
||||
lastModifiedById: collection.creatorId,
|
||||
createdById: collection.creatorId,
|
||||
userId: collection.createdById,
|
||||
lastModifiedById: collection.createdById,
|
||||
createdById: collection.createdById,
|
||||
title: "Child document",
|
||||
text: "content",
|
||||
});
|
||||
@@ -184,9 +184,9 @@ describe("#removeDocument", () => {
|
||||
parentDocumentId: document.id,
|
||||
collectionId: collection.id,
|
||||
teamId: collection.teamId,
|
||||
userId: collection.creatorId,
|
||||
lastModifiedById: collection.creatorId,
|
||||
createdById: collection.creatorId,
|
||||
userId: collection.createdById,
|
||||
lastModifiedById: collection.createdById,
|
||||
createdById: collection.createdById,
|
||||
title: "Child document",
|
||||
text: "content",
|
||||
});
|
||||
@@ -212,9 +212,9 @@ describe("#removeDocument", () => {
|
||||
parentDocumentId: document.id,
|
||||
collectionId: collection.id,
|
||||
teamId: collection.teamId,
|
||||
userId: collection.creatorId,
|
||||
lastModifiedById: collection.creatorId,
|
||||
createdById: collection.creatorId,
|
||||
userId: collection.createdById,
|
||||
lastModifiedById: collection.createdById,
|
||||
createdById: collection.createdById,
|
||||
publishedAt: new Date(),
|
||||
title: "Child document",
|
||||
text: "content",
|
||||
|
||||
@@ -144,7 +144,7 @@ Team.prototype.provisionFirstCollection = async function (userId) {
|
||||
description:
|
||||
"This collection is a quick guide to what Outline is all about. Feel free to delete this collection once your team is up to speed with the basics!",
|
||||
teamId: this.id,
|
||||
creatorId: userId,
|
||||
createdById: userId,
|
||||
sort: Collection.DEFAULT_SORT,
|
||||
});
|
||||
|
||||
@@ -175,9 +175,9 @@ Team.prototype.provisionFirstCollection = async function (userId) {
|
||||
parentDocumentId: null,
|
||||
collectionId: collection.id,
|
||||
teamId: collection.teamId,
|
||||
userId: collection.creatorId,
|
||||
lastModifiedById: collection.creatorId,
|
||||
createdById: collection.creatorId,
|
||||
userId: collection.createdById,
|
||||
lastModifiedById: collection.createdById,
|
||||
createdById: collection.createdById,
|
||||
title,
|
||||
text,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user