Skip to content

Commit

Permalink
fix(tre api) fixes addi egrees (#654)
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Vaughan authored Apr 26, 2024
1 parent 93870d3 commit 786d57e
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/TRE-API/Services/SubmissionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using TRE_API.Repositories.DbContexts;
using TRE_API.Services.SignalR;
using static TRE_API.Controllers.SubmissionController;
using TRE_API.Models;


namespace TRE_API.Services
Expand Down Expand Up @@ -44,7 +45,9 @@ public class SubmissionHelper: ISubmissionHelper
private readonly IBus _rabbit;
private readonly IDataEgressClientWithoutTokenHelper _dataEgressHelper;
private readonly IMinioTreHelper _minioTreHelper;

private readonly AgentSettings _agentSettings;



public string _hutchDbServer { get; set; }
public string _hutchDbPort { get; set; }
Expand All @@ -59,7 +62,9 @@ public SubmissionHelper(ISignalRService signalRService,
IConfiguration config,
MinioTRESettings minioTreSettings,
IDataEgressClientWithoutTokenHelper dataEgressHelper,
IMinioTreHelper minioTreHelper)
IMinioTreHelper minioTreHelper,
AgentSettings agentSettings
)
{

_dareHelper = helper;
Expand All @@ -73,6 +78,7 @@ public SubmissionHelper(ISignalRService signalRService,

_dataEgressHelper = dataEgressHelper;
_minioTreHelper = minioTreHelper;
_agentSettings = agentSettings;

}
public OutputBucketInfo GetOutputBucketGutsSub(string subId, bool hostnameonly)
Expand All @@ -81,14 +87,24 @@ public OutputBucketInfo GetOutputBucketGutsSub(string subId, bool hostnameonly)
{
var submission = _dareHelper
.CallAPIWithoutModel<Submission>($"/api/Submission/GetASubmission/{subId}")
.Result;
.Result;

string? outputBucket = "";

var bucket = _dbContext.Projects
if (_agentSettings.UseTESK == false)
{
outputBucket = _dbContext.Projects
.Where(x => x.SubmissionProjectId == submission.Project.Id)
.Select(x => x.OutputBucketTre);
.Select(x => x.OutputBucketTre).FirstOrDefault();
}
else
{
outputBucket = _dbContext.Projects
.Where(x => x.SubmissionProjectId == submission.Project.Id)
.Select(x => x.OutputBucketSub).FirstOrDefault();
}

var outputBucket = bucket.FirstOrDefault();


bool secure = !_minioTreSettings.Url.ToLower().StartsWith("http://");
return new OutputBucketInfo()
Expand Down

0 comments on commit 786d57e

Please sign in to comment.