up
This commit is contained in:
@@ -21,6 +21,8 @@ try {
|
||||
COALESCE(u.name, u.phone_number) AS name,
|
||||
u.phone_number,
|
||||
u.avatar_url,
|
||||
u.bot_enabled,
|
||||
u.on_hold,
|
||||
lm.message_id AS last_message_id,
|
||||
lm.content AS last_message,
|
||||
lm.direction AS direction,
|
||||
@@ -48,15 +50,17 @@ try {
|
||||
// Formatear datos para el frontend
|
||||
$conversations = array_map(function($conv) {
|
||||
return [
|
||||
'id' => intval($conv['id']),
|
||||
'user_id' => intval($conv['user_id']),
|
||||
'content' => $conv['content'] ?? '',
|
||||
'name' => $conv['name'] ?? $conv['phone_number'],
|
||||
'phone_number' => $conv['phone_number'],
|
||||
'avatar_url' => $conv['avatar_url'] ?? null,
|
||||
'last_message' => $conv['last_message'] ?? '',
|
||||
'last_time' => $conv['last_time'] ?? null,
|
||||
'direction' => $conv['direction'] ?? 'incoming',
|
||||
'message_type' => $conv['message_type'] ?? 'text',
|
||||
'status' => $conv['status'] ?? 'sent',
|
||||
'created_at' => $conv['created_at'],
|
||||
'phone_number' => $conv['phone_number'],
|
||||
'name' => $conv['name'] ?? $conv['phone_number']
|
||||
'unread_count' => intval($conv['unread_count'] ?? 0),
|
||||
'bot_enabled' => isset($conv['bot_enabled']) ? (bool)$conv['bot_enabled'] : true,
|
||||
'on_hold' => isset($conv['on_hold']) ? (bool)$conv['on_hold'] : false
|
||||
];
|
||||
}, $conversations);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user