chore: Remove all usage of collection.type (#1445)
* chore: Remove all usage of collection.type * migration: Remove type column
This commit is contained in:
@@ -23,12 +23,6 @@ const Collection = sequelize.define(
|
||||
color: DataTypes.STRING,
|
||||
private: DataTypes.BOOLEAN,
|
||||
maintainerApprovalRequired: DataTypes.BOOLEAN,
|
||||
type: {
|
||||
type: DataTypes.STRING,
|
||||
validate: { isIn: [["atlas", "journal"]] },
|
||||
},
|
||||
|
||||
/* type: atlas */
|
||||
documentStructure: DataTypes.JSONB,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -134,7 +134,6 @@ Team.prototype.provisionFirstCollection = async function (userId) {
|
||||
name: "Welcome",
|
||||
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!",
|
||||
type: "atlas",
|
||||
teamId: this.id,
|
||||
creatorId: userId,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user