feat(api,dal): в модель JobGroupType добавлено поле description. В job контроллерах убрано поле isUmbrella, добавлено JobType.
This commit is contained in:
@@ -78,7 +78,7 @@ namespace PARR.API.Controllers.V1
|
||||
{
|
||||
query = query
|
||||
.Include(t => t.Tnk)
|
||||
.Include(t => t.Group);
|
||||
.Include(t => t.Group).ThenInclude(t=>t.GroupType);
|
||||
|
||||
query = query
|
||||
.Include(t => t.UnitFilters)
|
||||
@@ -117,7 +117,7 @@ namespace PARR.API.Controllers.V1
|
||||
{
|
||||
var job = await jobService.Get()
|
||||
.Include(t => t.Tnk)
|
||||
.Include(t => t.Group)
|
||||
.Include(t => t.Group).ThenInclude(t=>t.GroupType)
|
||||
.Include(t => t.UnitFilters)
|
||||
.ThenInclude(t => t.FieldFilters)
|
||||
.ThenInclude(t => t.UnitField)
|
||||
@@ -178,7 +178,7 @@ namespace PARR.API.Controllers.V1
|
||||
|
||||
var createdJob = await jobService.Get()
|
||||
.Include(t => t.Tnk)
|
||||
.Include(t => t.Group)
|
||||
.Include(t => t.Group).ThenInclude(t=>t.GroupType)
|
||||
.Include(t => t.UnitFilters)
|
||||
.ThenInclude(t => t.FieldFilters)
|
||||
.ThenInclude(t => t.UnitField)
|
||||
@@ -211,7 +211,7 @@ namespace PARR.API.Controllers.V1
|
||||
|
||||
var orig = await jobService.Get()
|
||||
.Include(t => t.Tnk)
|
||||
.Include(t => t.Group)
|
||||
.Include(t => t.Group).ThenInclude(t=>t.GroupType)
|
||||
.Include(t => t.UnitFilters)
|
||||
.ThenInclude(t => t.FieldFilters)
|
||||
.Include(t => t.UnitFilters)
|
||||
@@ -298,7 +298,7 @@ namespace PARR.API.Controllers.V1
|
||||
|
||||
var updatedJob = await jobService.Get()
|
||||
.Include(t => t.Tnk)
|
||||
.Include(t => t.Group)
|
||||
.Include(t => t.Group).ThenInclude(t => t.GroupType)
|
||||
.Include(t => t.UnitFilters)
|
||||
.ThenInclude(t => t.FieldFilters)
|
||||
.ThenInclude(t => t.UnitField)
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace PARR.API.Controllers.V1
|
||||
{
|
||||
var paginationFilter = mapper.Map<PaginationFilter>(paginationQuery);
|
||||
|
||||
IQueryable<JobGroup> query = groupService.Get();
|
||||
IQueryable<JobGroup> query = groupService.Get().Include(t => t.GroupType);
|
||||
|
||||
query = query.OrderBy(t => t.GroupName);
|
||||
|
||||
@@ -104,6 +104,7 @@ namespace PARR.API.Controllers.V1
|
||||
{
|
||||
var jobGroup = await groupService.Get()
|
||||
.Include(t => t.Jobs).ThenInclude(t => t.Tnk)
|
||||
.Include(t => t.GroupType)
|
||||
.FirstOrDefaultAsync(t => t.Id == id);
|
||||
|
||||
if (jobGroup == null)
|
||||
@@ -133,7 +134,8 @@ namespace PARR.API.Controllers.V1
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
GroupName = request.Name.Trim(),
|
||||
IsUmbrella = request.IsUmbrella,
|
||||
//IsUmbrella = request.IsUmbrella,
|
||||
GroupTypeId = request.GroupTypeId,
|
||||
ShortDescription = request.ShortDescription.Trim(),
|
||||
FullDescription = request.FullDescription.Trim(),
|
||||
Solution = request.Solution.Trim(),
|
||||
@@ -164,6 +166,7 @@ namespace PARR.API.Controllers.V1
|
||||
|
||||
|
||||
var createdJobGroup = await groupService.Get().Include(t => t.Jobs).ThenInclude(t => t.Tnk)
|
||||
.Include(t => t.GroupType)
|
||||
.FirstAsync(t => t.Id == jobGroup.Id);
|
||||
|
||||
var locationUri = uriService.GetUri(ApiRoutes.JobGroup.Get, ApiRoutes.JobGroup.getParam, createdJobGroup.Id);
|
||||
@@ -201,7 +204,8 @@ namespace PARR.API.Controllers.V1
|
||||
var isScheduleChanged = IsScheduleChanged(orig, request);
|
||||
|
||||
orig.GroupName = request.Name.Trim();
|
||||
orig.IsUmbrella = request.IsUmbrella;
|
||||
//orig.IsUmbrella = request.IsUmbrella;
|
||||
orig.GroupTypeId = request.GroupTypeId;
|
||||
orig.ShortDescription = request.ShortDescription.Trim();
|
||||
orig.FullDescription = request.FullDescription.Trim();
|
||||
orig.Solution = request.Solution.Trim();
|
||||
@@ -258,6 +262,7 @@ namespace PARR.API.Controllers.V1
|
||||
var updatedJobGroup = await groupService.Get()
|
||||
.Include(t => t.Jobs)
|
||||
.ThenInclude(t => t.Tnk)
|
||||
.Include(t => t.GroupType)
|
||||
.FirstAsync(t => t.Id == orig.Id);
|
||||
|
||||
var response = mapper.Map<JobGroupResponse>(updatedJobGroup);
|
||||
|
||||
48
PARR.API/Controllers/V1/JobGroupTypeController.cs
Normal file
48
PARR.API/Controllers/V1/JobGroupTypeController.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.API.Contracts.V1;
|
||||
using PARR.API.Contracts.V1.Responses;
|
||||
using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.Constants;
|
||||
using PARR.DAL.Services.Interfaces.Job;
|
||||
|
||||
namespace PARR.API.Controllers.V1
|
||||
{
|
||||
/// <summary>
|
||||
/// Список типов групп работ
|
||||
/// </summary>
|
||||
[Authorize(Roles = ParrRoles.Administrator.Role)]
|
||||
public class JobGroupTypeController : BaseApiController
|
||||
{
|
||||
private readonly IJobGroupTypeService jobGroupTypeService;
|
||||
private readonly IMapper mapper;
|
||||
|
||||
public JobGroupTypeController(
|
||||
IJobGroupTypeService jobGroupTypeService,
|
||||
IMapper mapper
|
||||
)
|
||||
{
|
||||
this.jobGroupTypeService = jobGroupTypeService;
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet(ApiRoutes.JobGroupType.GetAll)]
|
||||
public async Task<IActionResult> GetAll()
|
||||
{
|
||||
var query = jobGroupTypeService.Get().OrderBy(t => t.Description);
|
||||
|
||||
var types = await query.ToListAsync();
|
||||
|
||||
if (!types.Any())
|
||||
return NoContent();
|
||||
|
||||
var response = mapper.Map<List<JobGroupTypeResponse>>(types);
|
||||
|
||||
return Ok(new Response<List<JobGroupTypeResponse>>(response, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user