feat: paginate/search words and improve review flow
This commit is contained in:
@@ -100,8 +100,9 @@ func (h *WordHandler) SubmitReview(c *gin.Context) {
|
||||
func (h *WordHandler) GetWords(c *gin.Context) {
|
||||
limit, _ := strconv.Atoi(c.DefaultQuery("limit", "20"))
|
||||
offset, _ := strconv.Atoi(c.DefaultQuery("offset", "0"))
|
||||
query := strings.TrimSpace(c.DefaultQuery("q", ""))
|
||||
|
||||
words, total, err := h.wordService.GetAllWords(limit, offset)
|
||||
words, total, err := h.wordService.GetAllWords(limit, offset, query)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user