Skip to content

Commit 68e38d2

Browse files
authored
Filter by EngineRef or Owner when retrieving builds (#981)
1 parent 46b35af commit 68e38d2

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/Serval/src/Serval.Translation/Features/Builds/GetNextFinishedBuild.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public async Task<GetNextFinishedBuildResponse> HandleAsync(
2222
string? id = request.Id;
2323
if (id is not null)
2424
{
25-
Build? build = await builds.GetAsync(id, cancellationToken);
25+
Build? build = await builds.GetAsync(e => e.Id == id && e.Owner == request.Owner, cancellationToken);
2626
if (build is not null)
2727
dateFinished = build.DateFinished ?? DateTime.UtcNow;
2828
}

src/Serval/src/Serval.Translation/Features/Engines/GetBuild.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ public async Task<GetBuildResponse> HandleAsync(GetBuild request, CancellationTo
3838
}
3939
else
4040
{
41-
Build? build = await builds.GetAsync(e => e.Id == request.BuildId, cancellationToken);
41+
Build? build = await builds.GetAsync(
42+
e => e.Id == request.BuildId && e.EngineRef == request.EngineId,
43+
cancellationToken
44+
);
4245
if (build is null)
4346
throw new EntityNotFoundException($"Could not find the Build '{request.BuildId}'.");
4447
return new(GetBuildStatus.Found, mapper.Map(build));

src/Serval/src/Serval.WordAlignment/Features/Engines/GetBuild.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ public async Task<GetBuildResponse> HandleAsync(GetBuild request, CancellationTo
3838
}
3939
else
4040
{
41-
Build? build = await builds.GetAsync(e => e.Id == request.BuildId, cancellationToken);
41+
Build? build = await builds.GetAsync(
42+
e => e.Id == request.BuildId && e.EngineRef == request.EngineId,
43+
cancellationToken
44+
);
4245
if (build is null)
4346
throw new EntityNotFoundException($"Could not find the Build '{request.BuildId}'.");
4447
return new(GetBuildStatus.Found, mapper.Map(build));

0 commit comments

Comments
 (0)