Bläddra i källkod

Added services and nedpoints

feature/1593_selection_process_BE
Safet Purkovic 3 år sedan
förälder
incheckning
cf6c6d1ee2
31 ändrade filer med 2342 tillägg och 46 borttagningar
  1. 1
    2
      Diligent.WebAPI.Business/MappingProfiles/AdMappingProfile.cs
  2. 18
    0
      Diligent.WebAPI.Business/MappingProfiles/SelectionLevelMappingProfile.cs
  3. 18
    0
      Diligent.WebAPI.Business/MappingProfiles/SelectionProcessMappingProfile.cs
  4. 1
    2
      Diligent.WebAPI.Business/Services/Interfaces/IAdService.cs
  5. 1
    2
      Diligent.WebAPI.Business/Services/Interfaces/IApplicantService.cs
  6. 12
    0
      Diligent.WebAPI.Business/Services/Interfaces/ISelectionLevelService.cs
  7. 14
    0
      Diligent.WebAPI.Business/Services/Interfaces/ISelectionProcessService.cs
  8. 31
    0
      Diligent.WebAPI.Business/Services/SelectionLevelService.cs
  9. 61
    0
      Diligent.WebAPI.Business/Services/SelectionProcessService.cs
  10. 1
    7
      Diligent.WebAPI.Contracts/DTOs/Ad/AdCreateDto.cs
  11. 1
    7
      Diligent.WebAPI.Contracts/DTOs/Ad/AdResponseDto.cs
  12. 1
    7
      Diligent.WebAPI.Contracts/DTOs/Ad/AdUpdateDto.cs
  13. 12
    0
      Diligent.WebAPI.Contracts/DTOs/SelectionLevel/SelectionLevelResponseWithDataDto.cs
  14. 15
    0
      Diligent.WebAPI.Contracts/DTOs/SelectionLevel/SelectionLevelResposneDto.cs
  15. 13
    0
      Diligent.WebAPI.Contracts/DTOs/SelectionProcess/SelectionProcessCreateDto.cs
  16. 15
    0
      Diligent.WebAPI.Contracts/DTOs/SelectionProcess/SelectionProcessResposneDto.cs
  17. 9
    0
      Diligent.WebAPI.Data/DatabaseContext.cs
  18. 15
    0
      Diligent.WebAPI.Data/Entities/SelectionLevel.cs
  19. 16
    0
      Diligent.WebAPI.Data/Entities/SelectionProcess.cs
  20. 3
    2
      Diligent.WebAPI.Data/Extensions/ServiceCollection.cs
  21. 872
    0
      Diligent.WebAPI.Data/Migrations/20221107163821_AddedSelectionProcess.Designer.cs
  22. 75
    0
      Diligent.WebAPI.Data/Migrations/20221107163821_AddedSelectionProcess.cs
  23. 894
    0
      Diligent.WebAPI.Data/Migrations/20221107214939_SeedDataForSelectionLevel.Designer.cs
  24. 46
    0
      Diligent.WebAPI.Data/Migrations/20221107214939_SeedDataForSelectionLevel.cs
  25. 119
    13
      Diligent.WebAPI.Data/Migrations/DatabaseContextModelSnapshot.cs
  26. 2
    2
      Diligent.WebAPI.Host/Controllers/V1/AdsController.cs
  27. 23
    0
      Diligent.WebAPI.Host/Controllers/V1/SelectionLevelsController.cs
  28. 47
    0
      Diligent.WebAPI.Host/Controllers/V1/SelectionProcessesController.cs
  29. 4
    0
      Diligent.WebAPI.Host/Extensions/BusinessConfigurationExtension.cs
  30. 1
    1
      Diligent.WebAPI.Host/appsettings.Development.json
  31. 1
    1
      Diligent.WebAPI.Host/appsettings.json

+ 1
- 2
Diligent.WebAPI.Business/MappingProfiles/AdMappingProfile.cs Visa fil

@@ -1,5 +1,4 @@

namespace Diligent.WebAPI.Business.MappingProfiles
namespace Diligent.WebAPI.Business.MappingProfiles
{
public class AdMappingProfile : Profile
{

+ 18
- 0
Diligent.WebAPI.Business/MappingProfiles/SelectionLevelMappingProfile.cs Visa fil

@@ -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
}
}
}

+ 18
- 0
Diligent.WebAPI.Business/MappingProfiles/SelectionProcessMappingProfile.cs Visa fil

@@ -0,0 +1,18 @@
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>();
#endregion
}
}
}

+ 1
- 2
Diligent.WebAPI.Business/Services/Interfaces/IAdService.cs Visa fil

@@ -1,5 +1,4 @@

namespace Diligent.WebAPI.Business.Services.Interfaces
namespace Diligent.WebAPI.Business.Services.Interfaces
{
public interface IAdService
{

+ 1
- 2
Diligent.WebAPI.Business/Services/Interfaces/IApplicantService.cs Visa fil

@@ -1,5 +1,4 @@

namespace Diligent.WebAPI.Business.Services.Interfaces
namespace Diligent.WebAPI.Business.Services.Interfaces
{
public interface IApplicantService
{

+ 12
- 0
Diligent.WebAPI.Business/Services/Interfaces/ISelectionLevelService.cs Visa fil

@@ -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<SelectionProcessResposneDto> GetByIdAsync(int id);
}
}

+ 14
- 0
Diligent.WebAPI.Business/Services/Interfaces/ISelectionProcessService.cs Visa fil

@@ -0,0 +1,14 @@

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 UpdateAsync(int id, SelectionProcessCreateDto model);
}
}

+ 31
- 0
Diligent.WebAPI.Business/Services/SelectionLevelService.cs Visa fil

@@ -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).ToListAsync());

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

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

return _mapper.Map<SelectionProcessResposneDto>(sl);

}
}
}

+ 61
- 0
Diligent.WebAPI.Business/Services/SelectionProcessService.cs Visa fil

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

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("Ad not found");

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

+ 1
- 7
Diligent.WebAPI.Contracts/DTOs/Ad/AdCreateDto.cs Visa fil

@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Diligent.WebAPI.Contracts.DTOs.Ad
namespace Diligent.WebAPI.Contracts.DTOs.Ad
{
public class AdCreateDto
{

+ 1
- 7
Diligent.WebAPI.Contracts/DTOs/Ad/AdResponseDto.cs Visa fil

@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Diligent.WebAPI.Contracts.DTOs.Ad
namespace Diligent.WebAPI.Contracts.DTOs.Ad
{
public class AdResponseDto
{

+ 1
- 7
Diligent.WebAPI.Contracts/DTOs/Ad/AdUpdateDto.cs Visa fil

@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Diligent.WebAPI.Contracts.DTOs.Ad
namespace Diligent.WebAPI.Contracts.DTOs.Ad
{
public class AdUpdateDto
{

+ 12
- 0
Diligent.WebAPI.Contracts/DTOs/SelectionLevel/SelectionLevelResponseWithDataDto.cs Visa fil

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

namespace Diligent.WebAPI.Contracts.DTOs.SelectionLevel
{
public class SelectionLevelResponseWithDataDto
{
public int LevelId { get; set; }

public string Name { get; set; }
public SelectionProcessResposneDto SelectionProcesses { get; set; }
}
}

+ 15
- 0
Diligent.WebAPI.Contracts/DTOs/SelectionLevel/SelectionLevelResposneDto.cs Visa fil

@@ -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 LevelId { get; set; }

public string Name { get; set; }
}
}

+ 13
- 0
Diligent.WebAPI.Contracts/DTOs/SelectionProcess/SelectionProcessCreateDto.cs Visa fil

@@ -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 Visa fil

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

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; }
}
}

+ 9
- 0
Diligent.WebAPI.Data/DatabaseContext.cs Visa fil

@@ -14,12 +14,21 @@ public class DatabaseContext : IdentityDbContext<User, AppRole, int>
public DbSet<Applicant> Applicants { get; set; }
public DbSet<Technology> Technologies { get; set; }
public DbSet<ApplicantTechnology> ApplicantTechnologies { 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());
}

+ 15
- 0
Diligent.WebAPI.Data/Entities/SelectionLevel.cs Visa fil

@@ -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; }
}
}

+ 16
- 0
Diligent.WebAPI.Data/Entities/SelectionProcess.cs Visa fil

@@ -0,0 +1,16 @@
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; }
}
}

+ 3
- 2
Diligent.WebAPI.Data/Extensions/ServiceCollection.cs Visa fil

@@ -6,11 +6,12 @@ public static class ServiceCollection
{
services.AddDbContext<DatabaseContext>(options =>
{
if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Development")
if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") != "Development")
{
options.EnableSensitiveDataLogging();
}
var secret = Environment.GetEnvironmentVariable("SECRET");
//var secret = Environment.GetEnvironmentVariable("SECRET");
var secret = "";
var connectionString = configuration.GetConnectionString(nameof(Diligent.WebAPI));
options.UseSqlServer(String.Concat(connectionString,secret));
});

+ 872
- 0
Diligent.WebAPI.Data/Migrations/20221107163821_AddedSelectionProcess.Designer.cs Visa fil

@@ -0,0 +1,872 @@
// <auto-generated />
using System;
using Diligent.WebAPI.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

#nullable disable

namespace Diligent.WebAPI.Data.Migrations
{
[DbContext(typeof(DatabaseContext))]
[Migration("20221107163821_AddedSelectionProcess")]
partial class AddedSelectionProcess
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.10")
.HasAnnotation("Relational:MaxIdentifierLength", 128);

SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);

modelBuilder.Entity("AdTechnology", b =>
{
b.Property<int>("AdsId")
.HasColumnType("int");

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

b.HasKey("AdsId", "TechnologiesTechnologyId");

b.HasIndex("TechnologiesTechnologyId");

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

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

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

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

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

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

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

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

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

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

b.HasKey("Id");

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

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

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

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

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

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

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

b.Property<string>("Email")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");

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

b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");

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

b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");

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

b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");

b.Property<string>("Position")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");

b.HasKey("ApplicantId");

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

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

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

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

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

b.HasKey("Id");

b.HasIndex("ApplicantId");

b.HasIndex("TechnologyId");

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

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

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

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

b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

b.HasKey("Id");

b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");

b.ToTable("AspNetRoles", (string)null);
});

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

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

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

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

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

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

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

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

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

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

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

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

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

b.HasKey("Id");

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

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

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

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

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

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

b.Property<long>("InsurerId")
.HasColumnType("bigint");

b.Property<decimal>("Premium")
.HasColumnType("decimal(18,2)");

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

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

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

b.HasKey("Id");

b.HasIndex("InsurerId");

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

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

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

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

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

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

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

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

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

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

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

b.Property<long>("InsuranceCompanyId")
.HasColumnType("bigint");

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

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

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

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

b.HasKey("Id");

b.HasIndex("InsuranceCompanyId");

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

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

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

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

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

b.Property<bool>("Invalidated")
.HasColumnType("bit");

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

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

b.Property<bool>("Used")
.HasColumnType("bit");

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

b.HasKey("Id");

b.HasIndex("UserId");

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");
});

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("SchedulerId");

b.HasIndex("SelectionLevelId");

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

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

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

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

b.HasKey("TechnologyId");

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

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

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

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

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

b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");

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

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

b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");

b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");

b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

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

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

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

b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");

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

b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");

b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

b.HasKey("Id");

b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");

b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");

b.ToTable("AspNetUsers", (string)null);
});

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

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

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

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

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

b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");

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

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

b.HasKey("Id");

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

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

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

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

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

b.Property<bool>("IsActive")
.HasColumnType("bit");

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

b.Property<long>("WebhookDefinitionId")
.HasColumnType("bigint");

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

b.HasKey("Id");

b.HasIndex("WebhookDefinitionId");

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

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");

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

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

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

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

b.HasKey("Id");

b.HasIndex("RoleId");

b.ToTable("AspNetRoleClaims", (string)null);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");

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

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

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

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

b.HasKey("Id");

b.HasIndex("UserId");

b.ToTable("AspNetUserClaims", (string)null);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");

b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(450)");

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

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

b.HasKey("LoginProvider", "ProviderKey");

b.HasIndex("UserId");

b.ToTable("AspNetUserLogins", (string)null);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");

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

b.HasKey("UserId", "RoleId");

b.HasIndex("RoleId");

b.ToTable("AspNetUserRoles", (string)null);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");

b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");

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

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

b.HasKey("UserId", "LoginProvider", "Name");

b.ToTable("AspNetUserTokens", (string)null);
});

modelBuilder.Entity("AdTechnology", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.Ad", null)
.WithMany()
.HasForeignKey("AdsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

b.HasOne("Diligent.WebAPI.Data.Entities.Technology", null)
.WithMany()
.HasForeignKey("TechnologiesTechnologyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

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

b.HasOne("Diligent.WebAPI.Data.Entities.Technology", "Tecnology")
.WithMany("ApplicantTechnologies")
.HasForeignKey("TechnologyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

b.Navigation("Applicant");

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

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.InsurancePolicy", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.Insurer", "Insurer")
.WithMany()
.HasForeignKey("InsurerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

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

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Insurer", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.InsuranceCompany", "InsuranceCompany")
.WithMany()
.HasForeignKey("InsuranceCompanyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

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

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.RefreshToken", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

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

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.SelectionProcess", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.User", "Scheduler")
.WithMany()
.HasForeignKey("SchedulerId");

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

b.Navigation("Scheduler");

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

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.WebhookSubscription", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.WebhookDefinition", "WebhookDefinition")
.WithMany()
.HasForeignKey("WebhookDefinitionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

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

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.AppRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.AppRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

b.HasOne("Diligent.WebAPI.Data.Entities.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

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

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Technology", b =>
{
b.Navigation("ApplicantTechnologies");
});
#pragma warning restore 612, 618
}
}
}

+ 75
- 0
Diligent.WebAPI.Data/Migrations/20221107163821_AddedSelectionProcess.cs Visa fil

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

#nullable disable

namespace Diligent.WebAPI.Data.Migrations
{
public partial class AddedSelectionProcess : 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_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.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");
}
}
}

+ 894
- 0
Diligent.WebAPI.Data/Migrations/20221107214939_SeedDataForSelectionLevel.Designer.cs Visa fil

@@ -0,0 +1,894 @@
// <auto-generated />
using System;
using Diligent.WebAPI.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

#nullable disable

namespace Diligent.WebAPI.Data.Migrations
{
[DbContext(typeof(DatabaseContext))]
[Migration("20221107214939_SeedDataForSelectionLevel")]
partial class SeedDataForSelectionLevel
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.10")
.HasAnnotation("Relational:MaxIdentifierLength", 128);

SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);

modelBuilder.Entity("AdTechnology", b =>
{
b.Property<int>("AdsId")
.HasColumnType("int");

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

b.HasKey("AdsId", "TechnologiesTechnologyId");

b.HasIndex("TechnologiesTechnologyId");

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

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

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

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

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

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

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

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

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

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

b.HasKey("Id");

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

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

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

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

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

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

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

b.Property<string>("Email")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");

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

b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");

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

b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");

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

b.Property<string>("PhoneNumber")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");

b.Property<string>("Position")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");

b.HasKey("ApplicantId");

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

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

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

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

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

b.HasKey("Id");

b.HasIndex("ApplicantId");

b.HasIndex("TechnologyId");

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

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

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

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

b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

b.HasKey("Id");

b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");

b.ToTable("AspNetRoles", (string)null);
});

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

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

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

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

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

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

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

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

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

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

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

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

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

b.HasKey("Id");

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

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

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

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

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

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

b.Property<long>("InsurerId")
.HasColumnType("bigint");

b.Property<decimal>("Premium")
.HasColumnType("decimal(18,2)");

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

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

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

b.HasKey("Id");

b.HasIndex("InsurerId");

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

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

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

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

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

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

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

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

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

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

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

b.Property<long>("InsuranceCompanyId")
.HasColumnType("bigint");

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

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

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

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

b.HasKey("Id");

b.HasIndex("InsuranceCompanyId");

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

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

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

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

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

b.Property<bool>("Invalidated")
.HasColumnType("bit");

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

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

b.Property<bool>("Used")
.HasColumnType("bit");

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

b.HasKey("Id");

b.HasIndex("UserId");

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("SchedulerId");

b.HasIndex("SelectionLevelId");

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

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

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

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

b.HasKey("TechnologyId");

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

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

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

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

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

b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");

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

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

b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");

b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");

b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

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

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

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

b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");

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

b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");

b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");

b.HasKey("Id");

b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");

b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");

b.ToTable("AspNetUsers", (string)null);
});

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

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

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

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

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

b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");

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

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

b.HasKey("Id");

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

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

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

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

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

b.Property<bool>("IsActive")
.HasColumnType("bit");

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

b.Property<long>("WebhookDefinitionId")
.HasColumnType("bigint");

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

b.HasKey("Id");

b.HasIndex("WebhookDefinitionId");

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

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");

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

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

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

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

b.HasKey("Id");

b.HasIndex("RoleId");

b.ToTable("AspNetRoleClaims", (string)null);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");

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

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

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

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

b.HasKey("Id");

b.HasIndex("UserId");

b.ToTable("AspNetUserClaims", (string)null);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");

b.Property<string>("ProviderKey")
.HasColumnType("nvarchar(450)");

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

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

b.HasKey("LoginProvider", "ProviderKey");

b.HasIndex("UserId");

b.ToTable("AspNetUserLogins", (string)null);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");

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

b.HasKey("UserId", "RoleId");

b.HasIndex("RoleId");

b.ToTable("AspNetUserRoles", (string)null);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");

b.Property<string>("LoginProvider")
.HasColumnType("nvarchar(450)");

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

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

b.HasKey("UserId", "LoginProvider", "Name");

b.ToTable("AspNetUserTokens", (string)null);
});

modelBuilder.Entity("AdTechnology", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.Ad", null)
.WithMany()
.HasForeignKey("AdsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

b.HasOne("Diligent.WebAPI.Data.Entities.Technology", null)
.WithMany()
.HasForeignKey("TechnologiesTechnologyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

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

b.HasOne("Diligent.WebAPI.Data.Entities.Technology", "Tecnology")
.WithMany("ApplicantTechnologies")
.HasForeignKey("TechnologyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

b.Navigation("Applicant");

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

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.InsurancePolicy", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.Insurer", "Insurer")
.WithMany()
.HasForeignKey("InsurerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

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

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Insurer", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.InsuranceCompany", "InsuranceCompany")
.WithMany()
.HasForeignKey("InsuranceCompanyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

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

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.RefreshToken", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

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

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.SelectionProcess", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.User", "Scheduler")
.WithMany()
.HasForeignKey("SchedulerId");

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

b.Navigation("Scheduler");

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

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.WebhookSubscription", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.WebhookDefinition", "WebhookDefinition")
.WithMany()
.HasForeignKey("WebhookDefinitionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

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

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.AppRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.AppRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

b.HasOne("Diligent.WebAPI.Data.Entities.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.User", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

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

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Technology", b =>
{
b.Navigation("ApplicantTechnologies");
});
#pragma warning restore 612, 618
}
}
}

+ 46
- 0
Diligent.WebAPI.Data/Migrations/20221107214939_SeedDataForSelectionLevel.cs Visa fil

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

#nullable disable

namespace Diligent.WebAPI.Data.Migrations
{
public partial class SeedDataForSelectionLevel : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "SelectionLevels",
columns: new[] { "Id", "Name" },
values: new object[,]
{
{ 1, "HR intervju" },
{ 2, "Screening test" },
{ 3, "Tehnicki intervju" },
{ 4, "Konacna odluka" }
});
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "SelectionLevels",
keyColumn: "Id",
keyValue: 1);

migrationBuilder.DeleteData(
table: "SelectionLevels",
keyColumn: "Id",
keyValue: 2);

migrationBuilder.DeleteData(
table: "SelectionLevels",
keyColumn: "Id",
keyValue: 3);

migrationBuilder.DeleteData(
table: "SelectionLevels",
keyColumn: "Id",
keyValue: 4);
}
}
}

+ 119
- 13
Diligent.WebAPI.Data/Migrations/DatabaseContextModelSnapshot.cs Visa fil

@@ -34,7 +34,7 @@ namespace Diligent.WebAPI.Data.Migrations

b.HasIndex("TechnologiesTechnologyId");

b.ToTable("AdTechnology");
b.ToTable("AdTechnology", (string)null);
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Ad", b =>
@@ -72,7 +72,7 @@ namespace Diligent.WebAPI.Data.Migrations

b.HasKey("Id");

b.ToTable("Ads");
b.ToTable("Ads", (string)null);
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Applicant", b =>
@@ -132,7 +132,7 @@ namespace Diligent.WebAPI.Data.Migrations

b.HasKey("ApplicantId");

b.ToTable("Applicants");
b.ToTable("Applicants", (string)null);
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.ApplicantTechnology", b =>
@@ -155,7 +155,7 @@ namespace Diligent.WebAPI.Data.Migrations

b.HasIndex("TechnologyId");

b.ToTable("ApplicantTechnologies");
b.ToTable("ApplicantTechnologies", (string)null);
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.AppRole", b =>
@@ -239,7 +239,7 @@ namespace Diligent.WebAPI.Data.Migrations

b.HasKey("Id");

b.ToTable("InsuranceCompanies");
b.ToTable("InsuranceCompanies", (string)null);
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.InsurancePolicy", b =>
@@ -279,7 +279,7 @@ namespace Diligent.WebAPI.Data.Migrations

b.HasIndex("InsurerId");

b.ToTable("InsurancePolicies");
b.ToTable("InsurancePolicies", (string)null);
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Insurer", b =>
@@ -341,7 +341,7 @@ namespace Diligent.WebAPI.Data.Migrations

b.HasIndex("InsuranceCompanyId");

b.ToTable("Insurers");
b.ToTable("Insurers", (string)null);
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.RefreshToken", b =>
@@ -379,7 +379,86 @@ namespace Diligent.WebAPI.Data.Migrations

b.HasIndex("UserId");

b.ToTable("RefreshTokens");
b.ToTable("RefreshTokens", (string)null);
});

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", (string)null);

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("SchedulerId");

b.HasIndex("SelectionLevelId");

b.ToTable("SelectionProcesses", (string)null);
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Technology", b =>
@@ -397,7 +476,7 @@ namespace Diligent.WebAPI.Data.Migrations

b.HasKey("TechnologyId");

b.ToTable("Technologies");
b.ToTable("Technologies", (string)null);
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.User", b =>
@@ -512,7 +591,7 @@ namespace Diligent.WebAPI.Data.Migrations

b.HasKey("Id");

b.ToTable("WebhookDefinitions");
b.ToTable("WebhookDefinitions", (string)null);
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.WebhookSubscription", b =>
@@ -546,7 +625,7 @@ namespace Diligent.WebAPI.Data.Migrations

b.HasIndex("WebhookDefinitionId");

b.ToTable("WebhookSubscriptions");
b.ToTable("WebhookSubscriptions", (string)null);
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
@@ -670,13 +749,13 @@ namespace Diligent.WebAPI.Data.Migrations
modelBuilder.Entity("Diligent.WebAPI.Data.Entities.ApplicantTechnology", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.Applicant", "Applicant")
.WithMany()
.WithMany("ApplicantTechnologies")
.HasForeignKey("ApplicantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();

b.HasOne("Diligent.WebAPI.Data.Entities.Technology", "Tecnology")
.WithMany()
.WithMany("ApplicantTechnologies")
.HasForeignKey("TechnologyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@@ -719,6 +798,23 @@ namespace Diligent.WebAPI.Data.Migrations
b.Navigation("User");
});

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.SelectionProcess", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.User", "Scheduler")
.WithMany()
.HasForeignKey("SchedulerId");

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

b.Navigation("Scheduler");

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

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.WebhookSubscription", b =>
{
b.HasOne("Diligent.WebAPI.Data.Entities.WebhookDefinition", "WebhookDefinition")
@@ -780,6 +876,16 @@ namespace Diligent.WebAPI.Data.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});

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

modelBuilder.Entity("Diligent.WebAPI.Data.Entities.Technology", b =>
{
b.Navigation("ApplicantTechnologies");
});
#pragma warning restore 612, 618
}
}

+ 2
- 2
Diligent.WebAPI.Host/Controllers/V1/AdsController.cs Visa fil

@@ -1,6 +1,6 @@

namespace Diligent.WebAPI.Host.Controllers.V1
namespace Diligent.WebAPI.Host.Controllers.V1
{

[ApiVersion("1.0")]
[Route("v{version:apiVersion}/ads")]
[ApiController]

+ 23
- 0
Diligent.WebAPI.Host/Controllers/V1/SelectionLevelsController.cs Visa fil

@@ -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 Visa fil

@@ -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> GetById([FromRoute] int id) =>
Ok(await _selectionProcessesService.GetByIdAsync(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 Visa fil

@@ -12,11 +12,15 @@
services.AddAutoMapper(typeof(WebhookMappingProfile));
services.AddAutoMapper(typeof(InsurerMappingProfile));
services.AddAutoMapper(typeof(ApplicantMappingProfile));
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<ISelectionProcessService, SelectionProcessService>();
services.AddScoped<ISelectionLevelService, SelectionLevelService>();
services.AddScoped<IInsurancePoliciesService, InsurancePoliciesService>();
services.AddScoped<IWebhookSubscriptionService, WebhookSubscriptionService>();
services.AddScoped<IWebhookDefinitionService, WebhookDefinitionService>();

+ 1
- 1
Diligent.WebAPI.Host/appsettings.Development.json Visa fil

@@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"WebApi": "Server=192.168.88.105;Database=HRCenter;User Id=hrcentar;Password="
"WebApi": "Data Source=localhost,2433;User=sa;Password=developer_pw;Initial Catalog=WebApiDB;MultipleActiveResultSets=True"
},
"Authorization": {
"JwtExpiredTime": "5",

+ 1
- 1
Diligent.WebAPI.Host/appsettings.json Visa fil

@@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"WebApi": "Server=192.168.88.105;Database=HRCenter;User Id=hrcentar;Password="
"WebApi": "Data Source=localhost,2433;User=sa;Password=developer_pw;Initial Catalog=WebApiDB;MultipleActiveResultSets=True"
},
"Authorization": {
"JwtExpiredTime": "5",

Laddar…
Avbryt
Spara