From d925bc22d83d6eeaa410be9978d3b2f74edc35cd Mon Sep 17 00:00:00 2001 From: Ivan Sentemon Date: Sun, 29 Dec 2024 10:34:31 +0100 Subject: [PATCH] Fix warnings --- .../src/AuthService/AuthService.Domain/Entities/User.cs | 7 +++++-- .../Shared/Shared.Application/Abstractions/ICommand.cs | 4 +--- .../src/Shared/Shared.Application/Abstractions/IQuery.cs | 4 +--- backend/src/Shared/Shared.Application/Common/Result.cs | 8 ++++++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/backend/src/AuthService/AuthService.Domain/Entities/User.cs b/backend/src/AuthService/AuthService.Domain/Entities/User.cs index ad4f8d6..f9e2a33 100644 --- a/backend/src/AuthService/AuthService.Domain/Entities/User.cs +++ b/backend/src/AuthService/AuthService.Domain/Entities/User.cs @@ -13,8 +13,6 @@ public class User public string ImageUrl { get; private set; } public DateTime CreatedAt { get; private set; } - private User() { } - private User(string id, string firstName, string lastName, Username username, Email email, string? imageUrl = null) { Id = id; @@ -56,4 +54,9 @@ public void VerifyEmail() { EmailVerified = true; } + + #pragma warning disable CS8618 + // Required by EF Core + private User() { } + #pragma warning restore CS8618 } \ No newline at end of file diff --git a/backend/src/Shared/Shared.Application/Abstractions/ICommand.cs b/backend/src/Shared/Shared.Application/Abstractions/ICommand.cs index 44ba9d5..8c429c4 100644 --- a/backend/src/Shared/Shared.Application/Abstractions/ICommand.cs +++ b/backend/src/Shared/Shared.Application/Abstractions/ICommand.cs @@ -1,5 +1,3 @@ namespace Shared.Application.Abstractions; -public interface ICommand -{ -} \ No newline at end of file +public interface ICommand; \ No newline at end of file diff --git a/backend/src/Shared/Shared.Application/Abstractions/IQuery.cs b/backend/src/Shared/Shared.Application/Abstractions/IQuery.cs index db8ea22..8c4f703 100644 --- a/backend/src/Shared/Shared.Application/Abstractions/IQuery.cs +++ b/backend/src/Shared/Shared.Application/Abstractions/IQuery.cs @@ -1,5 +1,3 @@ namespace Shared.Application.Abstractions; -public interface IQuery -{ -} \ No newline at end of file +public interface IQuery; \ No newline at end of file diff --git a/backend/src/Shared/Shared.Application/Common/Result.cs b/backend/src/Shared/Shared.Application/Common/Result.cs index 2ca850a..81de192 100644 --- a/backend/src/Shared/Shared.Application/Common/Result.cs +++ b/backend/src/Shared/Shared.Application/Common/Result.cs @@ -6,21 +6,25 @@ namespace Shared.Application.Common; public class Result : IResult { + #pragma warning disable CS8766 public TResponse? Response { get; } public Error? Error { get; } + #pragma warning restore CS8766 public bool IsSuccess { get; } public HttpStatusCode StatusCode { get; } - private Result(TResponse? response) + private Result(TResponse response) { Response = response; + Error = default; IsSuccess = true; StatusCode = HttpStatusCode.OK; } - private Result(Error? error) + private Result(Error error) { Error = error; + Response = default; IsSuccess = false; StatusCode = HttpStatusCode.BadRequest; }