diff --git a/DrinkRateAPI/Exceptions/Exceptions.cs b/DrinkRateAPI/Exceptions/Exceptions.cs index c005b85..0a76e7e 100644 --- a/DrinkRateAPI/Exceptions/Exceptions.cs +++ b/DrinkRateAPI/Exceptions/Exceptions.cs @@ -1,38 +1,70 @@ namespace DrinkRateAPI.Exceptions; -public abstract class DrinkRateException : Exception; +public class DrinkRateException : Exception +{ + public DrinkRateException() : base() { } + public DrinkRateException(string message) : base(message) { } +} /// /// 400 - Bad request /// -public class BadRequestException : DrinkRateException; +public class BadRequestException : DrinkRateException +{ + public BadRequestException() : base() { } + public BadRequestException(string message) : base(message) { } +} /// /// 401 - Unauthenticated /// -public class UnauthenticatedException : DrinkRateException; +public class UnauthenticatedException : DrinkRateException +{ + public UnauthenticatedException() : base() { } + public UnauthenticatedException(string message) : base(message) { } +} /// /// 402 - Payment required /// -public class PaymentRequiredException : DrinkRateException; +public class PaymentRequiredException : DrinkRateException +{ + public PaymentRequiredException() : base() { } + public PaymentRequiredException(string message) : base(message) { } +} /// /// 403 - Forbidden /// -public class ForbiddenException : DrinkRateException; +public class ForbiddenException : DrinkRateException +{ + public ForbiddenException() : base() { } + public ForbiddenException(string message) : base(message) { } +} /// /// 404 - Not found /// -public class NotFoundException : DrinkRateException; +public class NotFoundException : DrinkRateException +{ + public NotFoundException() : base() { } + public NotFoundException(string message) : base(message) { } +} /// /// 418 - I'm a teapot /// -public class IamATeapotException : DrinkRateException; +public class IamATeapotException : DrinkRateException +{ + public IamATeapotException() : base() { } + public IamATeapotException(string message) : base(message) { } +} /// /// 451 - Unavailable for lagal reasons /// -public class UnavailableForLagalReasonsException : DrinkRateException; \ No newline at end of file +public class UnavailableForLagalReasonsException : DrinkRateException +{ + public UnavailableForLagalReasonsException() : base() { } + public UnavailableForLagalReasonsException(string message) : base(message) { } +} \ No newline at end of file diff --git a/DrinkRateAPI/Services/ApplicationUserService.cs b/DrinkRateAPI/Services/ApplicationUserService.cs index 7df4ac0..4eb4190 100644 --- a/DrinkRateAPI/Services/ApplicationUserService.cs +++ b/DrinkRateAPI/Services/ApplicationUserService.cs @@ -13,7 +13,7 @@ public class ApplicationUserService(ApplicationDbContext context) { var appUserId = identity.FindFirst(ClaimTypes.NameIdentifier)?.Value; var profile = await _context.UserProfiles - .FirstOrDefaultAsync(x => x.ApplicationUserId.ToString() == appUserId) + .FirstOrDefaultAsync(x => x.ApplicationUserId.ToString() == appUserId && !x.IsDeleted) ?? throw new NotFoundException(); return profile;