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

exlude some code from code coverage

feature/mongo-services-with-interfaces
Dzenis Hadzifejzovic пре 3 година
родитељ
комит
d03e4a3ccf
22 измењених фајлова са 50 додато и 19 уклоњено
  1. 2
    5
      Backend/Diligent.WebAPI.Business/HelperModels/DeleteCustomerRequest.cs
  2. 2
    0
      Backend/Diligent.WebAPI.Business/Services/AuthorizationService.cs
  3. 2
    0
      Backend/Diligent.WebAPI.Business/Services/BaseMongo.cs
  4. 2
    0
      Backend/Diligent.WebAPI.Data/DbContext/MongoDBContext.cs
  5. 2
    0
      Backend/Diligent.WebAPI.Data/Entities/BaseMongo.cs
  6. 2
    0
      Backend/Diligent.WebAPI.Data/WebApiDatabaseSettings.cs
  7. 2
    0
      Backend/Diligent.WebAPI.Host/Controllers/AuthenticationController.cs
  8. 2
    0
      Backend/Diligent.WebAPI.Host/Controllers/NotificationController.cs
  9. 2
    0
      Backend/Diligent.WebAPI.Host/Controllers/RequestController.cs
  10. 2
    0
      Backend/Diligent.WebAPI.Host/Controllers/RoomController.cs
  11. 4
    1
      Backend/Diligent.WebAPI.Host/DTOs/Chat/LeaveChatRoomDTO.cs
  12. 4
    1
      Backend/Diligent.WebAPI.Host/DTOs/Notification/NotificationReadDTO.cs
  13. 4
    1
      Backend/Diligent.WebAPI.Host/DTOs/Request/AcceptCustomerDTO.cs
  14. 1
    6
      Backend/Diligent.WebAPI.Host/Exceptions/BaseException.cs
  15. 0
    4
      Backend/Diligent.WebAPI.Host/Exceptions/NotFoundException.cs
  16. 2
    0
      Backend/Diligent.WebAPI.Host/Extensions/ApiConfiguration.cs
  17. 2
    0
      Backend/Diligent.WebAPI.Host/Extensions/ExceptionHandlingMiddlewareExtensions.cs
  18. 5
    0
      Backend/Diligent.WebAPI.Host/Extensions/WebApp.cs
  19. 3
    0
      Backend/Diligent.WebAPI.Host/Extensions/WebAppBuilder.cs
  20. 2
    0
      Backend/Diligent.WebAPI.Host/Mapper/NotificationMappingProfile.cs
  21. 2
    0
      Backend/Diligent.WebAPI.Host/Mediator/Authentication/Handlers/AddRoleHandler.cs
  22. 1
    1
      Backend/Diligent.WebAPI.Host/Mediator/Authentication/Handlers/LoginUserHandler.cs

+ 2
- 5
Backend/Diligent.WebAPI.Business/HelperModels/DeleteCustomerRequest.cs Прегледај датотеку

@@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Business.HelperModels
{
[ExcludeFromCodeCoverage]
public class DeleteCustomerRequest
{
public string? Id { get; set; }

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

@@ -5,12 +5,14 @@ using Microsoft.Extensions.Options;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Diligent.WebAPI.Business.Services
{
[ExcludeFromCodeCoverage]
public class AuthorizationService : BaseMongo<Customer>
{
public AuthorizationService(IOptions<WebApiDatabaseSettings> webApiDatabaseSettings) :

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

@@ -1,9 +1,11 @@
using Diligent.WebAPI.Data;
using Microsoft.Extensions.Options;
using MongoDB.Driver;
using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Business.MongoServices
{
[ExcludeFromCodeCoverage]
public class BaseMongo<T> where T : class
{
protected readonly IMongoCollection<T> _mongoCollection;

+ 2
- 0
Backend/Diligent.WebAPI.Data/DbContext/MongoDBContext.cs Прегледај датотеку

@@ -1,7 +1,9 @@
using MongoDB.Driver;
using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Data
{
[ExcludeFromCodeCoverage]
public class MongoDBContext : IMongoDBContext
{
private readonly IConfiguration _configuration;

+ 2
- 0
Backend/Diligent.WebAPI.Data/Entities/BaseMongo.cs Прегледај датотеку

@@ -1,8 +1,10 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Data.Entities
{
[ExcludeFromCodeCoverage]
public class BaseMongo
{
[BsonId]

+ 2
- 0
Backend/Diligent.WebAPI.Data/WebApiDatabaseSettings.cs Прегледај датотеку

@@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Diligent.WebAPI.Data
{
[ExcludeFromCodeCoverage]
public class WebApiDatabaseSettings
{
public string ConnectionString { get; set; } = null!;

+ 2
- 0
Backend/Diligent.WebAPI.Host/Controllers/AuthenticationController.cs Прегледај датотеку

@@ -3,12 +3,14 @@ using Diligent.WebAPI.Host.Mediator.Authentication.Commands;
using Diligent.WebAPI.Host.Mediator.Authentication.Queries;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Host.Controllers
{
[ApiVersion("1.0")]
[ApiController]
[Route("v{version:apiVersion}/[controller]")]
[ExcludeFromCodeCoverage]
public class AuthenticationController : ControllerBase
{
// password for every user in database is "Nekasifra123!"

+ 2
- 0
Backend/Diligent.WebAPI.Host/Controllers/NotificationController.cs Прегледај датотеку

@@ -3,12 +3,14 @@ using Diligent.WebAPI.Host.Mediator.Notifications.Commands;
using Diligent.WebAPI.Host.Mediator.Notifications.Queries;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Host.Controllers
{
[ApiVersion("1.0")]
[ApiController]
[Route("v{version:apiVersion}/[controller]")]
[ExcludeFromCodeCoverage]
public class NotificationController : ControllerBase
{
private readonly IMediator _mediator;

+ 2
- 0
Backend/Diligent.WebAPI.Host/Controllers/RequestController.cs Прегледај датотеку

@@ -8,12 +8,14 @@ using Diligent.WebAPI.Host.Mediator.Request.Commands;
using Diligent.WebAPI.Host.Mediator.Request.Queries;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Host.Controllers
{
[ApiVersion("1.0")]
[ApiController]
[Route("v{version:apiVersion}/[controller]")]
[ExcludeFromCodeCoverage]
public class RequestController:ControllerBase
{
private readonly IMediator _mediator;

+ 2
- 0
Backend/Diligent.WebAPI.Host/Controllers/RoomController.cs Прегледај датотеку

@@ -4,12 +4,14 @@ using Diligent.WebAPI.Host.Mediator.Rooms.Queries;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Host.Controllers
{
[ApiVersion("1.0")]
[ApiController]
[Route("v{version:apiVersion}/[controller]")]
[ExcludeFromCodeCoverage]
public class RoomController : ControllerBase
{
private readonly IMediator _mediator;

+ 4
- 1
Backend/Diligent.WebAPI.Host/DTOs/Chat/LeaveChatRoomDTO.cs Прегледај датотеку

@@ -1,5 +1,8 @@
namespace Diligent.WebAPI.Host.DTOs.Chat
using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Host.DTOs.Chat
{
[ExcludeFromCodeCoverage]
public class LeaveChatRoomDTO
{
public string ConnId { get; set; }

+ 4
- 1
Backend/Diligent.WebAPI.Host/DTOs/Notification/NotificationReadDTO.cs Прегледај датотеку

@@ -1,5 +1,8 @@
namespace Diligent.WebAPI.Host.DTOs.Notification
using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Host.DTOs.Notification
{
[ExcludeFromCodeCoverage]
public class NotificationReadDTO
{
public string RoomId { get; set; }

+ 4
- 1
Backend/Diligent.WebAPI.Host/DTOs/Request/AcceptCustomerDTO.cs Прегледај датотеку

@@ -1,5 +1,8 @@
namespace Diligent.WebAPI.Host.DTOs.Request
using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Host.DTOs.Request
{
[ExcludeFromCodeCoverage]
public class AcceptCustomerDTO
{
public string customerId { get; set; }

+ 1
- 6
Backend/Diligent.WebAPI.Host/Exceptions/BaseException.cs Прегледај датотеку

@@ -1,13 +1,8 @@
using System.Runtime.Serialization;

namespace Diligent.WebAPI.Host.Exceptions
namespace Diligent.WebAPI.Host.Exceptions
{
public class BaseException : Exception
{
public BaseException() { }
public BaseException(string? message) : base(message) { }
public BaseException(string message, Exception innerException) : base(message, innerException) { }
public BaseException(SerializationInfo info, StreamingContext context) : base(info, context) { }

}
}

+ 0
- 4
Backend/Diligent.WebAPI.Host/Exceptions/NotFoundException.cs Прегледај датотеку

@@ -4,11 +4,7 @@ namespace Diligent.WebAPI.Host.Exceptions
{
public class NotFoundException : BaseException
{

public NotFoundException() { }
public NotFoundException(string? message) : base(message) { }
public NotFoundException(string message, Exception innerException) : base(message, innerException) { }
public NotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { }

}
}

+ 2
- 0
Backend/Diligent.WebAPI.Host/Extensions/ApiConfiguration.cs Прегледај датотеку

@@ -1,7 +1,9 @@
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Host.Extensions
{
[ExcludeFromCodeCoverage]
public static class ApiConfiguration
{
public static void ConfigureServices(IServiceCollection services)

+ 2
- 0
Backend/Diligent.WebAPI.Host/Extensions/ExceptionHandlingMiddlewareExtensions.cs Прегледај датотеку

@@ -1,7 +1,9 @@
using Diligent.WebAPI.Host.Middlewares;
using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Host.Extensions
{
[ExcludeFromCodeCoverage]
public static class ExceptionHandlingMiddlewareExtensions
{
public static void ConfigureCustomExceptionMiddleware(this IApplicationBuilder app)

+ 5
- 0
Backend/Diligent.WebAPI.Host/Extensions/WebApp.cs Прегледај датотеку

@@ -1,8 +1,13 @@

using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Host.Extensions;

[ExcludeFromCodeCoverage]
public static class WebApp
{

[ExcludeFromCodeCoverage]
public static void SetupData(this WebApplication app)
{
app.ConfigureCustomExceptionMiddleware();

+ 3
- 0
Backend/Diligent.WebAPI.Host/Extensions/WebAppBuilder.cs Прегледај датотеку

@@ -12,11 +12,14 @@ using System.Text;
using Diligent.WebAPI.Business.Services;
using Diligent.WebAPI.Host.Middlewares;
using Diligent.WebAPI.Business.Interfaces;
using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Host.Extensions;

[ExcludeFromCodeCoverage]
public static class WebAppBuilder
{

public static void ConfigureData(this WebApplicationBuilder builder, IConfiguration configuration)
{
// database configuration

+ 2
- 0
Backend/Diligent.WebAPI.Host/Mapper/NotificationMappingProfile.cs Прегледај датотеку

@@ -1,9 +1,11 @@
using AutoMapper;
using Diligent.WebAPI.Data.Entities;
using Diligent.WebAPI.Host.DTOs.Notification;
using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Host.Mapper
{
[ExcludeFromCodeCoverage]
public class NotificationMappingProfile : Profile
{
public NotificationMappingProfile()

+ 2
- 0
Backend/Diligent.WebAPI.Host/Mediator/Authentication/Handlers/AddRoleHandler.cs Прегледај датотеку

@@ -2,9 +2,11 @@
using Diligent.WebAPI.Host.Mediator.Authentication.Commands;
using MediatR;
using Microsoft.AspNetCore.Identity;
using System.Diagnostics.CodeAnalysis;

namespace Diligent.WebAPI.Host.Mediator.Authentication.Handlers
{
[ExcludeFromCodeCoverage]
public class AddRoleHandler : IRequestHandler<AddRoleCommand, Unit>
{
private readonly RoleManager<Roles> _roleManager;

+ 1
- 1
Backend/Diligent.WebAPI.Host/Mediator/Authentication/Handlers/LoginUserHandler.cs Прегледај датотеку

@@ -31,7 +31,7 @@ namespace Diligent.WebAPI.Host.Mediator.Authentication.Handlers

Customer customer = await _customerService.GetCustomer(customerLoginDTO.Username);
var customerReadDTO = _mapper.Map<CustomerReadDTO>(customer);
customerReadDTO.Token = await _authenticationService.GenerateToken();
customerReadDTO.Token = await _authenticationService.GenerateToken() ?? "";
customerReadDTO.Roles = (List<string>)await _customerManager.GetRolesAsync(customer);
return customerReadDTO;
}

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