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

@@ -718,7 +718,7 @@ router.post("documents.create", auth(), async (ctx) => {
authorize(user, "publish", collection);
let parentDocument;
if (parentDocumentId && collection.type === "atlas") {
if (parentDocumentId) {
parentDocument = await Document.findOne({
where: {
id: parentDocumentId,
@@ -938,13 +938,6 @@ router.post("documents.move", auth(), async (ctx) => {
const document = await Document.findByPk(id, { userId: user.id });
authorize(user, "move", document);
const { collection } = document;
if (collection.type !== "atlas" && parentDocumentId) {
throw new InvalidRequestError(
"Document cannot be nested in this collection type"
);
}
if (parentDocumentId) {
const parent = await Document.findByPk(parentDocumentId, {
userId: user.id,