diff --git a/backend/api/Controllers/MissionController.cs b/backend/api/Controllers/MissionController.cs index 614897266..3dc7f5682 100644 --- a/backend/api/Controllers/MissionController.cs +++ b/backend/api/Controllers/MissionController.cs @@ -380,15 +380,9 @@ [FromBody] ScheduledMissionQuery scheduledMissionQuery ) .ToList(); - var area = await _areaService.ReadByInstallationAndName(scheduledMissionQuery.InstallationCode, scheduledMissionQuery.AreaName); - - if (area == null) - { - // This is disabled for now as the Area database is not yet populated - //return NotFound($"Could not find area with name {scheduledMissionQuery.AreaName} in installation {scheduledMissionQuery.InstallationCode}"); - } - - // TODO: search for if a source with the given type and URL exists, then reuse it + Area? area = null; + if (scheduledMissionQuery.AreaName != null) + area = await _areaService.ReadByInstallationAndName(scheduledMissionQuery.InstallationCode, scheduledMissionQuery.AreaName); var scheduledMissionDefinition = new MissionDefinition { @@ -454,10 +448,9 @@ [FromBody] CustomMissionQuery customMissionQuery var missionTasks = customMissionQuery.Tasks.Select(task => new MissionTask(task)).ToList(); - var area = await _areaService.ReadByInstallationAndName(customMissionQuery.InstallationCode, customMissionQuery.AreaName); - - if (area == null) - return NotFound($"Could not find area with name {customMissionQuery.AreaName} in installation {customMissionQuery.InstallationCode}"); + Area? area = null; + if (customMissionQuery.AreaName != null) + area = await _areaService.ReadByInstallationAndName(customMissionQuery.InstallationCode, customMissionQuery.AreaName); string sourceURL = _customMissionService.UploadSource(missionTasks); diff --git a/backend/api/Controllers/Models/CustomMissionQuery.cs b/backend/api/Controllers/Models/CustomMissionQuery.cs index 06227546b..2750f3967 100644 --- a/backend/api/Controllers/Models/CustomMissionQuery.cs +++ b/backend/api/Controllers/Models/CustomMissionQuery.cs @@ -36,7 +36,7 @@ public struct CustomMissionQuery public TimeSpan? InspectionFrequency { get; set; } - public string AreaName { get; set; } + public string? AreaName { get; set; } public string Name { get; set; } diff --git a/backend/api/Controllers/Models/ScheduledMissionQuery.cs b/backend/api/Controllers/Models/ScheduledMissionQuery.cs index 52e580984..7c86c5dd4 100644 --- a/backend/api/Controllers/Models/ScheduledMissionQuery.cs +++ b/backend/api/Controllers/Models/ScheduledMissionQuery.cs @@ -6,7 +6,7 @@ public struct ScheduledMissionQuery public int EchoMissionId { get; set; } public DateTimeOffset DesiredStartTime { get; set; } public string InstallationCode { get; set; } - public string AreaName { get; set; } + public string? AreaName { get; set; } public TimeSpan? InspectionFrequency { get; set; } } }