chore: Remove all usage of collection.type (#1445)

* chore: Remove all usage of collection.type

* migration: Remove type column
This commit is contained in:
Tom Moor
2020-08-12 10:49:02 -07:00
committed by GitHub
parent 810dc5a061
commit d055021ad4
11 changed files with 20 additions and 30 deletions

View File

@@ -441,7 +441,7 @@ Document.addHook("beforeSave", async (model) => {
}
const collection = await Collection.findByPk(model.collectionId);
if (!collection || collection.type !== "atlas") {
if (!collection) {
return;
}
@@ -455,7 +455,7 @@ Document.addHook("afterCreate", async (model) => {
}
const collection = await Collection.findByPk(model.collectionId);
if (!collection || collection.type !== "atlas") {
if (!collection) {
return;
}
@@ -548,8 +548,6 @@ Document.prototype.publish = async function (options) {
if (this.publishedAt) return this.save(options);
const collection = await Collection.findByPk(this.collectionId);
if (collection.type !== "atlas") return this.save(options);
await collection.addDocumentToStructure(this);
this.publishedAt = new Date();