perf: Don't load CRDT state from database by default (#3215)
This commit is contained in:
@@ -69,6 +69,9 @@ const serializer = new MarkdownSerializer();
|
||||
export const DOCUMENT_VERSION = 2;
|
||||
|
||||
@DefaultScope(() => ({
|
||||
attributes: {
|
||||
exclude: ["state"],
|
||||
},
|
||||
include: [
|
||||
{
|
||||
model: User,
|
||||
@@ -112,7 +115,18 @@ export const DOCUMENT_VERSION = 2;
|
||||
],
|
||||
};
|
||||
},
|
||||
withUnpublished: {
|
||||
withoutState: {
|
||||
attributes: {
|
||||
exclude: ["state"],
|
||||
},
|
||||
},
|
||||
withState: {
|
||||
attributes: {
|
||||
// resets to include the state column
|
||||
exclude: [],
|
||||
},
|
||||
},
|
||||
withDrafts: {
|
||||
include: [
|
||||
{
|
||||
model: User,
|
||||
@@ -370,7 +384,8 @@ class Document extends ParanoidModel {
|
||||
// allow default preloading of collection membership if `userId` is passed in find options
|
||||
// almost every endpoint needs the collection membership to determine policy permissions.
|
||||
const scope = this.scope([
|
||||
"withUnpublished",
|
||||
"withoutState",
|
||||
"withDrafts",
|
||||
{
|
||||
method: ["withCollection", options.userId, options.paranoid],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user