Skip to content

Commit ff7c610

Browse files
committed
fix(workspaces): type nullable member count targets
1 parent ef57fcb commit ff7c610

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

apps/sim/lib/workspaces/public-queries.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ describe('getPublicWorkspaceDetails', () => {
5353
memberCount: 4,
5454
})
5555
expect(dbChainMockFns.execute).toHaveBeenCalledTimes(1)
56+
const countQuery = dbChainMockFns.execute.mock.calls[0][0] as {
57+
values: Array<{
58+
fragments: Array<{ strings: string[]; values: unknown[] }>
59+
}>
60+
}
61+
const targetRows = countQuery.values[0].fragments
62+
expect(
63+
targetRows.every((fragment) => fragment.strings.join('?') === '(?::text, ?::text)')
64+
).toBe(true)
65+
expect(targetRows.flatMap((fragment) => fragment.values)).toContain(null)
5666
})
5767

5868
it('does not run a count query for an empty batch', async () => {

apps/sim/lib/workspaces/public-queries.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async function countWorkspaceMembers(
4949
sql`, `
5050
)
5151
const targets = sql.join(
52-
workspaceRows.map(({ id, organizationId }) => sql`(${id}, ${organizationId})`),
52+
workspaceRows.map(({ id, organizationId }) => sql`(${id}::text, ${organizationId}::text)`),
5353
sql`, `
5454
)
5555
const rows = await db.execute<WorkspaceMemberCountRow>(sql`

0 commit comments

Comments
 (0)