Skip to content

Commit

Permalink
fix(Graph): edit GetRelationalEdgeBaseNode method and add NodeHasNotE…
Browse files Browse the repository at this point in the history
…dgesException. (#117)
  • Loading branch information
K-Kabiri authored Sep 9, 2024
1 parent 1cd85f7 commit b7f86fe
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace AnalysisData.Exception.GraphException.NodeException;

public class NodeHasNotEdgesException : ServiceException
{
public NodeHasNotEdgesException() : base(Resources.NodeHasNotEdgesException,
StatusCodes.Status404NotFound)
{
}
}
9 changes: 9 additions & 0 deletions AnalysisData/AnalysisData/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions AnalysisData/AnalysisData/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,8 @@
<data name="FileProcessingException" xml:space="preserve">
<value>failed to processing file ! </value>
</data>
<data name="NodeHasNotEdgesException" xml:space="preserve">
<value>no edges found for this node ! </value>
</data>

</root>
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,16 @@ public GraphRelationService(IEntityNodeRepository entityNodeRepository, IEntityE
throw new NodeNotAccessibleForUserException();
}

if (!result.nodes.Any() && !result.edges.Any())
if (!result.nodes.Any())
{
throw new NodeNotFoundException();
}

if (!result.edges.Any())
{
throw new NodeHasNotEdgesException();
}

return result;
}

Expand All @@ -72,7 +77,7 @@ public GraphRelationService(IEntityNodeRepository entityNodeRepository, IEntityE
{ From = x.EntityIDSource, To = x.EntityIDTarget, Id = x.Id });
return (nodeDto, edgeDto);
}

private async Task<List<EntityNode>> GetEntityNodesByIdsAsync(IEnumerable<Guid> nodeIdes)
{
var entityNodes = new List<EntityNode>();
Expand All @@ -84,6 +89,7 @@ private async Task<List<EntityNode>> GetEntityNodesByIdsAsync(IEnumerable<Guid>
entityNodes.Add(node);
}
}

return entityNodes;
}
}

0 comments on commit b7f86fe

Please sign in to comment.