Type server models (#6326)
* fix: type server models * fix: make ParanoidModel generic * fix: ApiKey * fix: Attachment * fix: AuthenticationProvider * fix: Backlink * fix: Collection * fix: Comment * fix: Document * fix: FileOperation * fix: Group * fix: GroupPermission * fix: GroupUser * fix: Integration * fix: IntegrationAuthentication * fix: Notification * fix: Pin * fix: Revision * fix: SearchQuery * fix: Share * fix: Star * fix: Subscription * fix: TypeError * fix: Imports * fix: Team * fix: TeamDomain * fix: User * fix: UserAuthentication * fix: UserPermission * fix: View * fix: WebhookDelivery * fix: WebhookSubscription * Remove type duplication --------- Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import crypto from "crypto";
|
||||
import isEmpty from "lodash/isEmpty";
|
||||
import { SaveOptions } from "sequelize";
|
||||
import {
|
||||
InferAttributes,
|
||||
InferCreationAttributes,
|
||||
InstanceUpdateOptions,
|
||||
} from "sequelize";
|
||||
import {
|
||||
Column,
|
||||
Table,
|
||||
@@ -39,7 +43,10 @@ import Length from "./validators/Length";
|
||||
modelName: "webhook_subscription",
|
||||
})
|
||||
@Fix
|
||||
class WebhookSubscription extends ParanoidModel {
|
||||
class WebhookSubscription extends ParanoidModel<
|
||||
InferAttributes<WebhookSubscription>,
|
||||
Partial<InferCreationAttributes<WebhookSubscription>>
|
||||
> {
|
||||
@NotEmpty
|
||||
@Length({ max: 255, msg: "Webhook name be less than 255 characters" })
|
||||
@Column
|
||||
@@ -110,7 +117,9 @@ class WebhookSubscription extends ParanoidModel {
|
||||
* @param options Save options
|
||||
* @returns Promise<WebhookSubscription>
|
||||
*/
|
||||
public async disable(options?: SaveOptions<WebhookSubscription>) {
|
||||
public async disable(
|
||||
options?: InstanceUpdateOptions<InferAttributes<WebhookSubscription>>
|
||||
) {
|
||||
return this.update({ enabled: false }, options);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user