livechat-widget
Version:
LiveChat Widget for Next.js applications
53 lines (49 loc) • 1.47 kB
text/typescript
export interface UserInfo {
username: string;
profile_image: string;
role?: 'admin' | 'user';
}
// เปลี่ยนเป็น snake_case
export interface ChatMessage {
id?: string; // เพิ่ม id สำหรับตรวจสอบข้อความซ้ำ
message_id?: string;
room_code: string;
app_id: string;
user_info: {
username: string;
profile_image: string;
role?: 'admin' | 'user';
};
user_code: string;
content: string;
created_at: string;
is_deleted?: boolean; // เพิ่ม flag สำหรับข้อความที่ถูกลบ
}
// เพิ่ม interface สำหรับ payload ที่ใช้ snake_case
export interface ChatMessagePayload {
id?: string; // เพิ่ม id สำหรับตรวจสอบข้อความซ้ำ
message_id?: string;
room_code: string;
app_id: string;
user_info: {
username: string;
profile_image: string;
role?: 'admin' | 'user';
};
user_code: string;
content: string;
created_at: string;
is_deleted?: boolean; // เพิ่ม flag สำหรับข้อความที่ถูกลบ
}
export interface WebSocketMessage {
type: 'chat' | 'unread_count' | 'room_changed' | 'message_deleted' | string;
payload: any;
}
export interface ChatRoom {
id?: string;
roomCode: string;
appId: string;
name: string;
createdAt: string;
updatedAt?: string;
}