MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / serializeReaction

Function serializeReaction

packages/serializers/src/reaction.ts:4–27  ·  view source on GitHub ↗
(
  reaction: messageReactions
)

Source from the content-addressed store, hash-verified

2import { SerializedReaction } from '@linen/types';
3
4export function serializeReaction(
5 reaction: messageReactions
6): SerializedReaction {
7 return {
8 type: reaction.name,
9 count: reaction.count as number,
10 users:
11 reaction.users && Array.isArray(reaction.users)
12 ? (reaction.users as string[]).map((id: string) => {
13 // our prisma.schema keeps reactions as json
14 // instead of a users relation
15 // we should fix it in the future
16 return {
17 authsId: null,
18 username: null,
19 displayName: null,
20 externalUserId: null,
21 profileImageUrl: null,
22 id,
23 };
24 })
25 : [],
26 };
27}

Callers

nothing calls this directly

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected