Skip to content

Commit

Permalink
refactor: merge commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ftm-Sayadzadeh committed Aug 27, 2024
2 parents 6e213bd + 44d7cd2 commit 3636319
Show file tree
Hide file tree
Showing 37 changed files with 1,430 additions and 123 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>
29 changes: 16 additions & 13 deletions mohaymen-codestar-Team02/Controllers/DataAdminController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
namespace mohaymen_codestar_Team02.Controllers;

[ApiController]
[Authorize(Roles = nameof(RoleType.DataAdmin))]
[Authorize]
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,

Check warning on line 20 in mohaymen-codestar-Team02/Controllers/DataAdminController.cs

View workflow job for this annotation

GitHub Actions / test

Non-nullable field '_graphService' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
IFileReader fileReader)
{
_dataAdminService = dataAdminService;
_fileReader = fileReader;
Expand All @@ -33,8 +33,7 @@ public async Task<IActionResult> StoreNewDataSet([FromForm] StoreDataDto storeDa
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)

Check warning on line 39 in mohaymen-codestar-Team02/Controllers/DataAdminController.cs

View workflow job for this annotation

GitHub Actions / test

The variable 'e' is declared but never used
Expand All @@ -44,8 +43,10 @@ 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);
}

[HttpGet("DataSets/{dataSetName}")]
Expand All @@ -61,15 +62,17 @@ await _dataAdminService.DisplayGeraphData(dataSetName, sourceEdgeIdentifierField
}


[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)

Check warning on line 66 in mohaymen-codestar-Team02/Controllers/DataAdminController.cs

View workflow job for this annotation

GitHub Actions / test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
return BadRequest();
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)

Check warning on line 73 in mohaymen-codestar-Team02/Controllers/DataAdminController.cs

View workflow job for this annotation

GitHub Actions / test

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
return BadRequest();
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 @@ -97,4 +97,7 @@
<data name="AuthorizedMessage" xml:space="preserve">
<value>Authorized Message</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; }
}
13 changes: 12 additions & 1 deletion mohaymen-codestar-Team02/Mapper/AutoMapperProfile.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
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 +19,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 3636319

Please sign in to comment.