You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

35 lines
721 B

package organization
import (
"net/http"
"strconv"
"task-track-backend/model"
"github.com/gin-gonic/gin"
)
func (h *OrganizationHandler) DeleteOrganization(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
}
// 软删除机构
if err := h.db.Delete(&model.Organization{}, id).Error; err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"code": 500,
"message": "Failed to delete organization",
"error": err.Error(),
})
return
}
c.JSON(http.StatusOK, gin.H{
"code": 200,
"message": "Organization deleted successfully",
})
}