Files
speckle-server/packages/server/test/speckle-helpers/activityStreamHelper.ts
T
Kristaps Fabians Geikins 4b06f42db7 chore(server): run TS files directly (no compilation) (#5134)
* sort of works

* type fixes

* added option to run old way too
2025-07-23 11:20:40 +02:00

25 lines
646 B
TypeScript

import type { StreamActivityRecord } from '@/modules/activitystream/helpers/types'
import { StreamActivity } from '@/modules/core/dbSchema'
export async function getStreamActivities(
streamId: string,
extraFilters: Partial<{ actionType: string; userId: string }> = {}
): Promise<StreamActivityRecord[]> {
const { actionType, userId } = extraFilters
const q = StreamActivity.knex<StreamActivityRecord[]>().where(
StreamActivity.col.streamId,
streamId
)
if (actionType) {
q.andWhere(StreamActivity.col.actionType, actionType)
}
if (userId) {
q.andWhere(StreamActivity.col.userId, userId)
}
return await q
}