Quellcode durchsuchen

Added code for selection process

pull/42/head
Safet Purkovic vor 3 Jahren
Ursprung
Commit
696aa09775
25 geänderte Dateien mit 1602 neuen und 0 gelöschten Zeilen
  1. 18
    0
      Diligent.WebAPI.Business/MappingProfiles/SelectionLevelMappingProfile.cs
  2. 19
    0
      Diligent.WebAPI.Business/MappingProfiles/SelectionProcessMappingProfile.cs
  3. 11
    0
      Diligent.WebAPI.Business/Services/ApplicantService.cs
  4. 1
    0
      Diligent.WebAPI.Business/Services/Interfaces/IApplicantService.cs
  5. 12
    0
      Diligent.WebAPI.Business/Services/Interfaces/ISelectionLevelService.cs
  6. 15
    0
      Diligent.WebAPI.Business/Services/Interfaces/ISelectionProcessService.cs
  7. 31
    0
      Diligent.WebAPI.Business/Services/SelectionLevelService.cs
  8. 89
    0
      Diligent.WebAPI.Business/Services/SelectionProcessService.cs
  9. 2
    0
      Diligent.WebAPI.Contracts/DTOs/Applicant/ApplicantViewDto.cs
  10. 11
    0
      Diligent.WebAPI.Contracts/DTOs/SelectionLevel/SelectionLevelResponseWithDataDto.cs
  11. 15
    0
      Diligent.WebAPI.Contracts/DTOs/SelectionLevel/SelectionLevelResposneDto.cs
  12. 13
    0
      Diligent.WebAPI.Contracts/DTOs/SelectionProcess/SelectionProcessCreateDto.cs
  13. 15
    0
      Diligent.WebAPI.Contracts/DTOs/SelectionProcess/SelectionProcessResposneDto.cs
  14. 14
    0
      Diligent.WebAPI.Contracts/DTOs/SelectionProcess/SelectionProcessResposneWithoutApplicantDto.cs
  15. 10
    0
      Diligent.WebAPI.Data/DatabaseContext.cs
  16. 1
    0
      Diligent.WebAPI.Data/Entities/Applicant.cs
  17. 15
    0
      Diligent.WebAPI.Data/Entities/SelectionLevel.cs
  18. 17
    0
      Diligent.WebAPI.Data/Entities/SelectionProcess.cs
  19. 1003
    0
      Diligent.WebAPI.Data/Migrations/20221116135205_addedSelectionLevesAndProcesses.Designer.cs
  20. 97
    0
      Diligent.WebAPI.Data/Migrations/20221116135205_addedSelectionLevesAndProcesses.cs
  21. 113
    0
      Diligent.WebAPI.Data/Migrations/DatabaseContextModelSnapshot.cs
  22. 6
    0
      Diligent.WebAPI.Host/Controllers/V1/ApplicantsController.cs
  23. 23
    0
      Diligent.WebAPI.Host/Controllers/V1/SelectionLevelsController.cs
  24. 47
    0
      Diligent.WebAPI.Host/Controllers/V1/SelectionProcessesController.cs
  25. 4
    0
      Diligent.WebAPI.Host/Extensions/BusinessConfigurationExtension.cs

+ 18
- 0
Diligent.WebAPI.Business/MappingProfiles/SelectionLevelMappingProfile.cs Datei anzeigen

@@ -0,0 +1,18 @@

using Diligent.WebAPI.Contracts.DTOs.SelectionLevel;

namespace Diligent.WebAPI.Business.MappingProfiles
{
public class SelectionLevelMappingProfile : Profile
{
public SelectionLevelMappingProfile()
{


#region Model to DTO
CreateMap<SelectionLevel, SelectionLevelResposneDto>();
CreateMap<SelectionLevel, SelectionLevelResponseWithDataDto>();
#endregion
}
}
}

+ 19
- 0
Diligent.WebAPI.Business/MappingProfiles/SelectionProcessMappingProfile.cs Datei anzeigen

@@ -0,0 +1,19 @@
using Diligent.WebAPI.Contracts.DTOs.SelectionProcess;

namespace Diligent.WebAPI.Business.MappingProfiles
{
public class SelectionProcessMappingProfile : Profile
{
public SelectionProcessMappingProfile()
{
#region DTO to Model
CreateMap<SelectionProcessCreateDto, SelectionProcess>();
#endregion

#region Model to DTO
CreateMap<SelectionProcess, SelectionProcessResposneDto>();
CreateMap<SelectionProcess, SelectionProcessResposneWithoutApplicantDto>();
#endregion
}
}
}

+ 11
- 0
Diligent.WebAPI.Business/Services/ApplicantService.cs Datei anzeigen

@@ -35,6 +35,17 @@ namespace Diligent.WebAPI.Business.Services

return _mapper.Map<ApplicantViewDto>(applicant);
}
public async Task<ApplicantViewDto> GetApplicantWithSelectionProcessesById(int id)
{
var applicant = await _context.Applicants
.Include(a => a.SelectionProcesses).ThenInclude(sp => sp.SelectionLevel)
.FirstOrDefaultAsync(a => a.ApplicantId == id);

if (applicant is null)
throw new EntityNotFoundException("Applicant not found");

return _mapper.Map<ApplicantViewDto>(applicant);
}
public async Task CreateApplicant(ApplicantCreateDto applicantCreateDto)
{
var applicant = _mapper.Map<Applicant>(applicantCreateDto);

+ 1
- 0
Diligent.WebAPI.Business/Services/Interfaces/IApplicantService.cs Datei anzeigen

@@ -5,6 +5,7 @@ namespace Diligent.WebAPI.Business.Services.Interfaces
{
Task<List<ApplicantViewDto>> GetAll();
Task<ApplicantViewDto> GetById(int id);
Task<ApplicantViewDto> GetApplicantWithSelectionProcessesById(int id);
Task CreateApplicant(ApplicantCreateDto applicantCreateDto);
Task DeleteApplicant(int id);
Task UpdateApplicant(int id, ApplicantUpdateDto applicantUpdateDto);

+ 12
- 0
Diligent.WebAPI.Business/Services/Interfaces/ISelectionLevelService.cs Datei anzeigen

@@ -0,0 +1,12 @@

using Diligent.WebAPI.Contracts.DTOs.SelectionLevel;
using Diligent.WebAPI.Contracts.DTOs.SelectionProcess;

namespace Diligent.WebAPI.Business.Services.Interfaces
{
public interface ISelectionLevelService
{
Task<List<SelectionLevelResponseWithDataDto>> GetAllAsync();
Task<SelectionLevelResposneDto> GetByIdAsync(int id);
}
}

+ 15
- 0
Diligent.WebAPI.Business/Services/Interfaces/ISelectionProcessService.cs Datei anzeigen

@@ -0,0 +1,15 @@

using Diligent.WebAPI.Contracts.DTOs.SelectionProcess;

namespace Diligent.WebAPI.Business.Services.Interfaces
{
public interface ISelectionProcessService
{
Task CreateAsync(SelectionProcessCreateDto model);
Task DeleteAsync(int id);
Task<List<SelectionProcessResposneDto>> GetAllAsync();
Task<SelectionProcessResposneDto> GetByIdAsync(int id);
Task<bool> FinishSelectionProcess(int id);
Task UpdateAsync(int id, SelectionProcessCreateDto model);
}
}

+ 31
- 0
Diligent.WebAPI.Business/Services/SelectionLevelService.cs Datei anzeigen

@@ -0,0 +1,31 @@
using Diligent.WebAPI.Contracts.DTOs.SelectionLevel;
using Diligent.WebAPI.Contracts.DTOs.SelectionProcess;

namespace Diligent.WebAPI.Business.Services
{
public class SelectionLevelService : ISelectionLevelService
{
private readonly DatabaseContext _context;
private readonly IMapper _mapper;

public SelectionLevelService(DatabaseContext context, IMapper mapper)
{
_context = context;
_mapper = mapper;
}

public async Task<List<SelectionLevelResponseWithDataDto>> GetAllAsync() =>
_mapper.Map<List<SelectionLevelResponseWithDataDto>>(await _context.SelectionLevels.Include(sl => sl.SelectionProcesses).ThenInclude(sp => sp.Applicant).ToListAsync());

public async Task<SelectionLevelResposneDto> GetByIdAsync(int id)
{
var sl = await _context.SelectionLevels.FindAsync(id);

if (sl is null)
throw new EntityNotFoundException("Selection level not found");

return _mapper.Map<SelectionLevelResposneDto>(sl);

}
}
}

+ 89
- 0
Diligent.WebAPI.Business/Services/SelectionProcessService.cs Datei anzeigen

@@ -0,0 +1,89 @@
using Diligent.WebAPI.Contracts.DTOs.SelectionProcess;
using static System.Net.Mime.MediaTypeNames;
using System.Collections.Generic;

namespace Diligent.WebAPI.Business.Services
{
public class SelectionProcessService : ISelectionProcessService
{
private readonly DatabaseContext _context;
private readonly IMapper _mapper;

public SelectionProcessService(DatabaseContext context, IMapper mapper)
{
_context = context;
_mapper = mapper;
}

public async Task<List<SelectionProcessResposneDto>> GetAllAsync() =>
_mapper.Map<List<SelectionProcessResposneDto>>(await _context.SelectionProcesses.ToListAsync());

public async Task<SelectionProcessResposneDto> GetByIdAsync(int id)
{
var sp = await _context.SelectionProcesses.FindAsync(id);

if (sp is null)
throw new EntityNotFoundException("Selection process not found");

return _mapper.Map<SelectionProcessResposneDto>(sp);

}

public async Task CreateAsync(SelectionProcessCreateDto model)
{
await _context.SelectionProcesses.AddAsync(_mapper.Map<SelectionProcess>(model));

await _context.SaveChangesAsync();
}

public async Task UpdateAsync(int id, SelectionProcessCreateDto model)
{
var sp = await _context.SelectionProcesses.FindAsync(id);

if (sp is null)
throw new EntityNotFoundException("Selection process not found");

_mapper.Map(model, sp);

_context.Entry(sp).State = EntityState.Modified;
await _context.SaveChangesAsync();
}

public async Task DeleteAsync(int id)
{
var sp = await _context.SelectionProcesses.FindAsync(id);

if (sp is null)
throw new EntityNotFoundException("Selection process not found");

_context.SelectionProcesses.Remove(sp);
await _context.SaveChangesAsync();
}

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

if (sp is null)
throw new EntityNotFoundException("Selection process not found");

sp.Status = "Odrađen";

var nextLevel = _context.SelectionLevels.AsEnumerable().SkipWhile(obj => obj.Id != sp.SelectionLevelId).Skip(1).First();

if (nextLevel is null)
throw new EntityNotFoundException("Candidate came to last selection level");

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

return await _context.SaveChangesAsync() > 0;
}
}
}

+ 2
- 0
Diligent.WebAPI.Contracts/DTOs/Applicant/ApplicantViewDto.cs Datei anzeigen

@@ -1,5 +1,6 @@
using Diligent.WebAPI.Contracts.DTOs.Ad;
using Diligent.WebAPI.Contracts.DTOs.Comment;
using Diligent.WebAPI.Contracts.DTOs.SelectionProcess;
using Diligent.WebAPI.Contracts.DTOs.Technology;

namespace Diligent.WebAPI.Contracts.DTOs.Applicant
@@ -22,5 +23,6 @@ namespace Diligent.WebAPI.Contracts.DTOs.Applicant
public List<TechnologyViewDto> TechnologyApplicants { get; set; } = new();
public List<CommentViewDto> Comments { get; set; }
public List<AdResponseDto> Ads { get; set; }
public List<SelectionProcessResposneWithoutApplicantDto> SelectionProcesses { get; set; }
}
}

+ 11
- 0
Diligent.WebAPI.Contracts/DTOs/SelectionLevel/SelectionLevelResponseWithDataDto.cs Datei anzeigen

@@ -0,0 +1,11 @@
using Diligent.WebAPI.Contracts.DTOs.SelectionProcess;

namespace Diligent.WebAPI.Contracts.DTOs.SelectionLevel
{
public class SelectionLevelResponseWithDataDto
{
public int Id { get; set; }
public string Name { get; set; }
public List<SelectionProcessResposneDto> SelectionProcesses { get; set; }
}
}

+ 15
- 0
Diligent.WebAPI.Contracts/DTOs/SelectionLevel/SelectionLevelResposneDto.cs Datei anzeigen

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Diligent.WebAPI.Contracts.DTOs.SelectionLevel
{
public class SelectionLevelResposneDto
{
public int Id { get; set; }

public string Name { get; set; }
}
}

+ 13
- 0
Diligent.WebAPI.Contracts/DTOs/SelectionProcess/SelectionProcessCreateDto.cs Datei anzeigen

@@ -0,0 +1,13 @@
namespace Diligent.WebAPI.Contracts.DTOs.SelectionProcess
{
public class SelectionProcessCreateDto
{
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 SelectionLevelId { get; set; }
public int ApplicantId { get; set; }
}
}

+ 15
- 0
Diligent.WebAPI.Contracts/DTOs/SelectionProcess/SelectionProcessResposneDto.cs Datei anzeigen

@@ -0,0 +1,15 @@
using Diligent.WebAPI.Contracts.DTOs.Applicant;

namespace Diligent.WebAPI.Contracts.DTOs.SelectionProcess
{
public class SelectionProcessResposneDto
{
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 ApplicantViewDto Applicant { get; set; }
public int SelectionLevelId { get; set; }
}
}

+ 14
- 0
Diligent.WebAPI.Contracts/DTOs/SelectionProcess/SelectionProcessResposneWithoutApplicantDto.cs Datei anzeigen

@@ -0,0 +1,14 @@
using Diligent.WebAPI.Contracts.DTOs.SelectionLevel;
using Diligent.WebAPI.Contracts.DTOs.User;

namespace Diligent.WebAPI.Contracts.DTOs.SelectionProcess
{
public class SelectionProcessResposneWithoutApplicantDto
{
public string Status { get; set; }
public DateTime? Date { get; set; }
public string? Link { get; set; }
public UserResponseDTO User { get; set; }
public SelectionLevelResposneDto SelectionLevel { get; set; }
}
}

+ 10
- 0
Diligent.WebAPI.Data/DatabaseContext.cs Datei anzeigen

@@ -15,12 +15,22 @@ public class DatabaseContext : IdentityDbContext<User, AppRole, int>
public DbSet<Technology> Technologies { get; set; }
public DbSet<TechnologyApplicant> ApplicantTechnologies { get; set; }
public DbSet<Comment> Comments { get; set; }
public DbSet<SelectionLevel> SelectionLevels { get; set; }
public DbSet<SelectionProcess> SelectionProcesses { get; set; }


public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { }

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<SelectionLevel>().HasData(
new List<SelectionLevel>{
new SelectionLevel{ Id = 1, Name = "HR intervju"},
new SelectionLevel{ Id = 2, Name = "Screening test"},
new SelectionLevel{ Id = 3, Name = "Tehnicki intervju"},
new SelectionLevel{ Id = 4, Name = "Konacna odluka"},
});
modelBuilder.ApplyConfiguration(new ApplicantConfiguration());
modelBuilder.ApplyConfiguration(new TechnologyConfiguration());
modelBuilder.ApplyConfiguration(new CommentConfiguration());

+ 1
- 0
Diligent.WebAPI.Data/Entities/Applicant.cs Datei anzeigen

@@ -18,5 +18,6 @@
public List<TechnologyApplicant> TechnologyApplicants { get; set; }
public List<Comment> Comments { get; set; }
public List<Ad> Ads { get; set; }
public List<SelectionProcess> SelectionProcesses { get; set; }
}
}

+ 15
- 0
Diligent.WebAPI.Data/Entities/SelectionLevel.cs Datei anzeigen

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Diligent.WebAPI.Data.Entities
{
public class SelectionLevel
{
public int Id { get; set; }
public string Name { get; set; }
public List<SelectionProcess> SelectionProcesses { get; set; }
}
}

+ 17
- 0
Diligent.WebAPI.Data/Entities/SelectionProcess.cs Datei anzeigen

@@ -0,0 +1,17 @@
namespace Diligent.WebAPI.Data.Entities
{
public class SelectionProcess
{
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 User Scheduler { get; set; }
public int SelectionLevelId { get; set; }
public SelectionLevel SelectionLevel { get; set; }
public int ApplicantId { get; set; }
public Applicant Applicant { get; set; }
}
}

+ 1003
- 0
Diligent.WebAPI.Data/Migrations/20221116135205_addedSelectionLevesAndProcesses.Designer.cs
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 97
- 0
Diligent.WebAPI.Data/Migrations/20221116135205_addedSelectionLevesAndProcesses.cs Datei anzeigen

@@ -0,0 +1,97 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Diligent.WebAPI.Data.Migrations
{
public partial class addedSelectionLevesAndProcesses : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SelectionLevels",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SelectionLevels", x => x.Id);
});

migrationBuilder.CreateTable(
name: "SelectionProcesses",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
Status = table.Column<string>(type: "nvarchar(max)", nullable: false),
Date = table.Column<DateTime>(type: "datetime2", nullable: true),
Link = table.Column<string>(type: "nvarchar(max)", nullable: true),
SchedulerId = table.Column<int>(type: "int", nullable: true),
SelectionLevelId = table.Column<int>(type: "int", nullable: false),
ApplicantId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SelectionProcesses", x => x.Id);
table.ForeignKey(
name: "FK_SelectionProcesses_Applicants_ApplicantId",
column: x => x.ApplicantId,
principalTable: "Applicants",
principalColumn: "ApplicantId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_SelectionProcesses_AspNetUsers_SchedulerId",
column: x => x.SchedulerId,
principalTable: "AspNetUsers",
principalColumn: "Id");
table.ForeignKey(
name: "FK_SelectionProcesses_SelectionLevels_SelectionLevelId",
column: x => x.SelectionLevelId,
principalTable: "SelectionLevels",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});

migrationBuilder.InsertData(
table: "SelectionLevels",
columns: new[] { "Id", "Name" },
values: new object[,]
{
{ 1, "HR intervju" },
{ 2, "Screening test" },
{ 3, "Tehnicki intervju" },
{ 4, "Konacna odluka" }
});

migrationBuilder.CreateIndex(
name: "IX_SelectionProcesses_ApplicantId",
table: "SelectionProcesses",
column: "ApplicantId");

migrationBuilder.CreateIndex(
name: "IX_SelectionProcesses_SchedulerId",
table: "SelectionProcesses",
column: "SchedulerId");

migrationBuilder.CreateIndex(
name: "IX_SelectionProcesses_SelectionLevelId",
table: "SelectionProcesses",
column: "SelectionLevelId");
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SelectionProcesses");

migrationBuilder.DropTable(
name: "SelectionLevels");
}
}
}

+ 113
- 0
Diligent.WebAPI.Data/Migrations/DatabaseContextModelSnapshot.cs Datei anzeigen

@@ -405,6 +405,87 @@ namespace Diligent.WebAPI.Data.Migrations
b.ToTable("RefreshTokens");
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.SelectionLevel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);

b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");

b.HasKey("Id");

b.ToTable("SelectionLevels");

b.HasData(
new
{
Id = 1,
Name = "HR intervju"
},
new
{
Id = 2,
Name = "Screening test"
},
new
{
Id = 3,
Name = "Tehnicki intervju"
},
new
{
Id = 4,
Name = "Konacna odluka"
});
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.SelectionProcess", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");

SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);

b.Property<int>("ApplicantId")
.HasColumnType("int");

b.Property<DateTime?>("Date")
.HasColumnType("datetime2");

b.Property<string>("Link")
.HasColumnType("nvarchar(max)");

b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");

b.Property<int?>("SchedulerId")
.HasColumnType("int");

b.Property<int>("SelectionLevelId")
.HasColumnType("int");

b.Property<string>("Status")
.IsRequired()
.HasColumnType("nvarchar(max)");

b.HasKey("Id");

b.HasIndex("ApplicantId");

b.HasIndex("SchedulerId");

b.HasIndex("SelectionLevelId");

b.ToTable("SelectionProcesses");
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Technology", b =>
{
b.Property<int>("TechnologyId")
@@ -785,6 +866,31 @@ namespace Diligent.WebAPI.Data.Migrations
b.Navigation("User");
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.SelectionProcess", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.Applicant", "Applicant")
.WithMany("SelectionProcesses")
.HasForeignKey("ApplicantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

b.HasOne("Diligent.WebAPI.Data.Entities.User", "Scheduler")
.WithMany()
.HasForeignKey("SchedulerId");

b.HasOne("Diligent.WebAPI.Data.Entities.SelectionLevel", "SelectionLevel")
.WithMany("SelectionProcesses")
.HasForeignKey("SelectionLevelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

b.Navigation("Applicant");

b.Navigation("Scheduler");

b.Navigation("SelectionLevel");
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.TechnologyApplicant", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.Applicant", "Applicant")
@@ -870,9 +976,16 @@ namespace Diligent.WebAPI.Data.Migrations
{
b.Navigation("Comments");

b.Navigation("SelectionProcesses");

b.Navigation("TechnologyApplicants");
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.SelectionLevel", b =>
{
b.Navigation("SelectionProcesses");
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Technology", b =>
{
b.Navigation("TechnologyApplicants");

+ 6
- 0
Diligent.WebAPI.Host/Controllers/V1/ApplicantsController.cs Datei anzeigen

@@ -25,5 +25,11 @@
{
return Ok(await _applicantService.GetById(id));
}

[HttpGet("processes/{id}")]
public async Task<IActionResult> GetProcesses(int id)
{
return Ok(await _applicantService.GetApplicantWithSelectionProcessesById(id));
}
}
}

+ 23
- 0
Diligent.WebAPI.Host/Controllers/V1/SelectionLevelsController.cs Datei anzeigen

@@ -0,0 +1,23 @@
namespace Diligent.WebAPI.Host.Controllers.V1
{
[ApiVersion("1.0")]
[Route("v{version:apiVersion}/selectionlevels")]
[ApiController]
public class SelectionLevelsController : ControllerBase
{
private readonly ISelectionLevelService _selectionLevelService;

public SelectionLevelsController(ISelectionLevelService selectionLevelService)
{
_selectionLevelService = selectionLevelService;
}

[HttpGet]
public async Task<IActionResult> GetAll() =>
Ok(await _selectionLevelService.GetAllAsync());

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

+ 47
- 0
Diligent.WebAPI.Host/Controllers/V1/SelectionProcessesController.cs Datei anzeigen

@@ -0,0 +1,47 @@

using Diligent.WebAPI.Contracts.DTOs.SelectionProcess;

namespace Diligent.WebAPI.Host.Controllers.V1
{
[ApiVersion("1.0")]
[Route("v{version:apiVersion}/selectionprocesses")]
[ApiController]
public class SelectionProcessesController : ControllerBase
{
private readonly ISelectionProcessService _selectionProcessesService;

public SelectionProcessesController(ISelectionProcessService selectionProcessesService)
{
_selectionProcessesService = selectionProcessesService;
}

[HttpGet]
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);
}

[HttpPut("{id}")]
public async Task<IActionResult> Update([FromBody] SelectionProcessCreateDto request, [FromRoute] int id)
{
await _selectionProcessesService.UpdateAsync(id, request);
return Ok();
}

[HttpDelete("{id}")]
public async Task<IActionResult> DeleteInsurer([FromRoute] int id)
{
await _selectionProcessesService.DeleteAsync(id);
return NoContent();
}
}
}

+ 4
- 0
Diligent.WebAPI.Host/Extensions/BusinessConfigurationExtension.cs Datei anzeigen

@@ -13,12 +13,16 @@
services.AddAutoMapper(typeof(InsurerMappingProfile));
services.AddAutoMapper(typeof(ApplicantMappingProfile));
services.AddAutoMapper(typeof(CommentMappingProfile));
services.AddAutoMapper(typeof(SelectionProcessMappingProfile));
services.AddAutoMapper(typeof(SelectionLevelMappingProfile));

services.AddScoped<IInsurersService, InsurersService>();
services.AddScoped<IEmailer, Emailer>();
services.AddScoped<IHttpClientService, HttpClientService>();
services.AddScoped<IInsuranceCompaniesService, InsuranceCompaniesService>();
services.AddScoped<IInsurancePoliciesService, InsurancePoliciesService>();
services.AddScoped<ISelectionProcessService, SelectionProcessService>();
services.AddScoped<ISelectionLevelService, SelectionLevelService>();
services.AddScoped<IWebhookSubscriptionService, WebhookSubscriptionService>();
services.AddScoped<IWebhookDefinitionService, WebhookDefinitionService>();
services.AddScoped<IWebhookPublisherService, WebhookPublisherService>();

Laden…
Abbrechen
Speichern