chore: Remove over-usage of invariant (#3719)
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import invariant from "invariant";
|
||||
import { Transaction } from "sequelize";
|
||||
import { Document, Event, User } from "@server/models";
|
||||
|
||||
@@ -105,14 +104,12 @@ export default async function documentCreator({
|
||||
// reload to get all of the data needed to present (user, collection etc)
|
||||
// we need to specify publishedAt to bypass default scope that only returns
|
||||
// published documents
|
||||
const doc = await Document.findOne({
|
||||
return await Document.findOne({
|
||||
where: {
|
||||
id: document.id,
|
||||
publishedAt: document.publishedAt,
|
||||
},
|
||||
rejectOnEmpty: true,
|
||||
transaction,
|
||||
});
|
||||
invariant(doc, "Document must exist");
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user