Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

54 create read of repository #59

Merged
merged 4 commits into from
May 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
/// <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 @@
}
}

/// <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
Loading