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,9 +1,12 @@
import crypto from "crypto";
import type { SaveOptions } from "sequelize";
import type {
InferAttributes,
InferCreationAttributes,
SaveOptions,
} from "sequelize";
import {
Table,
ForeignKey,
Model,
Column,
PrimaryKey,
IsUUID,
@@ -18,6 +21,7 @@ import {
} from "sequelize-typescript";
import { NotificationEventType } from "@shared/types";
import env from "@server/env";
import Model from "@server/models/base/Model";
import Collection from "./Collection";
import Comment from "./Comment";
import Document from "./Document";
@@ -83,7 +87,10 @@ import Fix from "./decorators/Fix";
updatedAt: false,
})
@Fix
class Notification extends Model {
class Notification extends Model<
InferAttributes<Notification>,
Partial<InferCreationAttributes<Notification>>
> {
@IsUUID(4)
@PrimaryKey
@Default(DataType.UUIDV4)
@@ -92,7 +99,7 @@ class Notification extends Model {
@AllowNull
@Column
emailedAt: Date;
emailedAt?: Date | null;
@AllowNull
@Column