From 0cd5fe2545e5aa02da20b721c8e8e3d58723053b Mon Sep 17 00:00:00 2001 From: Joan Manuel Jaramillo Avila <89425013+LifeRIP@users.noreply.github.com> Date: Tue, 10 Jun 2025 17:29:24 -0500 Subject: [PATCH 1/2] feat: Adds paginated messages retrieval endpoint for specific chat rooms --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e09e132..d101740 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,7 @@ Una vez iniciado el servidor puedes acceder a la documentación desde [http://lo - `GET /api/v1/chat/rooms`: Obtiene todas las salas del usuario actual - `GET /api/v1/chat/rooms/{roomId}`: Obtiene información de una sala específica - `GET /api/v1/chat/rooms/{roomId}/messages`: Obtiene mensajes de una sala específica +- `GET /api/v1/chat/rooms/{roomId}/messages/paginated`: Obtiene mensajes de una sala específica paginados #### Chats Directos - `POST /api/v1/chat/direct/{otherUserId}`: Crea un chat directo entre el usuario autenticado y otro usuario From a0ff9b7761f96b8cc32254b8b0b5b93da13839c9 Mon Sep 17 00:00:00 2001 From: Joan Manuel Jaramillo Avila <89425013+LifeRIP@users.noreply.github.com> Date: Tue, 10 Jun 2025 17:36:19 -0500 Subject: [PATCH 2/2] chore: Updates API endpoints for chat message retrieval Renames two API routes to improve clarity and consistency: - Changes `/chat/direct/{chatId}/messages` to `/chat/direct/{chatId}/messages/paginated` for clarity in pagination. - Changes `/chat/rooms/{roomId}/messages/simple` to `/chat/rooms/{roomId}/messages` for simplicity and alignment with route naming conventions. These changes enhance readability and better reflect the endpoints' purposes. --- internal/handlers/chat_handler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/handlers/chat_handler.go b/internal/handlers/chat_handler.go index 4a8e754..c111ba5 100644 --- a/internal/handlers/chat_handler.go +++ b/internal/handlers/chat_handler.go @@ -247,7 +247,7 @@ func (h *ChatHandler) GetUserDirectChats(w http.ResponseWriter, r *http.Request) // @Failure 401 {string} string "No autorizado" // @Failure 404 {string} string "Chat no encontrado" // @Failure 500 {string} string "Error interno del servidor" -// @Router /chat/direct/{chatId}/messages [get] +// @Router /chat/direct/{chatId}/messages/paginated [get] func (h *ChatHandler) GetDirectChatMessages(w http.ResponseWriter, r *http.Request) { chatID := chi.URLParam(r, "chatId") @@ -354,7 +354,7 @@ func (h *ChatHandler) JoinRoom(w http.ResponseWriter, r *http.Request) { // @Failure 401 {string} string "No autorizado" // @Failure 404 {string} string "Sala no encontrada" // @Failure 500 {string} string "Error interno del servidor" -// @Router /chat/rooms/{roomId}/messages/simple [get] +// @Router /chat/rooms/{roomId}/messages [get] func (h *ChatHandler) GetRoomMessagesSimple(w http.ResponseWriter, r *http.Request) { roomID := chi.URLParam(r, "roomId")