Skip to content

Commit

Permalink
Merge pull request #59 from WSE-research/54-create-read-of-repository
Browse files Browse the repository at this point in the history
54 create read of repository
  • Loading branch information
Kretchen001 authored May 26, 2024
2 parents 8dcd0c1 + 59331b2 commit e31d283
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion code/AmIVulnerable/AmIVulnerable/Controllers/GitController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public GitController(IConfiguration configuration) {
/// <param name="repoObject"></param>
/// <returns></returns>
[HttpPost]
[Route("cloneRepo")]
[Route("repository")]
public async Task<IActionResult> CloneRepoToAnalyze([FromBody] RepoObject repoObject) {
if (repoObject.RepoUrl is null) {
return BadRequest();
Expand Down Expand Up @@ -71,6 +71,33 @@ public async Task<IActionResult> CloneRepoToAnalyze([FromBody] RepoObject repoOb
}
}

/// <summary>Gets guid, tag, ... of all Repositories that have been cloned</summary>
/// <returns>Return all data of repos</returns>
[HttpGet]
[Route("allrepositories")]
public async Task<IActionResult> GetRepositories() {

Check warning on line 78 in code/AmIVulnerable/AmIVulnerable/Controllers/GitController.cs

View workflow job for this annotation

GitHub Actions / build-and-test-ubuntu-latest

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.

Check warning on line 78 in code/AmIVulnerable/AmIVulnerable/Controllers/GitController.cs

View workflow job for this annotation

GitHub Actions / build-and-test-ubuntu-latest

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.

Check warning on line 78 in code/AmIVulnerable/AmIVulnerable/Controllers/GitController.cs

View workflow job for this annotation

GitHub Actions / build-and-test-windows-latest

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.

Check warning on line 78 in code/AmIVulnerable/AmIVulnerable/Controllers/GitController.cs

View workflow job for this annotation

GitHub Actions / build-and-test-windows-latest

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.

Check warning on line 78 in code/AmIVulnerable/AmIVulnerable/Controllers/GitController.cs

View workflow job for this annotation

GitHub Actions / build-and-test-macOS-latest

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.

Check warning on line 78 in code/AmIVulnerable/AmIVulnerable/Controllers/GitController.cs

View workflow job for this annotation

GitHub Actions / build-and-test-macOS-latest

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.
DataTable repositoryQuery = ExecuteMySqlCommand($"" +
$"SELECT * " +
$"FROM cve.repositories;");

if (repositoryQuery.Rows.Count == 0) {
return NoContent();
}

List<object> list = [];
foreach (DataRow row in repositoryQuery.Rows) {
list.Add(new {
guid = row["guid"],
repoUrl = row["repoUrl"],
repoOwner = row["repoOwner"],
repoDesignation = row["repoDesignation"],
tag = row["tag"]
});
}

return Ok(list);
}

/// <summary></summary>
/// <returns></returns>
[HttpPost]
Expand Down

0 comments on commit e31d283

Please sign in to comment.