Files
Toju/toju-app/src/app/domains/direct-call/domain/models/direct-call.model.ts
2026-05-17 15:14:52 +02:00

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()
};
}