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:
Apoorv Mishra
2024-01-12 22:33:05 +05:30
committed by GitHub
parent 8360c2dec9
commit 7e61a519f1
56 changed files with 337 additions and 171 deletions

View File

@@ -1,3 +1,4 @@
import { InferAttributes, InferCreationAttributes } from "sequelize";
import {
Column,
Table,
@@ -7,6 +8,7 @@ import {
DataType,
IsIn,
} from "sequelize-typescript";
import { type WebhookDeliveryStatus } from "@server/types";
import WebhookSubscription from "./WebhookSubscription";
import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
@@ -16,14 +18,17 @@ import Fix from "./decorators/Fix";
modelName: "webhook_delivery",
})
@Fix
class WebhookDelivery extends IdModel {
class WebhookDelivery extends IdModel<
InferAttributes<WebhookDelivery>,
Partial<InferCreationAttributes<WebhookDelivery>>
> {
@NotEmpty
@IsIn([["pending", "success", "failed"]])
@Column(DataType.STRING)
status: "pending" | "success" | "failed";
status: WebhookDeliveryStatus;
@Column(DataType.INTEGER)
statusCode: number;
statusCode?: number | null;
@Column(DataType.JSONB)
requestBody: unknown;