-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for using both echo and custom mission
- Loading branch information
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
backend/api/Services/MissionLoaders/EchoAndCustomMissionLoader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Api.Controllers.Models; | ||
using Api.Database.Models; | ||
namespace Api.Services.MissionLoaders | ||
{ | ||
public class EchoAndCustomMissionLoader( | ||
IEchoService echoService, | ||
ISourceService sourceService) : IMissionLoader | ||
{ | ||
public async Task<IQueryable<MissionDefinition>> GetAvailableMissions(string? installationCode) | ||
{ | ||
return await echoService.GetAvailableMissions(installationCode); | ||
} | ||
|
||
public async Task<MissionDefinition?> GetMissionById(string sourceMissionId) | ||
{ | ||
return await echoService.GetMissionById(sourceMissionId); | ||
} | ||
|
||
public async Task<List<MissionTask>> GetTasksForMission(string missionSourceId) | ||
{ | ||
var customMissionTasks = await sourceService.GetMissionTasksFromSourceId(missionSourceId); | ||
if (customMissionTasks != null) | ||
{ | ||
return customMissionTasks; | ||
} | ||
else | ||
{ | ||
return await echoService.GetTasksForMission(missionSourceId); | ||
} | ||
} | ||
|
||
public async Task<List<PlantInfo>> GetPlantInfos() | ||
{ | ||
return await echoService.GetPlantInfos(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters