33 lines
952 B
Go
33 lines
952 B
Go
package handlers
|
|
|
|
import (
|
|
"Yimaru-Backend/internal/domain"
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
// GetMyLMSProgress godoc
|
|
// @Summary Get my LMS completion history
|
|
// @Description Returns completed lesson, module, course, and program IDs for the authenticated user (ordered by completion time, then id).
|
|
// @Tags lms
|
|
// @Produce json
|
|
// @Success 200 {object} domain.Response
|
|
// @Failure 500 {object} domain.ErrorResponse
|
|
// @Router /api/v1/lms/progress [get]
|
|
func (h *Handler) GetMyLMSProgress(c *fiber.Ctx) error {
|
|
uid := c.Locals("user_id").(int64)
|
|
prog, err := h.lmsProgressSvc.GetMyProgress(c.Context(), uid)
|
|
if err != nil {
|
|
return c.Status(fiber.StatusInternalServerError).JSON(domain.ErrorResponse{
|
|
Message: "Failed to load learning progress",
|
|
Error: err.Error(),
|
|
})
|
|
}
|
|
return c.JSON(domain.Response{
|
|
Message: "LMS progress retrieved successfully",
|
|
Data: prog,
|
|
Success: true,
|
|
StatusCode: fiber.StatusOK,
|
|
})
|
|
}
|