38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import type { DirectMessageParticipant, User } from '../../../../shared-kernel';
|
|
|
|
export type DirectCallStatus = 'calling' | 'ringing' | 'connected' | 'ended';
|
|
|
|
export interface DirectCallParticipant {
|
|
userId: string;
|
|
profile: DirectMessageParticipant;
|
|
joined: boolean;
|
|
}
|
|
|
|
export interface DirectCallSession {
|
|
callId: string;
|
|
conversationId: string;
|
|
createdAt: number;
|
|
initiatorId: string;
|
|
participantIds: string[];
|
|
participants: Record<string, DirectCallParticipant>;
|
|
status: DirectCallStatus;
|
|
}
|
|
|
|
export function participantToUser(participant: DirectMessageParticipant): User {
|
|
return {
|
|
id: participant.userId,
|
|
oderId: participant.userId,
|
|
username: participant.username,
|
|
displayName: participant.displayName,
|
|
description: participant.description,
|
|
avatarUrl: participant.avatarUrl,
|
|
avatarHash: participant.avatarHash,
|
|
avatarMime: participant.avatarMime,
|
|
avatarUpdatedAt: participant.avatarUpdatedAt,
|
|
profileUpdatedAt: participant.profileUpdatedAt,
|
|
status: 'online',
|
|
role: 'member',
|
|
joinedAt: Date.now()
|
|
};
|
|
}
|