refactor: use DTOs instead of maps and nil for responses

This commit is contained in:
2026-01-10 22:44:39 +01:00
parent 08d8d0ed22
commit f39dcff67d
2 changed files with 15 additions and 13 deletions

View File

@@ -329,7 +329,7 @@ func (h *PostHandler) DeletePost(w http.ResponseWriter, r *http.Request) {
return
}
SendSuccessResponse(w, "Post deleted successfully", nil)
SendSuccessResponse(w, "Post deleted successfully", dto.EmptyResponseDTO{})
}
// @Summary Fetch title from URL
@@ -371,9 +371,10 @@ func (h *PostHandler) FetchTitleFromURL(w http.ResponseWriter, r *http.Request)
return
}
SendSuccessResponse(w, "Title fetched successfully", map[string]string{
"title": title,
})
responseDTO := dto.TitleResponseDTO{
Title: title,
}
SendSuccessResponse(w, "Title fetched successfully", responseDTO)
}
func translatePostCreateError(err error) (string, int) {