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,4 +1,9 @@
|
||||
import { FindOrCreateOptions, Op } from "sequelize";
|
||||
import {
|
||||
FindOrCreateOptions,
|
||||
InferAttributes,
|
||||
InferCreationAttributes,
|
||||
Op,
|
||||
} from "sequelize";
|
||||
import {
|
||||
BelongsTo,
|
||||
Column,
|
||||
@@ -26,7 +31,10 @@ import Fix from "./decorators/Fix";
|
||||
}))
|
||||
@Table({ tableName: "views", modelName: "view" })
|
||||
@Fix
|
||||
class View extends IdModel {
|
||||
class View extends IdModel<
|
||||
InferAttributes<View>,
|
||||
Partial<InferCreationAttributes<View>>
|
||||
> {
|
||||
@Column
|
||||
lastEditingAt: Date | null;
|
||||
|
||||
@@ -55,7 +63,7 @@ class View extends IdModel {
|
||||
userId: string;
|
||||
documentId: string;
|
||||
},
|
||||
options?: FindOrCreateOptions
|
||||
options?: FindOrCreateOptions<InferAttributes<View>>
|
||||
) {
|
||||
const [model, created] = await this.findOrCreate({
|
||||
...options,
|
||||
|
||||
Reference in New Issue
Block a user