diff --git a/internal/transport/handler/project.go b/internal/transport/handler/project.go index 5beb2d5..99514ec 100644 --- a/internal/transport/handler/project.go +++ b/internal/transport/handler/project.go @@ -39,11 +39,15 @@ func (h *ProjectHandler) ProjectCreate(c *gin.Context) { } func (h *ProjectHandler) ProjectGet(c *gin.Context) { - var project db.Project - h.dbClient.First(&project, 1) - c.JSON(http.StatusOK, gin.H{ - "message": project, - }) + var projects []db.Project + h.dbClient.Find(&projects) + + if result := h.dbClient.Find(&projects); result.Error != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": result.Error.Error()}) + return + } + + c.JSON(http.StatusOK, projects) } func NewProjectHandler(dbClient *gorm.DB) *ProjectHandler {