Skip to content

Commit

Permalink
WIP: Fix custom missions
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddasol committed Sep 19, 2024
1 parent 8b29c1a commit a114a01
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
44 changes: 44 additions & 0 deletions backend/api/Services/MissionLoaders/EchoAndCustomMissionLoader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System.Globalization;
using System.Text.Json;
using Api.Controllers.Models;
using Api.Database.Models;
using Api.Utilities;
using Microsoft.Identity.Abstractions;
namespace Api.Services.MissionLoaders
{
public class EchoAndCustomMissionLoader(
IEchoService echoService,
ISourceService sourceService,
ILogger<EchoAndCustomMissionLoader> logger) : IMissionLoader

Check warning on line 12 in backend/api/Services/MissionLoaders/EchoAndCustomMissionLoader.cs

View workflow job for this annotation

GitHub Actions / build_backend

Parameter 'logger' is unread.

Check warning on line 12 in backend/api/Services/MissionLoaders/EchoAndCustomMissionLoader.cs

View workflow job for this annotation

GitHub Actions / build_backend

Parameter 'logger' is unread.

Check failure on line 12 in backend/api/Services/MissionLoaders/EchoAndCustomMissionLoader.cs

View workflow job for this annotation

GitHub Actions / test_backend

Parameter 'logger' is unread.

Check failure on line 12 in backend/api/Services/MissionLoaders/EchoAndCustomMissionLoader.cs

View workflow job for this annotation

GitHub Actions / test_backend

Parameter 'logger' is unread.
{
public async Task<IQueryable<MissionDefinition>> GetAvailableMissions(string? installationCode)
{
return await echoService.GetAvailableMissions(installationCode);
}

public async Task<MissionDefinition?> GetMissionById(string sourceMissionId)
{
//TODO:
// If source = custom
// getCustomMission
// Else:
return await echoService.GetMissionById(sourceMissionId);
}


public async Task<List<MissionTask>> GetTasksForMission(string missionSourceId)
{
//TODO:
// If source = custom
// getTasksForCustomMission
// Else:
return await sourceService.GetMissionTasksFromSourceId(missionSourceId);

Check warning on line 35 in backend/api/Services/MissionLoaders/EchoAndCustomMissionLoader.cs

View workflow job for this annotation

GitHub Actions / build_backend

Possible null reference return.

Check warning on line 35 in backend/api/Services/MissionLoaders/EchoAndCustomMissionLoader.cs

View workflow job for this annotation

GitHub Actions / build_backend

Possible null reference return.

Check failure on line 35 in backend/api/Services/MissionLoaders/EchoAndCustomMissionLoader.cs

View workflow job for this annotation

GitHub Actions / test_backend

Possible null reference return.

Check failure on line 35 in backend/api/Services/MissionLoaders/EchoAndCustomMissionLoader.cs

View workflow job for this annotation

GitHub Actions / test_backend

Possible null reference return.
return await echoService.GetTasksForMission(missionSourceId);

Check warning on line 36 in backend/api/Services/MissionLoaders/EchoAndCustomMissionLoader.cs

View workflow job for this annotation

GitHub Actions / build_backend

Unreachable code detected

Check warning on line 36 in backend/api/Services/MissionLoaders/EchoAndCustomMissionLoader.cs

View workflow job for this annotation

GitHub Actions / build_backend

Unreachable code detected

Check failure on line 36 in backend/api/Services/MissionLoaders/EchoAndCustomMissionLoader.cs

View workflow job for this annotation

GitHub Actions / test_backend

Unreachable code detected

Check failure on line 36 in backend/api/Services/MissionLoaders/EchoAndCustomMissionLoader.cs

View workflow job for this annotation

GitHub Actions / test_backend

Unreachable code detected
}

public async Task<List<PlantInfo>> GetPlantInfos()
{
return await echoService.GetPlantInfos();
}
}
}
2 changes: 2 additions & 0 deletions backend/api/Services/SourceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public interface ISourceService

public abstract Task<Source> CreateSourceIfDoesNotExist(List<MissionTask> tasks, bool readOnly = true);

public abstract Task<List<MissionTask>?> GetMissionTasksFromSourceId(string id);

public abstract Task<Source?> Delete(string id);

public void DetachTracking(Source source);
Expand Down

0 comments on commit a114a01

Please sign in to comment.