Преглед изворни кода

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

pull/95/head
safet.purkovic пре 3 година
родитељ
комит
ac76416c50

+ 2
- 2
Diligent.WebAPI.Business/Services/ApplicantService.cs Прегледај датотеку

@@ -87,10 +87,10 @@
throw new EntityNotFoundException("Applicant not found");
}

_logger.LogError($"Removing Applicant with id = {id}");
_logger.LogInformation($"Removing Applicant with id = {id}");
_context.Applicants.Remove(applicant);
var result = _context.SaveChangesAsync();
_logger.LogError($"Applicant with id = {id} is removed successfully");
_logger.LogInformation($"Applicant with id = {id} is removed successfully");
await result;
}


+ 6
- 6
Diligent.WebAPI.Business/Services/AuthenticationService.cs Прегледај датотеку

@@ -31,7 +31,7 @@ namespace Diligent.WebAPI.Business.Services
public async Task<ServiceResponseDTO<AuthenticateResponseDto>> Authenticate(AuthenticateRequestDto model)
{
_logger.LogError($"Checking credentials for user: {model.Username}");
_logger.LogInformation($"Checking credentials for user: {model.Username}");
var user = await _userManager.FindByNameAsync(model.Username);

// return null if user not found
@@ -50,7 +50,7 @@ namespace Diligent.WebAPI.Business.Services
// return null if user is disabled
if (user.IsEnabled == false)
{
_logger.LogError($"User: {model.Username} is not enabled");
_logger.LogInformation($"User: {model.Username} is not enabled");
return new ServiceResponseDTO<AuthenticateResponseDto>
{
IsError = true,
@@ -60,7 +60,7 @@ namespace Diligent.WebAPI.Business.Services
// password is not correct
if (!result)
{
_logger.LogError($"Password for user: {model.Username} is not correct");
_logger.LogInformation($"Password for user: {model.Username} is not correct");
await _userManager.AccessFailedAsync(user);

return new ServiceResponseDTO<AuthenticateResponseDto>
@@ -70,13 +70,13 @@ namespace Diligent.WebAPI.Business.Services
};
}
var token = await GenerateToken(user);
_logger.LogError($"Successfull login token: {token}");
_logger.LogInformation($"Successfull login token: {token}");
return token;
}

public async Task<ServiceResponseDTO<AuthenticateResponseDto>> Authenticate(GoogleApiModel model)
{
_logger.LogError($"Checking token for google login {model.Token}");
_logger.LogInformation($"Checking token for google login {model.Token}");
if (!(await _httpClient.IsTokenValid(model.Token)))
{
_logger.LogError($"Token is not valid");
@@ -86,7 +86,7 @@ namespace Diligent.WebAPI.Business.Services
ErrorMessage = "Invalid Google Api Token"
};
}
_logger.LogError($"Checking if user exists in Db with email : {model.User.email}");
_logger.LogInformation($"Checking if user exists in Db with email : {model.User.email}");
var user = await _userManager.FindByEmailAsync(model.User.email);

// return null if user not found

+ 1
- 1
Diligent.WebAPI.Business/Services/PatternService.cs Прегледај датотеку

@@ -76,7 +76,7 @@ namespace Diligent.WebAPI.Business.Services
throw new EntityNotFoundException("Pattern already exists in database");
}

_logger.LogError($"Pattern are not in database");
_logger.LogInformation($"Pattern is not in database");
_logger.LogInformation($"Mapping PatternCreateDto to model");
var pattern = _mapper.Map<Pattern>(patternCreateDto);
_logger.LogInformation($"Pattern mapped successfully");

+ 1
- 1
Diligent.WebAPI.Business/Services/SelectionLevelService.cs Прегледај датотеку

@@ -58,7 +58,7 @@
throw new EntityNotFoundException("Selection level not found");
}

_logger.LogError($"Level with id = {id} found and returned to client");
_logger.LogInformation($"Level with id = {id} found and returned to client");
return sl;
}


+ 4
- 4
Diligent.WebAPI.Business/Services/SelectionProcessService.cs Прегледај датотеку

@@ -37,10 +37,10 @@ namespace Diligent.WebAPI.Business.Services
throw new EntityNotFoundException("Selection process not found");
}

_logger.LogError($"Changing status for {model.Id}");
_logger.LogInformation($"Changing status for {model.Id}");
sp.Status = "Odrađen";

_logger.LogError($"Skipping throught levels to come to next level");
_logger.LogInformation($"Skipping throught levels to come to next level");
var nextLevel = _context.SelectionLevels.AsEnumerable()
.SkipWhile(obj => obj.Id != sp.SelectionLevelId)
.Skip(1).First();
@@ -60,9 +60,9 @@ namespace Diligent.WebAPI.Business.Services
SchedulerId = model.SchedulerId
};
_context.SelectionProcesses.Add(newProcess);
_logger.LogError($"Create and add new selection process");
_logger.LogInformation($"Create and add new selection process");
var result = await _context.SaveChangesAsync() > 0;
_logger.LogError($"Saved changes to db");
_logger.LogInformation($"Saved changes to db");
return result;
}


Loading…
Откажи
Сачувај