rename IServiceCreateEventPayload

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-07-21 23:42:30 +02:00
committed by Carl-Gerhard Lindesvärd
parent 1b613538cc
commit 0fea45c9f7
13 changed files with 53 additions and 69 deletions

View File

@@ -4,7 +4,7 @@ import superjson from 'superjson';
import type * as WebSocket from 'ws';
import { getSuperJson } from '@openpanel/common';
import type { IServiceCreateEventPayload } from '@openpanel/db';
import type { IServiceEvent } from '@openpanel/db';
import {
getEvents,
getLiveVisitors,
@@ -81,7 +81,7 @@ export function wsVisitors(
const message = (channel: string, message: string) => {
if (channel === 'event:received') {
const event = getSuperJson<IServiceCreateEventPayload>(message);
const event = getSuperJson<IServiceEvent>(message);
if (event?.projectId === params.projectId) {
getLiveVisitors(params.projectId).then((count) => {
connection.socket.send(String(count));
@@ -142,7 +142,7 @@ export async function wsProjectEvents(
getRedisSub().subscribe(subscribeToEvent);
const message = async (channel: string, message: string) => {
const event = getSuperJson<IServiceCreateEventPayload>(message);
const event = getSuperJson<IServiceEvent>(message);
if (event?.projectId === params.projectId) {
const profile = await getProfileById(event.profileId, event.projectId);
connection.socket.send(