| @@ -6,6 +6,7 @@ using System.Threading.Tasks; | |||
| namespace Diligent.WebAPI.Business.Extensions | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public static class AdExtensions | |||
| { | |||
| public static List<Ad> Filter(this List<Ad> query, AdFilterDto filters) => | |||
| @@ -2,6 +2,7 @@ | |||
| namespace Diligent.WebAPI.Business.Extensions | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public static class ApplicantExtensions | |||
| { | |||
| public static List<Applicant> FilterApplicants(this List<Applicant> query,ApplicantFilterDto applicantFilterDto) | |||
| @@ -6,6 +6,7 @@ using System.Threading.Tasks; | |||
| namespace Diligent.WebAPI.Business.Extensions | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public static class PaginationExtension | |||
| { | |||
| public static List<T> ApplyPagging<T>(this List<T> query, Pagination pagination) | |||
| @@ -7,6 +7,7 @@ using System.Threading.Tasks; | |||
| namespace Diligent.WebAPI.Business.Extensions | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public static class PatternExtension | |||
| { | |||
| public static List<Pattern> FilterApplicants(this List<Pattern> query, FilterPatternDto filterPatternDto) | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Business.Extensions | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public static class SelectionProcessExtensions | |||
| { | |||
| public static List<SelectionLevel> FilterLevels(this List<SelectionLevel> query, SelectionProcessFilterDto filter) | |||
| @@ -3,6 +3,7 @@ namespace Diligent.WebAPI.Business.MappingProfiles | |||
| { | |||
| public class AdMappingProfile : Profile | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public AdMappingProfile() | |||
| { | |||
| #region DTO to Model | |||
| @@ -2,6 +2,7 @@ | |||
| namespace Diligent.WebAPI.Business.MappingProfiles | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class ApplicantMappingProfile:Profile | |||
| { | |||
| public ApplicantMappingProfile() | |||
| @@ -4,6 +4,7 @@ namespace Diligent.WebAPI.Business.MappingProfiles | |||
| { | |||
| public class CommentMappingProfile:Profile | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public CommentMappingProfile() | |||
| { | |||
| #region Models to DTO | |||
| @@ -2,6 +2,7 @@ | |||
| { | |||
| public class CompanyMappingProfile : Profile | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public CompanyMappingProfile() | |||
| { | |||
| @@ -2,6 +2,7 @@ | |||
| { | |||
| public class InsurerMappingProfile : Profile | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public InsurerMappingProfile() | |||
| { | |||
| #region DTO to Model | |||
| @@ -7,6 +7,7 @@ using System.Threading.Tasks; | |||
| namespace Diligent.WebAPI.Business.MappingProfiles | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class PatternMappingProfile : Profile | |||
| { | |||
| public PatternMappingProfile() | |||
| @@ -2,6 +2,7 @@ | |||
| { | |||
| public class PolicyMappingProfiles : Profile | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public PolicyMappingProfiles() | |||
| { | |||
| CreateMap<InsurancePolicy, InsurancePolicyViewDto>(); | |||
| @@ -3,6 +3,7 @@ using Diligent.WebAPI.Contracts.DTOs.SelectionLevel; | |||
| namespace Diligent.WebAPI.Business.MappingProfiles | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class SelectionLevelMappingProfile : Profile | |||
| { | |||
| public SelectionLevelMappingProfile() | |||
| @@ -5,6 +5,7 @@ namespace Diligent.WebAPI.Business.MappingProfiles | |||
| { | |||
| public class SelectionProcessMappingProfile : Profile | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public SelectionProcessMappingProfile() | |||
| { | |||
| #region DTO to Model | |||
| @@ -3,6 +3,7 @@ namespace Diligent.WebAPI.Business.MappingProfiles | |||
| { | |||
| public class TechnologyMappingProfile : Profile | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public TechnologyMappingProfile() | |||
| { | |||
| #region Model to DTO | |||
| @@ -7,6 +7,7 @@ using System.Threading.Tasks; | |||
| namespace Diligent.WebAPI.Business.MappingProfiles | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class UserMappingProfile : Profile | |||
| { | |||
| public UserMappingProfile() | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Business.MappingProfiles | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class WebhookMappingProfile : Profile | |||
| { | |||
| public WebhookMappingProfile() | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Business.Services | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class InsuranceCompaniesService : IInsuranceCompaniesService | |||
| { | |||
| private readonly DatabaseContext _context; | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Business.Services | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class InsurancePoliciesService : IInsurancePoliciesService | |||
| { | |||
| private readonly DatabaseContext _context; | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Business.Services | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class InsurersService : IInsurersService | |||
| { | |||
| private readonly DatabaseContext _context; | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Business.Services | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class WebhookDefinitionService : IWebhookDefinitionService | |||
| { | |||
| private readonly DatabaseContext _context; | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Business.Services | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class WebhookPublisherService : IWebhookPublisherService | |||
| { | |||
| private readonly IWebhookSubscriptionService _subscriptionService; | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Business.Services | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class WebhookSubscriptionService : IWebhookSubscriptionService | |||
| { | |||
| private readonly DatabaseContext _context; | |||
| @@ -2,6 +2,7 @@ | |||
| namespace Diligent.WebAPI.Business.Settings | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class AuthorizationSettings | |||
| { | |||
| public string Secret { get; set; } | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Business.Settings | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class FrontEndSettings | |||
| { | |||
| public string BaseUrl { get; set; } | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Business.Settings | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class MailSettings | |||
| { | |||
| public string SmtpFrom { get; set; } | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Business.Settings | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class ScreeningTestSettings | |||
| { | |||
| public string Url { get; set; } | |||
| @@ -37,4 +37,5 @@ global using AutoMapper; | |||
| global using System.Web; | |||
| global using Microsoft.AspNetCore.Identity; | |||
| global using Microsoft.Extensions.Logging; | |||
| global using Microsoft.Extensions.Logging; | |||
| global using System.Diagnostics.CodeAnalysis; | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| [ApiVersion("1.0")] | |||
| [ApiController] | |||
| [Route("v{version:apiVersion}/insurance-companies")] | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| [ApiVersion("1.0")] | |||
| [ApiController] | |||
| [Route("v{version:apiVersion}/insurance-policies")] | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| [ApiVersion("1.0")] | |||
| [ApiController] | |||
| [Route("v{version:apiVersion}/insurers")] | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| [ApiVersion("1.0")] | |||
| [ApiController] | |||
| [Route("v{version:apiVersion}/webhooks")] | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Controllers.V2 | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| [ApiVersion("2.0")] | |||
| [ApiController] | |||
| [Route("v{version:apiVersion}/insurance-companies")] | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Controllers.V2 | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| [ApiVersion("2.0")] | |||
| [ApiController] | |||
| [Route("v{version:apiVersion}/insurance-policies")] | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Controllers.V2 | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| [ApiVersion("2.0")] | |||
| [ApiController] | |||
| [Route("v{version:apiVersion}/insurers")] | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Controllers.V2 | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| [ApiVersion("2.0")] | |||
| [Route("v{version:apiVersion}/[controller]")] | |||
| [ApiController] | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Controllers.V2 | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| [ApiVersion("2.0")] | |||
| [ApiController] | |||
| [Route("v{version:apiVersion}/webhooks")] | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Extensions | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public static class AuthConfigurationExtension | |||
| { | |||
| public static void ConfigureAuth(this WebApplicationBuilder builder) | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Extensions | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public static class BusinessConfigurationExtension | |||
| { | |||
| /// <summary> | |||
| @@ -1,26 +0,0 @@ | |||
| using Microsoft.Extensions.Caching.Memory; | |||
| namespace Diligent.WebAPI.Host.Extensions | |||
| { | |||
| public class CacheModelExtension | |||
| { | |||
| private static readonly IMemoryCache _memoryCache = new MemoryCache(new MemoryCacheOptions()); | |||
| public static void AddCache(string cacheKey, string value, DateTime expiritaion) | |||
| { | |||
| var cacheExipiryOptions = new MemoryCacheEntryOptions | |||
| { | |||
| AbsoluteExpiration = expiritaion, | |||
| Priority = CacheItemPriority.High, | |||
| SlidingExpiration = TimeSpan.FromSeconds(20) | |||
| }; | |||
| _memoryCache.Set(cacheKey, value, cacheExipiryOptions); | |||
| } | |||
| public static string GetCache(string cacheKey) | |||
| { | |||
| if (_memoryCache.TryGetValue<string>(cacheKey, out var result)) | |||
| return result; ; | |||
| return ""; | |||
| } | |||
| } | |||
| } | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Extensions | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public static class CorrelationIdExtension | |||
| { | |||
| public static IApplicationBuilder UseCorrelationId(this IApplicationBuilder app) | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Extensions | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public static class CorsConfigurationExtension | |||
| { | |||
| public static void ConfigureCors(this WebApplicationBuilder builder) | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Extensions; | |||
| [ExcludeFromCodeCoverage] | |||
| public static class DataConfigurationExtension | |||
| { | |||
| /// <summary> | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Extensions | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public static class HostConfigurationExtension | |||
| { | |||
| /// <summary> | |||
| @@ -1,6 +1,7 @@ | |||
| | |||
| namespace Diligent.WebAPI.Host.Extensions | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public static class IdentityConfigurationExtension | |||
| { | |||
| public static void ConfigureIdentity(this WebApplicationBuilder builder) | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Extensions | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public static class MailServerConfigurationExtension | |||
| { | |||
| public static void ConfigureMailServer(this WebApplicationBuilder builder) | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Extensions | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public static class ModelValidationMIddlewareExtension | |||
| { | |||
| public static void ConfigureValidationMiddleware(this WebApplicationBuilder builder) | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Extensions | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public static class SwaggerConfigurationExtension | |||
| { | |||
| public static void ConfigureSwagger(this WebApplicationBuilder builder) | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Extensions; | |||
| [ExcludeFromCodeCoverage] | |||
| public static class WebAppExtension | |||
| { | |||
| public static void SetupData(this WebApplication app) | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Middlewares | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class CorrelationMiddleware | |||
| { | |||
| private const string DefaultHeader = "X-Correlation-ID"; | |||
| @@ -10,6 +10,7 @@ using System.Runtime.Serialization; | |||
| namespace Diligent.WebAPI.Host.Middlewares | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class DiligBadRequestException : Exception | |||
| { | |||
| public const string ExceptionMessage = "Bad request from custom middleware"; | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Middlewares | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class JwtMiddleware | |||
| { | |||
| private readonly RequestDelegate _next; | |||
| @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc.Filters; | |||
| namespace Diligent.WebAPI.Host.Middlewares | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class ModelValidationMiddleware : IActionFilter | |||
| { | |||
| public void OnActionExecuted(ActionExecutedContext context) { } | |||
| @@ -1,5 +1,6 @@ | |||
| namespace Diligent.WebAPI.Host.Options | |||
| { | |||
| [ExcludeFromCodeCoverage] | |||
| public class SwaggerConfigureOptions : IConfigureOptions<SwaggerGenOptions> | |||
| { | |||
| private readonly IApiVersionDescriptionProvider _provider; | |||
| @@ -37,3 +37,4 @@ global using System.IdentityModel.Tokens.Jwt; | |||
| global using AutoMapper; | |||
| global using Swashbuckle.AspNetCore.SwaggerGen; | |||
| global using Microsoft.AspNetCore.Identity; | |||
| global using System.Diagnostics.CodeAnalysis; | |||
| @@ -1,6 +1,6 @@ | |||
| { | |||
| "Serilog": { | |||
| "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File", "Serilog.Sinks.Seq" ], | |||
| "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File", "Serilog.Sinks.Seq", "Serilog.Sinks.Elmahio" ], | |||
| "MinimumLevel": { | |||
| "Default": "Information", | |||
| "Override": { | |||
| @@ -49,5 +49,11 @@ | |||
| "BlobContainerName": "hrcenter", | |||
| "FrontEnd": { | |||
| "BaseUrl": "https://test-hr-center.dilig.net" | |||
| }, | |||
| "ScreeningTest": { | |||
| "Url": "https://localhost:44349/api/v1/", | |||
| "Email": "hrcenter@dilig.net", | |||
| "Password": "MYRandomPass135!", | |||
| "link": "https://localhost:44336/Intern/ToS?id={0}" | |||
| } | |||
| } | |||