Skip to content

Commit

Permalink
Merge pull request #24 from Star-Academy/feature/save-graph
Browse files Browse the repository at this point in the history
feat: add the f2 to code
  • Loading branch information
mahdizahedii2005 authored Aug 26, 2024
2 parents d293aad + b670787 commit 44d7cd2
Show file tree
Hide file tree
Showing 37 changed files with 1,462 additions and 114 deletions.
2 changes: 2 additions & 0 deletions mohaymen-codestar-Team02.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/Environment/Filtering/ExcludeCoverageFilters/=mohaymen_002Dcodestar_002DTeam02_003B_002A_003Bmohaymen_005Fcodestar_005FTeam02_002EServices_002EAuthenticatoin_002EAuthenticationService_003B_002A/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
41 changes: 27 additions & 14 deletions mohaymen-codestar-Team02/Controllers/DataAdminController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using mohaymen_codestar_Team02.Data;
using mohaymen_codestar_Team02.Dto;
using mohaymen_codestar_Team02.Dto.GraphDTO;
using mohaymen_codestar_Team02.Dto.StoreDataDto;
Expand All @@ -13,26 +14,27 @@ public class DataAdminController : ControllerBase
{
private readonly IDataAdminService _dataAdminService;
private readonly IFileReader _fileReader;
private readonly IDisplayDataService _dataService;
private readonly IGraphService _graphService;

public DataAdminController(IDataAdminService dataAdminService, IFileReader fileReader,
IDisplayDataService dataService)
public DataAdminController(IDataAdminService dataAdminService,
IFileReader fileReader, IGraphService graphService)
{
_dataAdminService = dataAdminService;
_fileReader = fileReader;
_graphService = graphService;
_dataAdminService = dataAdminService;
}

[HttpPost("DataSets")]
public async Task<IActionResult> StoreNewDataSet([FromForm] StoreDataDto storeDataDto)
{
//Todo SystemAdmin and DataAdmin
try
{
var edgeFile = _fileReader.Read(storeDataDto.EdgeFile);
var vertexFile = _fileReader.Read(storeDataDto.VertexFile);
var response = await _dataAdminService.StoreData(edgeFile, vertexFile, storeDataDto.DataName,
Path.GetFileName(storeDataDto.EdgeFile.FileName), Path.GetFileName(storeDataDto.VertexFile.FileName),
storeDataDto.CreatorUserName);
Path.GetFileName(storeDataDto.EdgeFile.FileName), Path.GetFileName(storeDataDto.VertexFile.FileName));
return StatusCode((int)response.Type, response);
}
catch (FormatException e)
Expand All @@ -42,31 +44,42 @@ public async Task<IActionResult> StoreNewDataSet([FromForm] StoreDataDto storeDa
}

[HttpGet("DataSets")]
public void GetDataSetsList()
public IActionResult GetDataSetsList()
{
var response = _dataAdminService.DisplayDataSet();
return StatusCode((int)response.Type, response);

//Todo all Of Them
}

[HttpGet("DataSets/{dataSetName}")]
public async Task<IActionResult> DisplayDataSetAsGraph(string dataSetName,
[FromQuery] string sourceEdgeIdentifierFieldName, [FromQuery] string destinationEdgeIdentifierFieldName,
[FromQuery] string sourceEdgeIdentifierFieldName, [FromQuery] string destinationEdgeIdentifierFieldName,
[FromQuery] string vertexIdentifierFieldName)
{
//Todo all Of Them
ServiceResponse<DisplayGraphDto> response =
await _dataAdminService.DisplayGeraphData(dataSetName, sourceEdgeIdentifierFieldName, destinationEdgeIdentifierFieldName, vertexIdentifierFieldName);
await _dataAdminService.DisplayGeraphData(dataSetName, sourceEdgeIdentifierFieldName,
destinationEdgeIdentifierFieldName, vertexIdentifierFieldName);
response.Data.GraphName = dataSetName;
return StatusCode((int)response.Type, response);
}


[HttpGet("DataSets/{dataSetName}/Vertices/{vertexId}")]
public async Task<IActionResult> DisplayVertexDetails(string datasetName, int vertexId)
[HttpGet("DataSets/Vertices/{objectId}")]
public async Task<IActionResult> DisplayVertexDetails(string objectId)
{
return BadRequest();
//Todo all Of Them

var respond = _dataAdminService.GetVertexDetail(objectId);
return StatusCode((int)respond.Type, respond);
}

[HttpGet("DataSets/{dataSetName}/Edges/{edgeId}")]
public async Task<IActionResult> DisplayEdgeDetails(string datasetName, int edgeId)
[HttpGet("DataSets/Edges/{objectId}")]
public async Task<IActionResult> DisplayEdgeDetails(string objectId)
{
return BadRequest();
//Todo all Of Them
var respond = _dataAdminService.GetEdgeDetail(objectId);
return StatusCode((int)respond.Type, respond);
}
}
10 changes: 10 additions & 0 deletions mohaymen-codestar-Team02/Data/Resources.Designer.cs

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

3 changes: 3 additions & 0 deletions mohaymen-codestar-Team02/Data/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,7 @@
<data name="RolesRetrievedMassage" xml:space="preserve">
<value>Roles Retrieved Successfully</value>
</data>
<data name="GraphFetchedSuccessfully" xml:space="preserve">
<value>GraphFetchedSuccessfully</value>
</data>
</root>
15 changes: 15 additions & 0 deletions mohaymen-codestar-Team02/Dto/GetDataGroupDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using mohaymen_codestar_Team02.Models.EdgeEAV;
using mohaymen_codestar_Team02.Models.VertexEAV;

namespace mohaymen_codestar_Team02.Dto;

public class GetDataGroupDto
{
public string Name { get; set; }

public DateTime CreateAt { get; set; } = DateTime.UtcNow;
public DateTime UpdateAt { get; set; } = DateTime.UtcNow;

public virtual GetEdgeEntityDto EdgeEntity { get; set; }
public virtual GetVertexEntityDto VertexEntity { get; set; }
}
6 changes: 6 additions & 0 deletions mohaymen-codestar-Team02/Dto/GetEdgeEntityDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace mohaymen_codestar_Team02.Dto;

public class GetEdgeEntityDto
{
public string Name { get; set; }
}
9 changes: 0 additions & 9 deletions mohaymen-codestar-Team02/Dto/GetGraphDto.cs

This file was deleted.

6 changes: 6 additions & 0 deletions mohaymen-codestar-Team02/Dto/GetVertexEntityDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace mohaymen_codestar_Team02.Dto;

public class GetVertexEntityDto
{
public string Name { get; set; }
}
2 changes: 1 addition & 1 deletion mohaymen-codestar-Team02/Dto/GraphDTO/DetailDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ namespace mohaymen_codestar_Team02.Dto.GraphDTO;

public class DetailDto
{
public Dictionary<string, string> AttributeValue { get; init; }
public Dictionary<string, string>? AttributeValue { get; set; } = new();
}
5 changes: 5 additions & 0 deletions mohaymen-codestar-Team02/Dto/InfoDto/InfoDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace mohaymen_codestar_Team02.Dto.InfoDto;

public class InfoDto
{
}
3 changes: 0 additions & 3 deletions mohaymen-codestar-Team02/Dto/StoreDataDto/StoreDataDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@ public class StoreDataDto
{
public IFormFile EdgeFile { get; set; }
public IFormFile VertexFile { get; set; }
public string FileType { get; set; }
public string DataName { get; set; }

public string CreatorUserName { get; set; }
}
12 changes: 12 additions & 0 deletions mohaymen-codestar-Team02/Mapper/AutoMapperProfile.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using AutoMapper;
using mohaymen_codestar_Team02.Dto;
using mohaymen_codestar_Team02.Dto.Role;
using mohaymen_codestar_Team02.Dto.User;
using mohaymen_codestar_Team02.Dto.UserDtos;
using mohaymen_codestar_Team02.Dto.UserRole;
using mohaymen_codestar_Team02.Models;
using mohaymen_codestar_Team02.Models.EdgeEAV;
using mohaymen_codestar_Team02.Models.VertexEAV;

namespace mohaymen_codestar_Team02.Mapper;

Expand All @@ -17,5 +20,14 @@ public AutoMapperProfile()
CreateMap<Role, GetRoleDto>();
CreateMap<User, RegisterUserDto>();
CreateMap<User, UpdateUserDto>();
CreateMap<DataGroup, GetDataGroupDto>()
.ForMember(dest => dest.EdgeEntity, opt =>
opt.MapFrom(src => src.EdgeEntity))
.ForMember(dest => dest.VertexEntity, opt =>
opt.MapFrom(src => src.VertexEntity));
CreateMap<DataGroup, GetDataGroupDto>()
.ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name));
CreateMap<EdgeEntity, GetEdgeEntityDto>();
CreateMap<VertexEntity, GetVertexEntityDto>();
}
}
Loading

0 comments on commit 44d7cd2

Please sign in to comment.