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

@@ -2,6 +2,7 @@ import { faker } from "@faker-js/faker";
import isNil from "lodash/isNil";
import isNull from "lodash/isNull";
import randomstring from "randomstring";
import { InferCreationAttributes } from "sequelize";
import { v4 as uuidv4 } from "uuid";
import {
CollectionPermission,
@@ -122,7 +123,6 @@ export async function buildSubscription(overrides: Partial<Subscription> = {}) {
}
return Subscription.create({
enabled: true,
event: "documents.update",
...overrides,
});
@@ -139,7 +139,7 @@ export function buildTeam(overrides: Record<string, any> = {}) {
},
],
...overrides,
},
} as Partial<InferCreationAttributes<Team>>,
{
include: "authenticationProviders",
}
@@ -200,7 +200,7 @@ export async function buildUser(overrides: Partial<User> = {}) {
]
: [],
...overrides,
},
} as Partial<InferCreationAttributes<User>>,
{
include: "authentications",
}
@@ -377,7 +377,7 @@ export async function buildDocument(
publishedAt: isNull(overrides.collectionId) ? null : new Date(),
lastModifiedById: overrides.userId,
createdById: overrides.userId,
editorVersion: 2,
editorVersion: "12.0.0",
...overrides,
},
{
@@ -398,11 +398,9 @@ export async function buildDocument(
export async function buildComment(overrides: {
userId: string;
teamId: string;
documentId: string;
}) {
const comment = await Comment.create({
teamId: overrides.teamId,
documentId: overrides.documentId,
data: {
type: "doc",