chore: Remove Fix decorator (#13100)

* chore: Remove Fix decorator

* test
This commit is contained in:
Tom Moor authored and GitHub committed 2026-07-23 09:10:17 -04:00
1 parent 9884e0379f
commit 77b01f11fc
45 files changed
+8 -167

No files matched your search

-2
View File
@@ -17,7 +17,6 @@ import {
import Document from "./Document";
import Team from "./Team";
import User from "./User";
import Fix from "./decorators/Fix";
import IdModel from "./base/IdModel";
import { IsIn } from "class-validator";
import { ValidationError } from "@server/errors";
@@ -45,7 +44,6 @@ export enum AccessRequestStatus {
tableName: "access_requests",
modelName: "access_request",
})
@Fix
class AccessRequest extends IdModel<
InferAttributes<AccessRequest>,
Partial<InferCreationAttributes<AccessRequest>>
-2
View File
@@ -21,7 +21,6 @@ import { hash } from "@server/utils/crypto";
import User from "./User";
import ParanoidModel from "./base/ParanoidModel";
import { SkipChangeset } from "./decorators/Changeset";
import Fix from "./decorators/Fix";
import AuthenticationHelper from "@shared/helpers/AuthenticationHelper";
import Length from "./validators/Length";
@@ -35,7 +34,6 @@ import Length from "./validators/Length";
],
},
}))
@Fix
class ApiKey extends ParanoidModel<
InferAttributes<ApiKey>,
Partial<InferCreationAttributes<ApiKey>>
-2
View File
@@ -30,13 +30,11 @@ import Team from "./Team";
import User from "./User";
import IdModel from "./base/IdModel";
import { SkipChangeset } from "./decorators/Changeset";
import Fix from "./decorators/Fix";
import Length from "./validators/Length";
import Logger from "@server/logging/Logger";
import { Buckets } from "./helpers/AttachmentHelper";
@Table({ tableName: "attachments", modelName: "attachment" })
@Fix
class Attachment extends IdModel<
InferAttributes<Attachment>,
Partial<InferCreationAttributes<Attachment>>
-2
View File
@@ -24,7 +24,6 @@ import Model from "@server/models/base/Model";
import { ValidationError } from "../errors";
import Team from "./Team";
import UserAuthentication from "./UserAuthentication";
import Fix from "./decorators/Fix";
import Length from "./validators/Length";
// TODO: Avoid this hardcoding of plugins
@@ -53,7 +52,6 @@ import type { DestroyOptions } from "sequelize";
modelName: "authentication_provider",
updatedAt: false,
})
@Fix
class AuthenticationProvider extends Model<
InferAttributes<AuthenticationProvider>,
Partial<InferCreationAttributes<AuthenticationProvider>>
-2
View File
@@ -73,7 +73,6 @@ import Team from "./Team";
import User from "./User";
import UserMembership from "./UserMembership";
import ParanoidModel from "./base/ParanoidModel";
import Fix from "./decorators/Fix";
import { DocumentHelper } from "./helpers/DocumentHelper";
import IsHexColor from "./validators/IsHexColor";
import Length from "./validators/Length";
@@ -198,7 +197,6 @@ type AdditionalFindOptions = {
},
}))
@Table({ tableName: "collections", modelName: "collection" })
@Fix
class Collection extends ParanoidModel<
InferAttributes<Collection>,
Partial<InferCreationAttributes<Collection>>
-2
View File
@@ -28,7 +28,6 @@ import Document from "./Document";
import User from "./User";
import { type HookContext } from "./base/Model";
import ParanoidModel from "./base/ParanoidModel";
import Fix from "./decorators/Fix";
import TextLength from "./validators/TextLength";
import { SkipChangeset } from "./decorators/Changeset";
@@ -47,7 +46,6 @@ import { SkipChangeset } from "./decorators/Changeset";
],
}))
@Table({ tableName: "comments", modelName: "comment" })
@Fix
class Comment extends ParanoidModel<
InferAttributes<Comment>,
Partial<InferCreationAttributes<Comment>>
-2
View File
@@ -72,7 +72,6 @@ import UserMembership from "./UserMembership";
import View from "./View";
import ArchivableModel from "./base/ArchivableModel";
import { CounterCache } from "./decorators/CounterCache";
import Fix from "./decorators/Fix";
import { DocumentHelper } from "./helpers/DocumentHelper";
import IsHexColor from "./validators/IsHexColor";
import Length from "./validators/Length";
@@ -284,7 +283,6 @@ interface QueryGeneratorWithWhere {
},
}))
@Table({ tableName: "documents", modelName: "document" })
@Fix
class Document extends ArchivableModel<
InferAttributes<Document>,
Partial<InferCreationAttributes<Document>>
-2
View File
@@ -12,7 +12,6 @@ import Document from "./Document";
import Team from "./Team";
import IdModel from "./base/IdModel";
import { SkipChangeset } from "./decorators/Changeset";
import Fix from "./decorators/Fix";
export enum DocumentInsightPeriod {
Day = "day",
@@ -32,7 +31,6 @@ export enum DocumentInsightPeriod {
},
],
})
@Fix
class DocumentInsight extends IdModel<
InferAttributes<DocumentInsight>,
Partial<InferCreationAttributes<DocumentInsight>>
-2
View File
@@ -14,14 +14,12 @@ import { ValidationError } from "@server/errors";
import Team from "./Team";
import User from "./User";
import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
import Length from "./validators/Length";
import { Matches } from "class-validator";
import FileStorage from "@server/storage/files";
import Attachment from "./Attachment";
@Table({ tableName: "emojis", modelName: "emoji" })
@Fix
class Emoji extends IdModel<
InferAttributes<Emoji>,
Partial<InferCreationAttributes<Emoji>>
-2
View File
@@ -26,11 +26,9 @@ import Document from "./Document";
import Team from "./Team";
import User from "./User";
import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
import type { Context } from "koa";
@Table({ tableName: "events", modelName: "event", updatedAt: false })
@Fix
class Event extends IdModel<
InferAttributes<Event>,
Partial<InferCreationAttributes<Event>>
-2
View File
@@ -10,14 +10,12 @@ import AuthenticationProvider from "./AuthenticationProvider";
import Group from "./Group";
import Team from "./Team";
import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
import Length from "./validators/Length";
@Table({
tableName: "external_groups",
modelName: "external_group",
})
@Fix
class ExternalGroup extends IdModel<
InferAttributes<ExternalGroup>,
Partial<InferCreationAttributes<ExternalGroup>>
-2
View File
@@ -22,7 +22,6 @@ import Document from "./Document";
import Team from "./Team";
import User from "./User";
import ParanoidModel from "./base/ParanoidModel";
import Fix from "./decorators/Fix";
import { Buckets } from "./helpers/AttachmentHelper";
export type FileOperationOptions = {
@@ -54,7 +53,6 @@ export type FileOperationOptions = {
],
}))
@Table({ tableName: "file_operations", modelName: "file_operation" })
@Fix
class FileOperation extends ParanoidModel<
InferAttributes<FileOperation>,
Partial<InferCreationAttributes<FileOperation>>
-2
View File
@@ -18,7 +18,6 @@ import Team from "./Team";
import User from "./User";
import ParanoidModel from "./base/ParanoidModel";
import { CounterCache } from "./decorators/CounterCache";
import Fix from "./decorators/Fix";
import Length from "./validators/Length";
import NotContainsUrl from "./validators/NotContainsUrl";
@@ -58,7 +57,6 @@ import NotContainsUrl from "./validators/NotContainsUrl";
},
},
})
@Fix
class Group extends ParanoidModel<
InferAttributes<Group>,
Partial<InferCreationAttributes<Group>>
-2
View File
@@ -32,7 +32,6 @@ import User from "./User";
import UserMembership from "./UserMembership";
import { type HookContext } from "./base/Model";
import ParanoidModel from "./base/ParanoidModel";
import Fix from "./decorators/Fix";
/**
* Represents a group's permission to access a collection or document.
@@ -71,7 +70,6 @@ import Fix from "./decorators/Fix";
},
}))
@Table({ tableName: "group_permissions", modelName: "group_permission" })
@Fix
class GroupMembership extends ParanoidModel<
InferAttributes<GroupMembership>,
Partial<InferCreationAttributes<GroupMembership>>
-2
View File
@@ -11,7 +11,6 @@ import { GroupPermission } from "@shared/types";
import Group from "./Group";
import User from "./User";
import Model from "./base/Model";
import Fix from "./decorators/Fix";
@Scopes(() => ({
withGroup: {
@@ -30,7 +29,6 @@ import Fix from "./decorators/Fix";
},
}))
@Table({ tableName: "group_users", modelName: "group_user" })
@Fix
class GroupUser extends Model<
InferAttributes<GroupUser>,
Partial<InferCreationAttributes<GroupUser>>
-2
View File
@@ -24,7 +24,6 @@ import Integration from "./Integration";
import Team from "./Team";
import User from "./User";
import ParanoidModel from "./base/ParanoidModel";
import Fix from "./decorators/Fix";
import Length from "./validators/Length";
import NotContainsUrl from "./validators/NotContainsUrl";
@@ -38,7 +37,6 @@ import NotContainsUrl from "./validators/NotContainsUrl";
],
}))
@Table({ tableName: "imports", modelName: "import" })
@Fix
class Import<T extends ImportableIntegrationService> extends ParanoidModel<
InferAttributes<Import<T>>,
Partial<InferCreationAttributes<Import<T>>>
-2
View File
@@ -14,7 +14,6 @@ import type { ImportableIntegrationService } from "@shared/types";
import { ImportTaskPhase, ImportTaskState } from "@shared/types";
import Import from "./Import";
import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
// Not all fields are automatically inferred by Sequelize.
// see https://sequelize.org/docs/v7/models/model-typing/#manual-attribute-typing
@@ -31,7 +30,6 @@ export type ImportTaskCreationAttributes<
Partial<NonInferredAttributes<T>>;
@Table({ tableName: "import_tasks", modelName: "import_task" })
@Fix
class ImportTask<T extends ImportableIntegrationService> extends IdModel<
ImportTaskAttributes<T>,
ImportTaskCreationAttributes<T>
-2
View File
@@ -18,7 +18,6 @@ import IntegrationAuthentication from "@server/models/IntegrationAuthentication"
import Team from "@server/models/Team";
import User from "@server/models/User";
import ParanoidModel from "@server/models/base/ParanoidModel";
import Fix from "@server/models/decorators/Fix";
@Scopes(() => ({
withAuthentication: {
@@ -32,7 +31,6 @@ import Fix from "@server/models/decorators/Fix";
},
}))
@Table({ tableName: "integrations", modelName: "integration" })
@Fix
class Integration<T = unknown> extends ParanoidModel<
InferAttributes<Integration<T>>,
Partial<InferCreationAttributes<Integration<T>>>
@@ -17,7 +17,6 @@ import Team from "./Team";
import User from "./User";
import IdModel from "./base/IdModel";
import Encrypted from "./decorators/Encrypted";
import Fix from "./decorators/Fix";
import { Minute } from "@shared/utils/time";
import { addSeconds } from "date-fns";
@@ -32,7 +31,6 @@ export type TokenRefreshCallback = (
) => Promise<TokenRefreshResponse>;
@Table({ tableName: "authentications", modelName: "authentication" })
@Fix
class IntegrationAuthentication extends IdModel<
InferAttributes<IntegrationAuthentication>,
Partial<InferCreationAttributes<IntegrationAuthentication>>
-2
View File
@@ -32,7 +32,6 @@ import Revision from "./Revision";
import Team from "./Team";
import User from "./User";
import Group from "./Group";
import Fix from "./decorators/Fix";
import AccessRequest from "./AccessRequest";
let baseDomain;
@@ -102,7 +101,6 @@ let baseDomain;
modelName: "notification",
updatedAt: false,
})
@Fix
class Notification extends Model<
InferAttributes<Notification>,
Partial<InferCreationAttributes<Notification>>
-2
View File
@@ -12,10 +12,8 @@ import Document from "./Document";
import Team from "./Team";
import User from "./User";
import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
@Table({ tableName: "pins", modelName: "pin" })
@Fix
class Pin extends IdModel<
InferAttributes<Pin>,
Partial<InferCreationAttributes<Pin>>
-2
View File
@@ -21,11 +21,9 @@ import type { APIContext } from "@server/types";
import Comment from "./Comment";
import User from "./User";
import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
import Length from "./validators/Length";
@Table({ tableName: "reactions", modelName: "reaction" })
@Fix
class Reaction extends IdModel<
InferAttributes<Reaction>,
Partial<InferCreationAttributes<Reaction>>
-2
View File
@@ -9,7 +9,6 @@ import {
import Document from "./Document";
import User from "./User";
import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
export enum RelationshipType {
Backlink = "backlink",
@@ -17,7 +16,6 @@ export enum RelationshipType {
}
@Table({ tableName: "relationships", modelName: "relationship" })
@Fix
class Relationship extends IdModel<
InferAttributes<Relationship>,
Partial<InferCreationAttributes<Relationship>>
-2
View File
@@ -17,7 +17,6 @@ import type { APIContext } from "@server/types";
import Document from "./Document";
import User from "./User";
import ParanoidModel from "./base/ParanoidModel";
import Fix from "./decorators/Fix";
import IsHexColor from "./validators/IsHexColor";
import Length from "./validators/Length";
import { SkipChangeset } from "./decorators/Changeset";
@@ -32,7 +31,6 @@ import { SkipChangeset } from "./decorators/Changeset";
],
}))
@Table({ tableName: "revisions", modelName: "revision" })
@Fix
class Revision extends ParanoidModel<
InferAttributes<Revision>,
Partial<InferCreationAttributes<Revision>>
-2
View File
@@ -16,7 +16,6 @@ import Share from "@server/models/Share";
import Team from "@server/models/Team";
import User from "@server/models/User";
import Model from "@server/models/base/Model";
import Fix from "./decorators/Fix";
/**
* Where a search query originated.
@@ -34,7 +33,6 @@ export enum SearchQuerySource {
modelName: "search_query",
updatedAt: false,
})
@Fix
class SearchQuery extends Model<
InferAttributes<SearchQuery>,
Partial<InferCreationAttributes<SearchQuery>>
-2
View File
@@ -24,7 +24,6 @@ import Document from "./Document";
import Team from "./Team";
import User from "./User";
import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
import IsFQDN from "./validators/IsFQDN";
import IsUrlOrRelativePath from "./validators/IsUrlOrRelativePath";
import Length from "./validators/Length";
@@ -105,7 +104,6 @@ import Length from "./validators/Length";
}),
}))
@Table({ tableName: "shares", modelName: "share" })
@Fix
class Share extends IdModel<
InferAttributes<Share>,
Partial<InferCreationAttributes<Share>>
-2
View File
@@ -15,7 +15,6 @@ import { ValidationError } from "@server/errors";
import Document from "./Document";
import Share from "./Share";
import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
/**
* A subscription to email notifications for updates to a publicly shared
@@ -30,7 +29,6 @@ import Fix from "./decorators/Fix";
},
}))
@Table({ tableName: "share_subscriptions", modelName: "share_subscription" })
@Fix
class ShareSubscription extends IdModel<
InferAttributes<ShareSubscription>,
Partial<InferCreationAttributes<ShareSubscription>>
-2
View File
@@ -11,10 +11,8 @@ import Collection from "./Collection";
import Document from "./Document";
import User from "./User";
import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
@Table({ tableName: "stars", modelName: "star" })
@Fix
class Star extends IdModel<
InferAttributes<Star>,
Partial<InferCreationAttributes<Star>>
-2
View File
@@ -13,7 +13,6 @@ import Collection from "./Collection";
import Document from "./Document";
import User from "./User";
import ParanoidModel from "./base/ParanoidModel";
import Fix from "./decorators/Fix";
@Scopes(() => ({
withUser: {
@@ -25,7 +24,6 @@ import Fix from "./decorators/Fix";
},
}))
@Table({ tableName: "subscriptions", modelName: "subscription" })
@Fix
class Subscription extends ParanoidModel<
InferAttributes<Subscription>,
Partial<InferCreationAttributes<Subscription>>
-2
View File
@@ -44,7 +44,6 @@ import Share from "./Share";
import TeamDomain from "./TeamDomain";
import User from "./User";
import ParanoidModel from "./base/ParanoidModel";
import Fix from "./decorators/Fix";
import IsFQDN from "./validators/IsFQDN";
import IsUrlOrRelativePath from "./validators/IsUrlOrRelativePath";
import Length from "./validators/Length";
@@ -74,7 +73,6 @@ const avatarRedirectPattern = new RegExp(attachmentRedirectRegex.source, "i");
},
}))
@Table({ tableName: "teams", modelName: "team" })
@Fix
class Team extends ParanoidModel<
InferAttributes<Team>,
Partial<InferCreationAttributes<Team>>
-2
View File
@@ -17,12 +17,10 @@ import { ValidationError } from "@server/errors";
import Team from "./Team";
import User from "./User";
import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
import IsFQDN from "./validators/IsFQDN";
import Length from "./validators/Length";
@Table({ tableName: "team_domains", modelName: "team_domain" })
@Fix
class TeamDomain extends IdModel<
InferAttributes<TeamDomain>,
Partial<InferCreationAttributes<TeamDomain>>
-2
View File
@@ -32,7 +32,6 @@ import Revision from "./Revision";
import Team from "./Team";
import User from "./User";
import ParanoidModel from "./base/ParanoidModel";
import Fix from "./decorators/Fix";
import IsHexColor from "./validators/IsHexColor";
import Length from "./validators/Length";
@@ -87,7 +86,6 @@ type AdditionalFindOptions = {
},
}))
@Table({ tableName: "documents", modelName: "template" })
@Fix
class Template extends ParanoidModel<
InferAttributes<Template>,
Partial<InferCreationAttributes<Template>>
-2
View File
@@ -68,7 +68,6 @@ import UserMembership from "./UserMembership";
import UserPasskey from "./UserPasskey";
import ParanoidModel from "./base/ParanoidModel";
import Encrypted from "./decorators/Encrypted";
import Fix from "./decorators/Fix";
import IsUrlOrRelativePath from "./validators/IsUrlOrRelativePath";
import Length from "./validators/Length";
import NotContainsUrl from "./validators/NotContainsUrl";
@@ -133,7 +132,6 @@ export enum UserFlag {
},
}))
@Table({ tableName: "users", modelName: "user" })
@Fix
class User extends ParanoidModel<
InferAttributes<User>,
Partial<InferCreationAttributes<User>>
-2
View File
@@ -20,10 +20,8 @@ import AuthenticationProvider from "./AuthenticationProvider";
import User from "./User";
import IdModel from "./base/IdModel";
import Encrypted from "./decorators/Encrypted";
import Fix from "./decorators/Fix";
@Table({ tableName: "user_authentications", modelName: "user_authentication" })
@Fix
class UserAuthentication extends IdModel<
InferAttributes<UserAuthentication>,
Partial<InferCreationAttributes<UserAuthentication>>
-2
View File
@@ -29,7 +29,6 @@ import GroupMembership from "./GroupMembership";
import User from "./User";
import IdModel from "./base/IdModel";
import type { HookContext } from "./base/Model";
import Fix from "./decorators/Fix";
/**
* Represents a users's permission to access a collection or document.
@@ -68,7 +67,6 @@ import Fix from "./decorators/Fix";
},
}))
@Table({ tableName: "user_permissions", modelName: "user_permission" })
@Fix
class UserMembership extends IdModel<
InferAttributes<UserMembership>,
Partial<InferCreationAttributes<UserMembership>>
-2
View File
@@ -10,13 +10,11 @@ import {
} from "sequelize-typescript";
import User from "./User";
import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
import { UserPasskeyValidation } from "@shared/validations";
import NotContainsUrl from "./validators/NotContainsUrl";
import { SkipChangeset } from "./decorators/Changeset";
@Table({ tableName: "user_passkeys", modelName: "user_passkey" })
@Fix
class UserPasskey extends IdModel<
InferAttributes<UserPasskey>,
Partial<InferCreationAttributes<UserPasskey>>
-2
View File
@@ -18,7 +18,6 @@ import Document from "./Document";
import Event from "./Event";
import User from "./User";
import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
import { SkipChangeset } from "./decorators/Changeset";
@Scopes(() => ({
@@ -33,7 +32,6 @@ import { SkipChangeset } from "./decorators/Changeset";
}),
}))
@Table({ tableName: "views", modelName: "view" })
@Fix
class View extends IdModel<
InferAttributes<View>,
Partial<InferCreationAttributes<View>>
-2
View File
@@ -11,13 +11,11 @@ import {
import { type WebhookDeliveryStatus } from "@server/types";
import WebhookSubscription from "./WebhookSubscription";
import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
@Table({
tableName: "webhook_deliveries",
modelName: "webhook_delivery",
})
@Fix
class WebhookDelivery extends IdModel<
InferAttributes<WebhookDelivery>,
Partial<InferCreationAttributes<WebhookDelivery>>
-2
View File
@@ -31,7 +31,6 @@ import Team from "./Team";
import User from "./User";
import ParanoidModel from "./base/ParanoidModel";
import Encrypted from "./decorators/Encrypted";
import Fix from "./decorators/Fix";
import IsUrl from "./validators/IsUrl";
import Length from "./validators/Length";
import { randomString } from "@shared/random";
@@ -48,7 +47,6 @@ import { randomString } from "@shared/random";
tableName: "webhook_subscriptions",
modelName: "webhook_subscription",
})
@Fix
class WebhookSubscription extends ParanoidModel<
InferAttributes<WebhookSubscription>,
Partial<InferCreationAttributes<WebhookSubscription>>
+2
View File
@@ -64,6 +64,8 @@ export default function Encrypted(target: object, propertyKey: string) {
}
return {
configurable: true,
enumerable: true,
get() {
const attributeOptions = getAttributes(target);
const defaultValue = attributeOptions[propertyKey].allowNull ? null : "";
-77
View File
@@ -1,77 +0,0 @@
/**
* A decorator that must be applied to every model definition to workaround
* babel <> typescript incompatibility. See the following issue:
* https://github.com/RobinBuschmann/sequelize-typescript/issues/612#issuecomment-491890977
*
* @param target model class
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- decorator extends a Sequelize Model class with dynamic statics (rawAttributes, associations) that defy precise typing.
export default function Fix(target: any): void {
return class extends target {
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mixin constructor must accept arbitrary Sequelize Model args.
constructor(...args: any[]) {
// suppresses warning from here which is not applicable in our typescript
// environment: https://github.com/sequelize/sequelize/blob/00ced18c2cb2a8b99ae0ebf5669c124abb4c673d/src/model.js#L99
target._overwrittenAttributesChecked = true;
super(...args);
const rawAttributes = Object.keys(new.target.rawAttributes);
const associations = Object.keys(new.target.associations);
rawAttributes.forEach((propertyKey) => {
// check if we already defined getter/setter – if so, do not override
const desc = Object.getOwnPropertyDescriptor(
target.prototype,
propertyKey
);
if (desc) {
return;
}
Object.defineProperty(this, propertyKey, {
// Keep configurable/enumerable so consumers (e.g. sequelize-strict-attributes)
// can re-define these accessors; with non-define class fields the property
// would otherwise default to non-configurable.
configurable: true,
enumerable: true,
get() {
// Safety check for test serialization - getDataValue may not be available
// during serialization for inter-process communication
if (typeof this.getDataValue === "function") {
return this.getDataValue(propertyKey);
}
// Fallback to direct dataValues access
return this.dataValues?.[propertyKey];
},
set(value) {
// Safety check for test serialization - setDataValue may not be available
// during serialization for inter-process communication
if (typeof this.setDataValue === "function") {
this.setDataValue(propertyKey, value);
} else if (this.dataValues) {
// Fallback to direct dataValues assignment
this.dataValues[propertyKey] = value;
}
},
});
});
associations.forEach((propertyKey) => {
Object.defineProperty(this, propertyKey, {
configurable: true,
enumerable: true,
get() {
return this.dataValues[propertyKey];
},
set(value) {
// sets without changing the "changed" flag for associations
this.dataValues[propertyKey] = value;
},
});
});
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mixin class returned in place of original target; consumer expects original class shape.
} as any;
}
@@ -19,7 +19,6 @@ import env from "@server/env";
import User from "@server/models/User";
import ParanoidModel from "@server/models/base/ParanoidModel";
import { SkipChangeset } from "@server/models/decorators/Changeset";
import Fix from "@server/models/decorators/Fix";
import AuthenticationHelper from "@shared/helpers/AuthenticationHelper";
import { hash } from "@server/utils/crypto";
import OAuthClient from "./OAuthClient";
@@ -28,7 +27,6 @@ import OAuthClient from "./OAuthClient";
tableName: "oauth_authentications",
modelName: "oauth_authentication",
})
@Fix
class OAuthAuthentication extends ParanoidModel<
InferAttributes<OAuthAuthentication>,
Partial<InferCreationAttributes<OAuthAuthentication>>
@@ -14,7 +14,6 @@ import env from "@server/env";
import User from "@server/models/User";
import IdModel from "@server/models/base/IdModel";
import { SkipChangeset } from "@server/models/decorators/Changeset";
import Fix from "@server/models/decorators/Fix";
import { hash } from "@server/utils/crypto";
import OAuthClient from "./OAuthClient";
@@ -23,7 +22,6 @@ import OAuthClient from "./OAuthClient";
modelName: "oauth_authorization_code",
updatedAt: false,
})
@Fix
class OAuthAuthorizationCode extends IdModel<
InferAttributes<OAuthAuthorizationCode>,
Partial<InferCreationAttributes<OAuthAuthorizationCode>>
-2
View File
@@ -25,7 +25,6 @@ import User from "@server/models/User";
import ParanoidModel from "@server/models/base/ParanoidModel";
import { SkipChangeset } from "@server/models/decorators/Changeset";
import Encrypted from "@server/models/decorators/Encrypted";
import Fix from "@server/models/decorators/Fix";
import { hash } from "@server/utils/crypto";
import IsUrlOrRelativePath from "@server/models/validators/IsUrlOrRelativePath";
import Length from "@server/models/validators/Length";
@@ -36,7 +35,6 @@ import type { FindOptions } from "sequelize";
tableName: "oauth_clients",
modelName: "oauth_client",
})
@Fix
class OAuthClient extends ParanoidModel<
InferAttributes<OAuthClient>,
Partial<InferCreationAttributes<OAuthClient>>
@@ -32,7 +32,7 @@ beforeEach(async () => {
function updateDocumentText(document: Document, text: string) {
document.content = parser.parse(text)?.toJSON();
document.updatedAt = new Date();
document.setDataValue("updatedAt", new Date());
return document;
}
@@ -569,7 +569,7 @@ describe("revisions.create", () => {
],
},
]).toJSON();
document.updatedAt = new Date();
document.setDataValue("updatedAt", new Date());
await document.save();
const revision = await Revision.createFromDocument(
@@ -636,7 +636,7 @@ describe("revisions.create", () => {
],
},
]).toJSON();
document.updatedAt = new Date();
document.setDataValue("updatedAt", new Date());
await document.save();
const revision = await Revision.createFromDocument(
@@ -674,7 +674,7 @@ describe("revisions.create", () => {
content: [buildMention({ modelId: mentioned.id, actorId: actor.id })],
},
]).toJSON();
document.updatedAt = new Date();
document.setDataValue("updatedAt", new Date());
await document.save();
const revision = await Revision.createFromDocument(
@@ -727,7 +727,7 @@ describe("revisions.create", () => {
content: [buildMention({ modelId: mentioned.id, actorId: actor.id })],
},
]).toJSON();
document.updatedAt = new Date();
document.setDataValue("updatedAt", new Date());
await document.save();
const revision = await Revision.createFromDocument(
@@ -793,7 +793,7 @@ describe("revisions.create", () => {
],
},
]).toJSON();
document.updatedAt = new Date();
document.setDataValue("updatedAt", new Date());
await document.save();
const revision = await Revision.createFromDocument(