package organization import ( "net/http" "strconv" "task-track-backend/model" "github.com/gin-gonic/gin" "gorm.io/gorm" ) func (h *OrganizationHandler) GetOrganization(c *gin.Context) { id, err := strconv.ParseUint(c.Param("id"), 10, 32) if err != nil { c.JSON(http.StatusBadRequest, gin.H{ "code": 400, "message": "Invalid organization ID", }) return } var organization model.Organization if err := h.db.First(&organization, id).Error; err != nil { if err == gorm.ErrRecordNotFound { c.JSON(http.StatusNotFound, gin.H{ "code": 404, "message": "Organization not found", }) return } c.JSON(http.StatusInternalServerError, gin.H{ "code": 500, "message": "Failed to get organization", "error": err.Error(), }) return } c.JSON(http.StatusOK, gin.H{ "code": 200, "message": "Success", "data": organization, }) }