Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 70 additions & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const docTemplate = `{
}
}
},
"/chat/direct/{chatId}/messages/paginated": {
"/chat/direct/{chatId}/messages": {
"get": {
"security": [
{
Expand Down Expand Up @@ -595,6 +595,75 @@ const docTemplate = `{
}
}
},
"/chat/rooms/{roomId}/messages/paginated": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Devuelve los mensajes de una sala específica con soporte para paginación ordernada por fecha de creación descendente",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Chat"
],
"summary": "Obtiene mensajes de una sala",
"parameters": [
{
"type": "string",
"description": "ID de la sala",
"name": "roomId",
"in": "path",
"required": true
},
{
"type": "integer",
"default": 50,
"description": "Límite de mensajes a obtener",
"name": "limit",
"in": "query"
},
{
"type": "string",
"default": "\"1747441934\"",
"description": "Cursor para paginación (timestamp)",
"name": "cursor",
"in": "query"
}
],
"responses": {
"200": {
"description": "Mensajes paginados de la sala",
"schema": {
"$ref": "#/definitions/models.PaginatedMessagesResponse"
}
},
"401": {
"description": "No autorizado",
"schema": {
"type": "string"
}
},
"404": {
"description": "Sala no encontrada",
"schema": {
"type": "string"
}
},
"500": {
"description": "Error interno del servidor",
"schema": {
"type": "string"
}
}
}
}
},
"/chat/ws": {
"get": {
"description": "Establece una conexión WebSocket para mensajería en tiempo real",
Expand Down
71 changes: 70 additions & 1 deletion docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
}
}
},
"/chat/direct/{chatId}/messages/paginated": {
"/chat/direct/{chatId}/messages": {
"get": {
"security": [
{
Expand Down Expand Up @@ -588,6 +588,75 @@
}
}
},
"/chat/rooms/{roomId}/messages/paginated": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Devuelve los mensajes de una sala específica con soporte para paginación ordernada por fecha de creación descendente",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Chat"
],
"summary": "Obtiene mensajes de una sala",
"parameters": [
{
"type": "string",
"description": "ID de la sala",
"name": "roomId",
"in": "path",
"required": true
},
{
"type": "integer",
"default": 50,
"description": "Límite de mensajes a obtener",
"name": "limit",
"in": "query"
},
{
"type": "string",
"default": "\"1747441934\"",
"description": "Cursor para paginación (timestamp)",
"name": "cursor",
"in": "query"
}
],
"responses": {
"200": {
"description": "Mensajes paginados de la sala",
"schema": {
"$ref": "#/definitions/models.PaginatedMessagesResponse"
}
},
"401": {
"description": "No autorizado",
"schema": {
"type": "string"
}
},
"404": {
"description": "Sala no encontrada",
"schema": {
"type": "string"
}
},
"500": {
"description": "Error interno del servidor",
"schema": {
"type": "string"
}
}
}
}
},
"/chat/ws": {
"get": {
"description": "Establece una conexión WebSocket para mensajería en tiempo real",
Expand Down
48 changes: 47 additions & 1 deletion docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ paths:
summary: Registra un nuevo usuario
tags:
- Auth
/chat/direct/{chatId}/messages/paginated:
/chat/direct/{chatId}/messages:
get:
consumes:
- application/json
Expand Down Expand Up @@ -493,6 +493,52 @@ paths:
summary: Obtiene mensajes de una sala (versión simple)
tags:
- Chat
/chat/rooms/{roomId}/messages/paginated:
get:
consumes:
- application/json
description: Devuelve los mensajes de una sala específica con soporte para paginación
ordernada por fecha de creación descendente
parameters:
- description: ID de la sala
in: path
name: roomId
required: true
type: string
- default: 50
description: Límite de mensajes a obtener
in: query
name: limit
type: integer
- default: '"1747441934"'
description: Cursor para paginación (timestamp)
in: query
name: cursor
type: string
produces:
- application/json
responses:
"200":
description: Mensajes paginados de la sala
schema:
$ref: '#/definitions/models.PaginatedMessagesResponse'
"401":
description: No autorizado
schema:
type: string
"404":
description: Sala no encontrada
schema:
type: string
"500":
description: Error interno del servidor
schema:
type: string
security:
- BearerAuth: []
summary: Obtiene mensajes de una sala
tags:
- Chat
/chat/rooms/me:
get:
consumes:
Expand Down
4 changes: 2 additions & 2 deletions internal/handlers/chat_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (h *ChatHandler) GetUserRooms(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 [get]
// @Router /chat/rooms/{roomId}/messages/paginated [get]
func (h *ChatHandler) GetRoomMessages(w http.ResponseWriter, r *http.Request) {
roomID := chi.URLParam(r, "roomId")

Expand Down Expand Up @@ -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/paginated [get]
// @Router /chat/direct/{chatId}/messages [get]
func (h *ChatHandler) GetDirectChatMessages(w http.ResponseWriter, r *http.Request) {
chatID := chi.URLParam(r, "chatId")

Expand Down