feat: Add pm
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import type { User } from '../../../../shared-kernel';
|
||||
import type { DirectMessage, DirectMessageParticipant } from '../../../../shared-kernel';
|
||||
|
||||
export type {
|
||||
DirectMessage,
|
||||
DirectMessageEventPayload,
|
||||
DirectMessageMutationEventPayload,
|
||||
DirectMessageParticipant,
|
||||
DirectMessageStatus,
|
||||
DirectMessageStatusEventPayload
|
||||
} from '../../../../shared-kernel';
|
||||
|
||||
export interface DirectMessageConversation {
|
||||
id: string;
|
||||
participants: string[];
|
||||
participantProfiles: Record<string, DirectMessageParticipant>;
|
||||
messages: DirectMessage[];
|
||||
lastMessageAt: number;
|
||||
unreadCount: number;
|
||||
}
|
||||
|
||||
export interface Friend {
|
||||
userId: string;
|
||||
addedAt: number;
|
||||
}
|
||||
|
||||
export function toDirectMessageParticipant(user: User): DirectMessageParticipant {
|
||||
return {
|
||||
userId: user.oderId || user.id,
|
||||
username: user.username,
|
||||
displayName: user.displayName || user.username,
|
||||
description: user.description,
|
||||
avatarUrl: user.avatarUrl,
|
||||
avatarHash: user.avatarHash,
|
||||
avatarMime: user.avatarMime,
|
||||
avatarUpdatedAt: user.avatarUpdatedAt,
|
||||
profileUpdatedAt: user.profileUpdatedAt
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user