mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
fix: withoutState scope should include state as fallback (#9144)
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
FindOptions,
|
||||
WhereOptions,
|
||||
EmptyResultError,
|
||||
Sequelize,
|
||||
} from "sequelize";
|
||||
import {
|
||||
ForeignKey,
|
||||
@@ -104,10 +105,18 @@ type AdditionalFindOptions = {
|
||||
exclude: ["state"],
|
||||
},
|
||||
}))
|
||||
// @ts-expect-error Type 'Literal' is not assignable to type 'string | ProjectionAlias'.
|
||||
@Scopes(() => ({
|
||||
withoutState: {
|
||||
attributes: {
|
||||
exclude: ["state"],
|
||||
include: [
|
||||
Sequelize.literal(
|
||||
// If content (JSON) is null then we still need to return the state column (BINARY)
|
||||
// as it's used as a fallback for content deserialization for older documents.
|
||||
// This can be removed if content is 100% backfilled.
|
||||
`CASE WHEN document.content IS NULL THEN document.state ELSE NULL END AS state`
|
||||
),
|
||||
],
|
||||
},
|
||||
},
|
||||
withCollection: {
|
||||
|
||||
Reference in New Issue
Block a user