| @@ -157,7 +157,7 @@ | |||
| } | |||
| _logger.LogInformation($"Change ad expired time"); | |||
| ad.ExpiredAt = DateTime.UtcNow; | |||
| ad.ExpiredAt = DateTime.Now; | |||
| _logger.LogInformation($"Ad expired time changed successfully"); | |||
| _context.Entry(ad).State = EntityState.Modified; | |||
| @@ -163,7 +163,7 @@ namespace Diligent.WebAPI.Business.Services | |||
| FirstName = request.FirstName, | |||
| LastName = request.LastName, | |||
| Position = ad.Title, | |||
| DateOfApplication = DateTime.UtcNow, | |||
| DateOfApplication = DateTime.Now, | |||
| CV = fileName, | |||
| Email = request.Email, | |||
| PhoneNumber = request.PhoneNumber, | |||
| @@ -158,7 +158,7 @@ namespace Diligent.WebAPI.Business.Services | |||
| new Claim(JwtRegisteredClaimNames.Jti, user.Id.ToString()), | |||
| new Claim("id", user.Id.ToString()) | |||
| }), | |||
| Expires = DateTime.UtcNow.AddMinutes(_authSettings.JwtExpiredTime), | |||
| Expires = DateTime.Now.AddMinutes(_authSettings.JwtExpiredTime), | |||
| SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature) | |||
| }; | |||
| var token = tokenHandler.CreateToken(tokenDescriptor); | |||
| @@ -171,8 +171,8 @@ namespace Diligent.WebAPI.Business.Services | |||
| JwtId = user.Id.ToString(), | |||
| UserId = user.Id, | |||
| User = user, | |||
| CreationDate = DateTime.UtcNow, | |||
| ExpiryDate = DateTime.UtcNow.AddMinutes(_authSettings.JwtRefreshExpiredTime) | |||
| CreationDate = DateTime.Now, | |||
| ExpiryDate = DateTime.Now.AddMinutes(_authSettings.JwtRefreshExpiredTime) | |||
| }; | |||
| var existRefreshToken = await _databaseContext.RefreshTokens.Where(x => x.UserId == user.Id).FirstOrDefaultAsync(); | |||
| @@ -181,8 +181,8 @@ namespace Diligent.WebAPI.Business.Services | |||
| { | |||
| existRefreshToken.Token = writedToken; | |||
| existRefreshToken.JwtId = token.Id; | |||
| existRefreshToken.CreationDate = DateTime.UtcNow; | |||
| existRefreshToken.ExpiryDate = DateTime.UtcNow.AddMinutes(_authSettings.JwtRefreshExpiredTime); | |||
| existRefreshToken.CreationDate = DateTime.Now; | |||
| existRefreshToken.ExpiryDate = DateTime.Now.AddMinutes(_authSettings.JwtRefreshExpiredTime); | |||
| if (authenticate) | |||
| { | |||
| @@ -233,7 +233,7 @@ namespace Diligent.WebAPI.Business.Services | |||
| var expiryDateTimeUtc = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc) | |||
| .AddMinutes(expiryDateUnix); | |||
| if (expiryDateTimeUtc < DateTime.UtcNow) | |||
| if (expiryDateTimeUtc < DateTime.Now) | |||
| { | |||
| return new RefreshTokenResultDto | |||
| { | |||
| @@ -249,7 +249,7 @@ namespace Diligent.WebAPI.Business.Services | |||
| }; | |||
| } | |||
| if (DateTime.UtcNow > storedRefreshToken.ExpiryDate) | |||
| if (DateTime.Now > storedRefreshToken.ExpiryDate) | |||
| { | |||
| return new RefreshTokenResultDto { Error = "This refresh token has expired" }; | |||
| } | |||
| @@ -264,7 +264,7 @@ namespace Diligent.WebAPI.Business.Services | |||
| return new RefreshTokenResultDto { Error = "This refresh token does not match this JWT" }; | |||
| } | |||
| storedRefreshToken.ExpiryDate = DateTime.UtcNow.AddMinutes(_authSettings.JwtRefreshExpiredTime); | |||
| storedRefreshToken.ExpiryDate = DateTime.Now.AddMinutes(_authSettings.JwtRefreshExpiredTime); | |||
| await _databaseContext.SaveChangesAsync(); | |||
| @@ -40,7 +40,7 @@ namespace Diligent.WebAPI.Business.Services | |||
| if (emailResult) | |||
| { | |||
| email.SentTime = DateTime.UtcNow; | |||
| email.SentTime = DateTime.Now; | |||
| } | |||
| //_logger.LogInformation("Save email in db"); | |||
| @@ -77,7 +77,7 @@ namespace Diligent.WebAPI.Business.Services | |||
| if (emailResult) | |||
| { | |||
| email.SentTime = DateTime.UtcNow; | |||
| email.SentTime = DateTime.Now; | |||
| } | |||
| //var dbResult = WriteEmailToDb(email); | |||
| @@ -289,7 +289,7 @@ namespace Diligent.WebAPI.Business.Services | |||
| Body = body, | |||
| IsHtml = isHtml, | |||
| DontSendBefore = dontSendBefore, | |||
| CreateTime = DateTime.UtcNow | |||
| CreateTime = DateTime.Now | |||
| }; | |||
| @@ -30,7 +30,7 @@ | |||
| public async Task CreateInsuranceCompany(InsuranceCompanyCreateDto insuranceCompanyCreateDto) | |||
| { | |||
| var insuranceCompany = _mapper.Map<InsuranceCompany>(insuranceCompanyCreateDto); | |||
| insuranceCompany.CreatedAtUtc = DateTime.UtcNow; | |||
| insuranceCompany.CreatedAtUtc = DateTime.Now; | |||
| await _context.InsuranceCompanies.AddAsync(insuranceCompany); | |||
| await _context.SaveChangesAsync(); | |||
| } | |||
| @@ -42,7 +42,7 @@ | |||
| throw new EntityNotFoundException($"Insurance company not found"); | |||
| _mapper.Map(insuranceCompanyUpdateDto, insuranceCompany); | |||
| insuranceCompany.UpdatedAtUtc = DateTime.UtcNow; | |||
| insuranceCompany.UpdatedAtUtc = DateTime.Now; | |||
| _context.Entry(insuranceCompany).State = EntityState.Modified; | |||
| await _context.SaveChangesAsync(); | |||
| @@ -54,7 +54,7 @@ | |||
| throw new EntityNotFoundException("Insurance policy not found"); | |||
| _mapper.Map(insurancePolicyUpdateDto, insurancePolicy); | |||
| insurancePolicy.UpdatedAtUtc = DateTime.UtcNow; | |||
| insurancePolicy.UpdatedAtUtc = DateTime.Now; | |||
| _context.Entry(insurancePolicy).State = EntityState.Modified; | |||
| await _context.SaveChangesAsync(); | |||
| @@ -44,7 +44,7 @@ | |||
| throw new EntityNotFoundException("Insurer not found"); | |||
| _mapper.Map(insurerUpdateDto, insurer); | |||
| insurer.UpdatedAtUtc = DateTime.UtcNow; | |||
| insurer.UpdatedAtUtc = DateTime.Now; | |||
| _context.Entry(insurer).State = EntityState.Modified; | |||
| await _context.SaveChangesAsync(); | |||
| @@ -111,7 +111,7 @@ namespace Diligent.WebAPI.Business.Services | |||
| try | |||
| { | |||
| var result = JsonConvert.DeserializeObject<AuthSuccessResponse>(content); | |||
| var expires = result.Expires.Value - DateTime.UtcNow; | |||
| var expires = result.Expires.Value - DateTime.Now; | |||
| var cacheEntryOptions = new MemoryCacheEntryOptions() | |||
| .SetSlidingExpiration(TimeSpan.FromSeconds(60)) | |||
| .SetAbsoluteExpiration(expires) | |||
| @@ -15,7 +15,7 @@ | |||
| { | |||
| // map dto to db model | |||
| WebhookSubscription subscription = _mapper.Map<WebhookSubscription>(dto); | |||
| subscription.CreatedAtUtc = DateTime.UtcNow; | |||
| subscription.CreatedAtUtc = DateTime.Now; | |||
| subscription.IsActive = true; | |||
| // add to db | |||
| @@ -4,6 +4,7 @@ namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| [ApiVersion("1.0")] | |||
| [Route("v{version:apiVersion}/ads")] | |||
| [ApiController] | |||
| public class AdsController : ControllerBase | |||
| { | |||
| private readonly IAdService _adService; | |||
| @@ -13,26 +14,33 @@ namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| _adService = adService; | |||
| } | |||
| [Authorize] | |||
| [HttpGet] | |||
| public async Task<IActionResult> GetAll() => | |||
| Ok(await _adService.GetAllAsync()); | |||
| [Authorize] | |||
| [HttpGet("{id}")] | |||
| public async Task<IActionResult> GetById([FromRoute] int id) => | |||
| Ok(await _adService.GetByIdAsync(id)); | |||
| [Authorize] | |||
| [HttpGet("details/{id}")] | |||
| public async Task<IActionResult> GetAdDetailsById([FromRoute] int id) => | |||
| Ok(await _adService.GetAdDetailsByIdAsync(id)); | |||
| [Authorize] | |||
| [HttpGet("archive")] | |||
| public async Task<IActionResult> GetArchiveAds() => | |||
| Ok(await _adService.GetArchiveAds()); | |||
| [Authorize] | |||
| [HttpGet("filtered")] | |||
| public async Task<IActionResult> GetFilteredAds([FromQuery] AdFilterDto request) => | |||
| Ok(await _adService.GetFilteredAdsAsync(request)); | |||
| [Authorize] | |||
| [HttpPost] | |||
| public async Task<IActionResult> Create([FromBody]AdCreateDto request) | |||
| { | |||
| @@ -40,6 +48,7 @@ namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| return StatusCode((int)HttpStatusCode.Created); | |||
| } | |||
| [Authorize] | |||
| [HttpPut("{id}")] | |||
| public async Task<IActionResult> Update([FromBody] AdUpdateDto request, [FromRoute]int id) | |||
| { | |||
| @@ -47,6 +56,7 @@ namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| return Ok(); | |||
| } | |||
| [Authorize] | |||
| [HttpPut("archive-active-ad/{id}")] | |||
| public async Task<IActionResult> ArchiveActiveAd([FromRoute] int id) | |||
| { | |||
| @@ -55,6 +65,7 @@ namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| return Ok(); | |||
| } | |||
| [Authorize] | |||
| [HttpDelete("{id}")] | |||
| public async Task<IActionResult> DeleteAd([FromRoute]int id) | |||
| { | |||
| @@ -14,6 +14,7 @@ namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| _applicantService = applicantService; | |||
| } | |||
| [Authorize] | |||
| [HttpGet] | |||
| public async Task<IActionResult> GetFilteredApplicants([FromQuery] ApplicantFilterDto applicantFilterDto) => | |||
| Ok(await _applicantService.GetFilteredApplicants(applicantFilterDto)); | |||
| @@ -37,18 +38,21 @@ namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| return Ok(); | |||
| } | |||
| [Authorize] | |||
| [HttpGet("processes/{id}")] | |||
| public async Task<IActionResult> GetProcesses(int id) | |||
| { | |||
| return Ok(await _applicantService.GetApplicantWithSelectionProcessesById(id)); | |||
| } | |||
| [Authorize] | |||
| [HttpGet("options")] | |||
| public async Task<IActionResult> GetOptions() | |||
| { | |||
| return Ok(await _applicantService.GetOptions()); | |||
| } | |||
| [Authorize] | |||
| [HttpPost("selection-init")] | |||
| public async Task<IActionResult> InitSelection(ApplicantProcessRequestDTO model) | |||
| { | |||
| @@ -56,6 +60,7 @@ namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| return Ok(); | |||
| } | |||
| [Authorize] | |||
| [HttpPost("apply-for-ad")] | |||
| public async Task<IActionResult> ApplyForAd([FromForm]ApplyForAdRequestDto request) | |||
| { | |||
| @@ -14,23 +14,28 @@ namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| _patternService = patternService; | |||
| } | |||
| [Authorize] | |||
| [HttpGet] | |||
| public async Task<IActionResult> GetAll() => | |||
| Ok(await _patternService.GetAllAsync()); | |||
| [Authorize] | |||
| [HttpGet("{id}")] | |||
| public async Task<IActionResult> GetById([FromRoute] int id) => | |||
| Ok(await _patternService.GetByIdAsync(id)); | |||
| [Authorize] | |||
| [HttpGet("filter")] | |||
| public async Task<IActionResult> GetFilteredPatterns([FromQuery] FilterPatternDto request) => | |||
| Ok(await _patternService.GetFilteredPatternsAsync(request)); | |||
| [Authorize] | |||
| [HttpGet("corresponding-pattern-applicants/{id}")] | |||
| public async Task<IActionResult> GetFilteredPatterns([FromRoute] int id) => | |||
| Ok(await _patternService.GetCorrespondingPatternApplicants(id)); | |||
| [Authorize] | |||
| [HttpPost] | |||
| public async Task<IActionResult> Create([FromBody] PatternCreateDto request) | |||
| { | |||
| @@ -38,6 +43,7 @@ namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| return StatusCode((int)HttpStatusCode.Created); | |||
| } | |||
| [Authorize] | |||
| [HttpPost("schedule-interview")] | |||
| public async Task<IActionResult> ScheduleInterview([FromBody] ScheduleInterviewDto request) | |||
| { | |||
| @@ -46,6 +52,7 @@ namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| return Ok(result); | |||
| } | |||
| [Authorize] | |||
| [HttpPut("{id}")] | |||
| public async Task<IActionResult> Update([FromBody]PatternUpdateDto request, [FromRoute]int id) | |||
| { | |||
| @@ -53,6 +60,7 @@ namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| return Ok(); | |||
| } | |||
| [Authorize] | |||
| [HttpDelete("{id}")] | |||
| public async Task<IActionResult> DeletePattern([FromRoute] int id) | |||
| { | |||
| @@ -12,6 +12,7 @@ | |||
| _scheduleService = scheduleService; | |||
| } | |||
| [Authorize] | |||
| [HttpGet] | |||
| public async Task<IActionResult> GetSchedule(int month,int year) => | |||
| Ok(await _scheduleService.GetScheduleForCertainPeriod(month, year)); | |||
| @@ -11,16 +11,17 @@ | |||
| { | |||
| _selectionLevelService = selectionLevelService; | |||
| } | |||
| //[Authorize] | |||
| [Authorize] | |||
| [HttpGet] | |||
| public async Task<IActionResult> GetAll() => | |||
| Ok(await _selectionLevelService.GetAllAsync()); | |||
| [Authorize] | |||
| [HttpGet("filtered")] | |||
| public async Task<IActionResult> GetFilteredLevels([FromQuery] SelectionProcessFilterDto request) => | |||
| Ok(_selectionLevelService.GetFilteredLevelsAsync(request)); | |||
| //[Authorize] | |||
| [Authorize] | |||
| [HttpGet("{id}")] | |||
| public async Task<IActionResult> GetById([FromRoute] int id) => | |||
| Ok(await _selectionLevelService.GetByIdAsync(id)); | |||
| @@ -19,12 +19,12 @@ namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| //public async Task<IActionResult> GetAll() => | |||
| // Ok(await _selectionProcessesService.GetAllAsync()); | |||
| //[Authorize] | |||
| [Authorize] | |||
| [HttpPost] | |||
| public async Task<IActionResult> FinishSelectionProcess([FromBody] SelectionProcessCreateDto model) => | |||
| Ok(await _selectionProcessesService.FinishSelectionProcess(model)); | |||
| //[Authorize] | |||
| [Authorize] | |||
| [HttpPost("status-update")] | |||
| public async Task<IActionResult> UpdateStatus([FromBody] StatusChangeDTO model) | |||
| { | |||
| @@ -32,6 +32,7 @@ namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| return Ok("Status updated."); | |||
| } | |||
| [Authorize] | |||
| [HttpPost("interviewer-update")] | |||
| public async Task<IActionResult> UpdateInterviewer([FromBody] InterviewerUpdateDTO model) | |||
| { | |||
| @@ -12,10 +12,12 @@ | |||
| _technologyService = technologyService; | |||
| } | |||
| [Authorize] | |||
| [HttpGet] | |||
| public async Task<IActionResult> GetAll() => | |||
| Ok(await _technologyService.GetAllAsync()); | |||
| [Authorize] | |||
| [HttpGet("{id}")] | |||
| public async Task<IActionResult> GetById([FromRoute] int id) => | |||
| Ok(await _technologyService.GetByIdAsync(id)); | |||
| @@ -82,6 +82,7 @@ namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| return Ok(response.Data); | |||
| } | |||
| [Authorize] | |||
| [HttpPost("verify-invite")] | |||
| public async Task<IActionResult> VerifyInvite(string email, string token) | |||
| { | |||
| @@ -94,7 +95,7 @@ namespace Diligent.WebAPI.Host.Controllers.V1 | |||
| return Ok(result); | |||
| } | |||
| //[Authorize] | |||
| [Authorize] | |||
| [HttpPost] | |||
| public async Task<IActionResult> CreateUser([FromBody] CreateUserRequestDto model) | |||
| { | |||
| @@ -62,7 +62,7 @@ | |||
| if (refreshToken == null) | |||
| return; | |||
| refreshToken.ExpiryDate = DateTime.UtcNow.AddMinutes(30); | |||
| refreshToken.ExpiryDate = DateTime.Now.AddMinutes(30); | |||
| await service.UpdateRefreshToken(refreshToken); | |||
| } | |||
| @@ -22,8 +22,8 @@ namespace Diligent.WebAPI.Tests.Controllers | |||
| Id = 1, | |||
| Title = "React Developer", | |||
| MinimumExperience = 0, | |||
| CreatedAt = DateTime.UtcNow, | |||
| ExpiredAt = DateTime.UtcNow.AddDays(30), | |||
| CreatedAt = DateTime.Now, | |||
| ExpiredAt = DateTime.Now.AddDays(30), | |||
| KeyResponsibilities = "KR|KR", | |||
| Requirements = "R|R|R", | |||
| Offer = "O|O", | |||
| @@ -73,8 +73,8 @@ namespace Diligent.WebAPI.Tests.Controllers | |||
| Id = 1, | |||
| Title = "React Developer", | |||
| MinimumExperience = 0, | |||
| CreatedAt = DateTime.UtcNow, | |||
| ExpiredAt = DateTime.UtcNow.AddDays(30), | |||
| CreatedAt = DateTime.Now, | |||
| ExpiredAt = DateTime.Now.AddDays(30), | |||
| KeyResponsibilities = "KR|KR", | |||
| Requirements = "R|R|R", | |||
| Offer = "O|O" | |||
| @@ -137,8 +137,8 @@ namespace Diligent.WebAPI.Tests.Controllers | |||
| { | |||
| Title = "React Developer", | |||
| MinimumExperience = 0, | |||
| CreatedAt = DateTime.UtcNow, | |||
| ExpiredAt = DateTime.UtcNow.AddDays(30), | |||
| CreatedAt = DateTime.Now, | |||
| ExpiredAt = DateTime.Now.AddDays(30), | |||
| KeyResponsibilities = "KR|KR", | |||
| Requirements = "R|R|R", | |||
| Offer = "O|O" | |||
| @@ -160,8 +160,8 @@ namespace Diligent.WebAPI.Tests.Controllers | |||
| { | |||
| Title = "React Developer", | |||
| MinimumExperience = 0, | |||
| CreatedAt = DateTime.UtcNow, | |||
| ExpiredAt = DateTime.UtcNow.AddDays(30), | |||
| CreatedAt = DateTime.Now, | |||
| ExpiredAt = DateTime.Now.AddDays(30), | |||
| KeyResponsibilities = "KR|KR", | |||
| Requirements = "R|R|R", | |||
| Offer = "O|O" | |||
| @@ -183,8 +183,8 @@ namespace Diligent.WebAPI.Tests.Controllers | |||
| { | |||
| Title = "React Developer", | |||
| MinimumExperience = 0, | |||
| CreatedAt = DateTime.UtcNow, | |||
| ExpiredAt = DateTime.UtcNow.AddDays(30), | |||
| CreatedAt = DateTime.Now, | |||
| ExpiredAt = DateTime.Now.AddDays(30), | |||
| KeyResponsibilities = "KR|KR", | |||
| Requirements = "R|R|R", | |||
| Offer = "O|O" | |||
| @@ -38,8 +38,8 @@ namespace Diligent.WebAPI.Tests.Services | |||
| Id = 1, | |||
| Title = "React Developer", | |||
| MinimumExperience = 0, | |||
| CreatedAt = DateTime.UtcNow, | |||
| ExpiredAt = DateTime.UtcNow.AddDays(30), | |||
| CreatedAt = DateTime.Now, | |||
| ExpiredAt = DateTime.Now.AddDays(30), | |||
| KeyResponsibilities = "KR|KR", | |||
| Requirements = "R|R|R", | |||
| Offer = "O|O", | |||
| @@ -57,8 +57,8 @@ namespace Diligent.WebAPI.Tests.Services | |||
| Id = 2, | |||
| Title = ".NET Developer", | |||
| MinimumExperience = 0, | |||
| CreatedAt = DateTime.UtcNow.AddDays(-2), | |||
| ExpiredAt = DateTime.UtcNow.AddDays(-1), | |||
| CreatedAt = DateTime.Now.AddDays(-2), | |||
| ExpiredAt = DateTime.Now.AddDays(-1), | |||
| KeyResponsibilities = "KR|KR", | |||
| Requirements = "R|R|R", | |||
| Offer = "O|O", | |||
| @@ -177,8 +177,8 @@ namespace Diligent.WebAPI.Tests.Services | |||
| { | |||
| Title = "Vue Developer", | |||
| MinimumExperience = 0, | |||
| CreatedAt = DateTime.UtcNow, | |||
| ExpiredAt = DateTime.UtcNow.AddDays(30), | |||
| CreatedAt = DateTime.Now, | |||
| ExpiredAt = DateTime.Now.AddDays(30), | |||
| KeyResponsibilities = "KR|KR", | |||
| Requirements = "R|R|R", | |||
| Offer = "O|O", | |||
| @@ -204,8 +204,8 @@ namespace Diligent.WebAPI.Tests.Services | |||
| { | |||
| Title = "Vue Developer", | |||
| MinimumExperience = 0, | |||
| CreatedAt = DateTime.UtcNow, | |||
| ExpiredAt = DateTime.UtcNow.AddDays(30), | |||
| CreatedAt = DateTime.Now, | |||
| ExpiredAt = DateTime.Now.AddDays(30), | |||
| KeyResponsibilities = "KR|KR", | |||
| Requirements = "R|R|R", | |||
| Offer = "O|O", | |||
| @@ -230,8 +230,8 @@ namespace Diligent.WebAPI.Tests.Services | |||
| { | |||
| Title = "Vue Developer", | |||
| MinimumExperience = 0, | |||
| CreatedAt = DateTime.UtcNow, | |||
| ExpiredAt = DateTime.UtcNow.AddDays(30), | |||
| CreatedAt = DateTime.Now, | |||
| ExpiredAt = DateTime.Now.AddDays(30), | |||
| KeyResponsibilities = "KR|KR", | |||
| Requirements = "R|R|R", | |||
| Offer = "O|O", | |||