Browse Source

Merge branch 'bugfix/date_and_user_issue_BE' of Neca/HRCenter into BE_dev

pull/47/head
safet.purkovic 3 years ago
parent
commit
913ac28d07

+ 1
- 0
Diligent.WebAPI.Business/Services/ApplicantService.cs View File

@@ -39,6 +39,7 @@ namespace Diligent.WebAPI.Business.Services
{
var applicant = await _context.Applicants
.Include(a => a.SelectionProcesses).ThenInclude(sp => sp.SelectionLevel)
.Include(a => a.SelectionProcesses).ThenInclude(sp => sp.Scheduler)
.FirstOrDefaultAsync(a => a.ApplicantId == id);

if (applicant is null)

+ 1
- 1
Diligent.WebAPI.Business/Services/Interfaces/ISelectionProcessService.cs View File

@@ -9,7 +9,7 @@ namespace Diligent.WebAPI.Business.Services.Interfaces
Task DeleteAsync(int id);
Task<List<SelectionProcessResposneDto>> GetAllAsync();
Task<SelectionProcessResposneDto> GetByIdAsync(int id);
Task<bool> FinishSelectionProcess(int id);
Task<bool> FinishSelectionProcess(SelectionProcessCreateDto model);
Task UpdateAsync(int id, SelectionProcessCreateDto model);
}
}

+ 5
- 4
Diligent.WebAPI.Business/Services/SelectionProcessService.cs View File

@@ -60,9 +60,9 @@ namespace Diligent.WebAPI.Business.Services
await _context.SaveChangesAsync();
}

public async Task<bool> FinishSelectionProcess(int id)
public async Task<bool> FinishSelectionProcess(SelectionProcessCreateDto model)
{
var sp = await _context.SelectionProcesses.FindAsync(id);
var sp = await _context.SelectionProcesses.FindAsync(model.Id);

if (sp is null)
throw new EntityNotFoundException("Selection process not found");
@@ -76,10 +76,11 @@ namespace Diligent.WebAPI.Business.Services

SelectionProcess newProcess = new SelectionProcess
{
Name = sp.Name,
Name = model.Name,
SelectionLevelId = nextLevel.Id,
Status = "Čeka na zakazivanje",
ApplicantId = sp.ApplicantId
ApplicantId = sp.ApplicantId,
SchedulerId = model.SchedulerId
};
_context.SelectionProcesses.Add(newProcess);


+ 4
- 3
Diligent.WebAPI.Contracts/DTOs/SelectionProcess/SelectionProcessCreateDto.cs View File

@@ -2,11 +2,12 @@
{
public class SelectionProcessCreateDto
{
public string Name { get; set; }
public string Status { get; set; }
public int Id { get; set; }
public string? Name { get; set; }
public string? Status { get; set; }
public DateTime? Date { get; set; }
public string? Link { get; set; }
public int? SchedulerId { get; set; }
public int SchedulerId { get; set; }
public int SelectionLevelId { get; set; }
public int ApplicantId { get; set; }
}

+ 1
- 1
Diligent.WebAPI.Contracts/DTOs/SelectionProcess/SelectionProcessResposneWithoutApplicantDto.cs View File

@@ -8,7 +8,7 @@ namespace Diligent.WebAPI.Contracts.DTOs.SelectionProcess
public string Status { get; set; }
public DateTime? Date { get; set; }
public string? Link { get; set; }
public UserResponseDTO User { get; set; }
public UserResponseDTO Scheduler { get; set; }
public SelectionLevelResposneDto SelectionLevel { get; set; }
}
}

+ 9
- 9
Diligent.WebAPI.Host/Controllers/V1/SelectionProcessesController.cs View File

@@ -19,16 +19,16 @@ namespace Diligent.WebAPI.Host.Controllers.V1
public async Task<IActionResult> GetAll() =>
Ok(await _selectionProcessesService.GetAllAsync());

[HttpGet("{id}")]
public async Task<IActionResult> FinishSelectionProcess([FromRoute] int id) =>
Ok(await _selectionProcessesService.FinishSelectionProcess(id));

[HttpPost]
public async Task<IActionResult> Create([FromBody] SelectionProcessCreateDto request)
{
await _selectionProcessesService.CreateAsync(request);
return StatusCode((int)HttpStatusCode.Created);
}
public async Task<IActionResult> FinishSelectionProcess([FromBody] SelectionProcessCreateDto model) =>
Ok(await _selectionProcessesService.FinishSelectionProcess(model));

//[HttpPost]
//public async Task<IActionResult> Create([FromBody] SelectionProcessCreateDto request)
//{
// await _selectionProcessesService.CreateAsync(request);
// return StatusCode((int)HttpStatusCode.Created);
//}

[HttpPut("{id}")]
public async Task<IActionResult> Update([FromBody] SelectionProcessCreateDto request, [FromRoute] int id)

Loading…
Cancel
Save