fix: delete workspace user

This commit is contained in:
steven 2022-09-29 22:17:45 +08:00
parent a175ef47e2
commit a97fe9d81f

View File

@ -159,11 +159,10 @@ func (s *Server) registerWorkspaceUserRoutes(g *echo.Group) {
WorkspaceID: &workspaceID,
}
if err := s.Store.DeleteShortcut(ctx, shortcutDelete); err != nil {
if common.ErrorCode(err) == common.NotFound {
return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Shortcut not found with workspace id %d and user id %d", workspaceID, userID))
}
if common.ErrorCode(err) != common.NotFound {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to delete shortcut").SetInternal(err)
}
}
return c.JSON(http.StatusOK, true)
})