tsk-59: Get MessageEventResponse endpoint (#61)

Closes #59

Reviewed-on: phoenix/textsender-api#61
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
phoenix
2026-01-01 05:28:49 +00:00
committed by phoenix
parent 6641f384ab
commit 59c9aa0ff1
10 changed files with 712 additions and 113 deletions
@@ -36,6 +36,18 @@ type RecordEventResponse struct {
Data []*event.MessageEventResponse `json:"data"`
}
// RecordMessageEventResponse godoc
// @Summary Record MessageEventResponse
// @Description Saves the result of sending a text message (requires JWT)
// @Tags message
// @Accept json
// @Produce json
// @Security BearerAuth
// @Param request body RecordEventRequest true "Data to add MessageEventResponse"
// @Success 201 {object} RecordEventResponse
// @Failure 400 {object} RecordEventResponse
// @Failure 500 {object} RecordEventResponse
// @Router /schedule/message/event/response/record [post]
func (e *EventResponseHandler) RecordResponse(w http.ResponseWriter, r *http.Request) {
var req RecordEventRequest
if err := ExtractFromRequest(r, &req); err != nil {
@@ -107,6 +119,18 @@ type GetMessageEventResponseFetchedResponse struct {
Data []*event.MessageEventResponse `json:"data"`
}
// FetchtMessageEventResponse godoc
// @Summary Fetcht MessageEventResponse
// @Description Fetches a MessageEventResponse given a user id (requires JWT)
// @Tags message
// @Accept json
// @Produce json
// @Param user_id path string true "User Id"
// @Security BearerAuth
// @Success 200 {object} GetMessageEventResponseFetchedResponse
// @Failure 400 {object} GetMessageEventResponseFetchedResponse
// @Failure 500 {object} GetMessageEventResponseFetchedResponse
// @Router /schedule/message/event/response [get]
func (e *EventResponseHandler) Fetch(w http.ResponseWriter, r *http.Request) {
queryParams := r.URL.Query()
var userId uuid.UUID