Изменен минимальный респонс /jobs/ip/ (согласовано с Пригода Д.В.)
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
public DateTimeOffset StartAt { get; set; }
|
||||
public int FrequencyMinute { get; set; }
|
||||
public required JobModeResponse JobMode { get; set; }
|
||||
public required string ScriptName { get; set; }
|
||||
public required string Script { get; set; }
|
||||
}
|
||||
|
||||
public class JobGetAllResponse : JobBaseResponse
|
||||
@@ -19,4 +19,11 @@
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class JobMinResponse
|
||||
{
|
||||
public DateTimeOffset StartAt { get; set; }
|
||||
|
||||
public required string Script { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,14 +133,16 @@ namespace PARR.API.Controllers.V1
|
||||
|
||||
|
||||
// возврат минимального ответа
|
||||
try
|
||||
{
|
||||
return Ok(jobsToResponse.ToDictionary(t => t.ScriptName, d => d.StartAt));
|
||||
}
|
||||
catch (ArgumentException ex)
|
||||
{
|
||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Не могу создать json объект с одинаковым значением ключа (ScriptName). {ex.Message}" } }));
|
||||
}
|
||||
return Ok(mapper.Map<List<JobMinResponse>>(jobsToResponse));
|
||||
|
||||
//try
|
||||
//{
|
||||
// return Ok(jobsToResponse.ToDictionary(t => t.ScriptName, d => d.StartAt));
|
||||
//}
|
||||
//catch (ArgumentException ex)
|
||||
//{
|
||||
// return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = $"Не могу создать json объект с одинаковым значением ключа (ScriptName). {ex.Message}" } }));
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,9 +11,16 @@ namespace PARR.API.MappingProfiles
|
||||
// --- Job ---
|
||||
CreateMap<Job, JobBaseResponse>()
|
||||
.Include<Job, JobGetAllResponse>()
|
||||
.ForMember(d => d.FrequencyMinute, o => o.MapFrom(s => s.Frequency));
|
||||
.ForMember(d => d.FrequencyMinute, o => o.MapFrom(s => s.Frequency))
|
||||
.ForMember(d => d.Script, o => o.MapFrom(s => s.ScriptName));
|
||||
|
||||
CreateMap<Job, JobGetAllResponse>();
|
||||
|
||||
CreateMap<Job, JobMinResponse>()
|
||||
.ForMember(d => d.Script, o => o.MapFrom(s => s.ScriptName));
|
||||
// === Job ===
|
||||
|
||||
|
||||
|
||||
CreateMap<JobMode, JobModeResponse>();
|
||||
}
|
||||
|
||||
6
PARR.API/MappingProfiles/Resolvers/.gitkeep
Normal file
6
PARR.API/MappingProfiles/Resolvers/.gitkeep
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace PARR.API.MappingProfiles.Resolvers
|
||||
{
|
||||
public class _
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -33,11 +33,6 @@
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="MappingProfiles\Resolvers\" />
|
||||
<Folder Include="Validators\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PARR.DAL\PARR.DAL.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
6
PARR.API/Validators/.gitkeep
Normal file
6
PARR.API/Validators/.gitkeep
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace PARR.API.Validators
|
||||
{
|
||||
public class _
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user