fix(workspaces): add pagination to workspace team members (#2644)

* fix(workspaces): a suggestion of paginated teams

* fix(workspaces): workspace team pagination (?)

* fix(workspaces): pagination based on acl createdAt

* fix(workspaces): fix some roles-related tests

* fix(workspaces): improve query and tests

* fix(workspaces): collaborators query without incorrect groupBy

* fix(workspaces): add default values to migration

* Fixed queries and fragments

* Merged main

* Remove comment

* chore(workspaces): update WorkspaceCollaboratorCollection mocks

* chore(workspaces): fix role test

* chore(workspaces); ope

* fix(workspaces): move workspace acl timestamps to separate table

* Merge?

* fix(workspaces) drop that table

* fix(workspaces): cursor

* fix(workspaceInvites): undo merge borkage

* fix(workspaces): rework workspace member pagination

* fix(workspaces): fix test

* fix(workspaces): test test

* fix(workspaces): literally garbage

---------

Co-authored-by: Mike Tasset <mike.tasset@gmail.com>
Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
This commit is contained in:
Chuck Driesler
2024-08-29 20:17:37 +01:00
committed by GitHub
parent 03f8fd1176
commit bbd5146e5a
38 changed files with 754 additions and 206 deletions
@@ -18,8 +18,8 @@ type WorkspaceCreatedPayload = Workspace & {
createdByUserId: string
}
type WorkspaceUpdatedPayload = Workspace
type WorkspaceRoleDeletedPayload = WorkspaceAcl
type WorkspaceRoleUpdatedPayload = WorkspaceAcl
type WorkspaceRoleDeletedPayload = Pick<WorkspaceAcl, 'userId' | 'workspaceId' | 'role'>
type WorkspaceRoleUpdatedPayload = Pick<WorkspaceAcl, 'userId' | 'workspaceId' | 'role'>
type WorkspaceJoinedFromDiscoveryPayload = { userId: string; workspaceId: string }
export type WorkspaceEventsPayloads = {
@@ -25,4 +25,9 @@ export type WorkspaceDomain = {
export type WorkspaceWithOptionalRole = Workspace & { role?: WorkspaceRoles }
export type WorkspaceAcl = { userId: string; role: WorkspaceRoles; workspaceId: string }
export type WorkspaceAcl = {
userId: string
role: WorkspaceRoles
workspaceId: string
createdAt: Date
}
@@ -1,6 +1,6 @@
import { MutationsObjectGraphQLReturn } from '@/modules/core/helpers/graphTypes'
import { LimitedUserRecord } from '@/modules/core/helpers/types'
import { UserWithRole } from '@/modules/core/repositories/users'
import { WorkspaceTeamMember } from '@/modules/workspaces/domain/types'
import { Workspace } from '@/modules/workspacesCore/domain/types'
import { WorkspaceRoles } from '@speckle/shared'
@@ -24,6 +24,4 @@ export type PendingWorkspaceCollaboratorGraphQLReturn = {
token?: string
}
export type WorkspaceCollaboratorGraphQLReturn = UserWithRole<LimitedUserRecord> & {
workspaceRole: WorkspaceRoles
}
export type WorkspaceCollaboratorGraphQLReturn = WorkspaceTeamMember
@@ -0,0 +1,16 @@
import { Knex } from 'knex'
export async function up(knex: Knex): Promise<void> {
await knex.schema.alterTable('workspace_acl', (table) => {
table
.timestamp('createdAt', { precision: 3, useTz: true })
.defaultTo(knex.fn.now())
.notNullable()
})
}
export async function down(knex: Knex): Promise<void> {
await knex.schema.alterTable('workspace_acl', (table) => {
table.dropColumn('createdAt')
})
}