From 10138682d4133e4a9f94c8a0550789748755aede Mon Sep 17 00:00:00 2001 From: Alex Grigorichev Date: Wed, 6 Sep 2023 10:02:33 +0500 Subject: [PATCH 1/4] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20=D0=BF=D1=83=D0=B1=D0=BB=D0=B8=D0=BA=D0=B0=D1=86=D0=B8=D1=8E?= =?UTF-8?q?=20README.md=20=D0=B8=20LICENSE.txt=20=D0=B2=20nuget.org.=20?= =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=BD=D1=8F=D0=BB=20=D0=B2=D0=B5=D1=81=D1=80?= =?UTF-8?q?=D0=B8=D1=8E=20.net=20=D0=B2=20=D1=82=D0=B5=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D1=85=20=D0=B4=D0=BE=206.=20=D0=9F=D0=BE=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D0=BB=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20github=20?= =?UTF-8?q?actions.=20=D0=9F=D0=BE=D0=B4=D0=BD=D1=8F=D0=BB=20=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D1=81=D0=B8=D1=8E=20=D0=BF=D0=B0=D0=BA=D0=B5=D1=82=D0=B0?= =?UTF-8?q?=20=D0=B4=D0=BE=201.1.5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pull-request.yml | 2 +- .github/workflows/push.yml | 2 +- .github/workflows/release.yml | 2 +- .gitignore | 4 +++- Directory.Build.props | 2 +- README.md | 14 ++------------ .../Byndyusoft.ModelResult.AspNetCore.csproj | 6 ++++++ src/ModelResult/Byndyusoft.ModelResult.csproj | 6 ++++++ .../Byndyusoft.ModelResult.UnitTests.csproj | 2 +- 9 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 861b5c1..9e4ad03 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -21,7 +21,7 @@ jobs: - name: install dotnet uses: actions/setup-dotnet@v1 with: - dotnet-version: '3.1.x' + dotnet-version: 6.0.x - name: install packages run: dotnet restore diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index cb83254..4e60936 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -21,7 +21,7 @@ jobs: - name: install dotnet uses: actions/setup-dotnet@v1 with: - dotnet-version: '3.1.x' + dotnet-version: 6.0.x - name: install packages run: dotnet restore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 78ff46c..1ebd227 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: - name: install dotnet uses: actions/setup-dotnet@v1 with: - dotnet-version: 3.1.x + dotnet-version: 6.0.x - name: install packages run: dotnet restore diff --git a/.gitignore b/.gitignore index dab9be8..6dce6e3 100644 --- a/.gitignore +++ b/.gitignore @@ -140,4 +140,6 @@ ModelManifest.xml **/.vs/config/applicationhost.config src/.vs/** -.vs/** \ No newline at end of file +.vs/** + +.idea \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index 024cc08..f77ad2f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 1.1.4 + 1.1.5 Byndyusoft.ModelResult Byndyusoft Byndyusoft;ModelResult diff --git a/README.md b/README.md index 744bc97..4010fe0 100644 --- a/README.md +++ b/README.md @@ -88,22 +88,12 @@ A detailed overview on how to contribute can be found in the [contributing guide Make sure you have installed all of the following prerequisites on your development machine: - Git - [Download & Install Git](https://git-scm.com/downloads). OSX and Linux machines typically have this already installed. -- .NET Core (version 3.1 or higher) - [Download & Install .NET Core](https://dotnet.microsoft.com/download/dotnet-core/3.1). - -## General folders layout - -### src -- source code - -### tests - -- unit-tests - +- .NET Core (version 6.0 or higher) - [Download & Install .NET Core](https://dotnet.microsoft.com/en-us/download/dotnet/6.0). ## Package development lifecycle - Implement package logic in `src` -- Add or addapt unit-tests (prefer before and simultaneously with coding) in `tests` +- Add or adapt unit-tests in `tests` - Add or change the documentation as needed - Open pull request in the correct branch. Target the project's `master` branch diff --git a/src/ModelResult.AspNetCore/Byndyusoft.ModelResult.AspNetCore.csproj b/src/ModelResult.AspNetCore/Byndyusoft.ModelResult.AspNetCore.csproj index 31dbf34..fd2ae05 100644 --- a/src/ModelResult.AspNetCore/Byndyusoft.ModelResult.AspNetCore.csproj +++ b/src/ModelResult.AspNetCore/Byndyusoft.ModelResult.AspNetCore.csproj @@ -5,6 +5,7 @@ enable Byndyusoft.ModelResult.AspNetCore Byndyusoft.ModelResult.AspNetCore + README.md @@ -15,4 +16,9 @@ + + + + + diff --git a/src/ModelResult/Byndyusoft.ModelResult.csproj b/src/ModelResult/Byndyusoft.ModelResult.csproj index f0bd2c1..6f75865 100644 --- a/src/ModelResult/Byndyusoft.ModelResult.csproj +++ b/src/ModelResult/Byndyusoft.ModelResult.csproj @@ -4,6 +4,12 @@ netstandard2.1 Byndyusoft.ModelResult Byndyusoft.ModelResult + README.md + + + + + diff --git a/tests/ModelResult.UnitTests/Byndyusoft.ModelResult.UnitTests.csproj b/tests/ModelResult.UnitTests/Byndyusoft.ModelResult.UnitTests.csproj index 05c7dc9..d7c5cdd 100644 --- a/tests/ModelResult.UnitTests/Byndyusoft.ModelResult.UnitTests.csproj +++ b/tests/ModelResult.UnitTests/Byndyusoft.ModelResult.UnitTests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 enable false From d922fc31f37ac7960b9580cb2d01b89d7d7cd324 Mon Sep 17 00:00:00 2001 From: Alex Grigorichev Date: Wed, 6 Sep 2023 10:42:40 +0500 Subject: [PATCH 2/4] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20PackageLicenseFile=20=D0=B2=20=D0=BF=D1=83=D0=B1=D0=BB=D0=B8?= =?UTF-8?q?=D0=BA=D1=83=D0=B5=D0=BC=D1=8B=D0=B5=20=D0=BA=D1=83=D0=B1=D0=B8?= =?UTF-8?q?=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Byndyusoft.ModelResult.AspNetCore.csproj | 1 + src/ModelResult/Byndyusoft.ModelResult.csproj | 1 + 2 files changed, 2 insertions(+) diff --git a/src/ModelResult.AspNetCore/Byndyusoft.ModelResult.AspNetCore.csproj b/src/ModelResult.AspNetCore/Byndyusoft.ModelResult.AspNetCore.csproj index fd2ae05..6170c32 100644 --- a/src/ModelResult.AspNetCore/Byndyusoft.ModelResult.AspNetCore.csproj +++ b/src/ModelResult.AspNetCore/Byndyusoft.ModelResult.AspNetCore.csproj @@ -6,6 +6,7 @@ Byndyusoft.ModelResult.AspNetCore Byndyusoft.ModelResult.AspNetCore README.md + LICENSE.txt diff --git a/src/ModelResult/Byndyusoft.ModelResult.csproj b/src/ModelResult/Byndyusoft.ModelResult.csproj index 6f75865..ada2375 100644 --- a/src/ModelResult/Byndyusoft.ModelResult.csproj +++ b/src/ModelResult/Byndyusoft.ModelResult.csproj @@ -5,6 +5,7 @@ Byndyusoft.ModelResult Byndyusoft.ModelResult README.md + LICENSE.txt From 38e2cef087773a3eb83d8ed98eec70dbe62713db Mon Sep 17 00:00:00 2001 From: Alex Grigorichev Date: Thu, 7 Sep 2023 09:22:59 +0500 Subject: [PATCH 3/4] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=BC=D0=B5=D1=87=D0=B0=D0=BD=D0=B8=D0=B9=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D1=80=D0=B5=D0=B2=D1=8C=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4010fe0..751c912 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Byndyusoft.ModelResult -Result of domain model logic similar to ActionResult +The result of domain logic, similar to ActionResult | | | | | ------- | ------------ | --------- | @@ -15,7 +15,7 @@ dotnet add package Byndyusoft.ModelResult ## Usage -ModelResult can be used to return either "ok" or "error" value without explicit casting. Here are some usage examples: +ModelResult can be used to return either an "ok" value or an "error" value without explicit casting. Here are some usage examples: ```csharp public ModelResult GetId(SampleEntity entity) @@ -55,7 +55,7 @@ public ModelResult GetEntityInfoDto(SampleEntity entity) ``` # ModelResult.AspNetCore -Converter to ActionResult from ModelResult +A converter of ModelResult to ActionResult ## Installing @@ -75,11 +75,11 @@ public async Task> GetEntityInfoDto([FromRoute] long } ``` -If `result` is "ok" result then action method will return message with 200 code and dto content. Otherwise if it is "error" result it is usually will be transformed to 400 code with error info that contains code, message and items. Current version has one exception: if error code is equal to `Byndyusoft.ModelResult.Common.CommonErrorCodes.NotFound` there will be 404 code without any content. +If `result` is an "ok" result then the action method will return a message with the 200 code and the contents of the DTO. Otherwise if it is "error" result it is usually will be transformed to 400 code with error info that contains code, message and items. The current version has one exception: if an error code is equal to `Byndyusoft.ModelResult.Common.CommonErrorCodes.NotFound` there will be the 404 code without any content. # Contributing -To contribute, you will need to setup your local environment, see [prerequisites](#prerequisites). For the contribution and workflow guide, see [package development lifecycle](#package-development-lifecycle). +To contribute, you will need to setup your local environment, see [prerequisites](#prerequisites). For a contribution and workflow guide, see [package development lifecycle](#package-development-lifecycle). A detailed overview on how to contribute can be found in the [contributing guide](CONTRIBUTING.md). @@ -95,7 +95,7 @@ Make sure you have installed all of the following prerequisites on your developm - Implement package logic in `src` - Add or adapt unit-tests in `tests` - Add or change the documentation as needed -- Open pull request in the correct branch. Target the project's `master` branch +- Open pull request for a correct branch. Target the project's `master` branch # Maintainers From d59e4797e72762380b4a203788bd5d8e963cace6 Mon Sep 17 00:00:00 2001 From: Alex Grigorichev Date: Thu, 7 Sep 2023 09:44:16 +0500 Subject: [PATCH 4/4] =?UTF-8?q?=D0=98=D0=B7=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=D1=81=D1=8F=20=D0=BE=D1=82=20=D0=B2=D0=BE=D1=80=D0=BD=D0=B8?= =?UTF-8?q?=D0=BD=D0=B3=D0=BE=D0=B2=20=D0=B2=20=D1=82=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D1=85.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ModelResult/Dtos/ErrorInfoDtoTests.cs | 3 +-- .../ModelResult/ModelResults/ModelResultTests.cs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/ModelResult.UnitTests/ModelResult/Dtos/ErrorInfoDtoTests.cs b/tests/ModelResult.UnitTests/ModelResult/Dtos/ErrorInfoDtoTests.cs index 31743c5..04acc88 100644 --- a/tests/ModelResult.UnitTests/ModelResult/Dtos/ErrorInfoDtoTests.cs +++ b/tests/ModelResult.UnitTests/ModelResult/Dtos/ErrorInfoDtoTests.cs @@ -1,6 +1,5 @@ namespace Byndyusoft.ModelResult.ModelResult.Dtos { - using System.Diagnostics.CodeAnalysis; using System.Linq; using AutoFixture; using Byndyusoft.ModelResult.Dtos; @@ -15,7 +14,7 @@ public void SetUp() _fixture = new Fixture(); } - [NotNull] private Fixture? _fixture; + private Fixture _fixture = default!; [Test] public void TestConstructorWithoutItems() diff --git a/tests/ModelResult.UnitTests/ModelResult/ModelResults/ModelResultTests.cs b/tests/ModelResult.UnitTests/ModelResult/ModelResults/ModelResultTests.cs index 6f74d80..80e885d 100644 --- a/tests/ModelResult.UnitTests/ModelResult/ModelResults/ModelResultTests.cs +++ b/tests/ModelResult.UnitTests/ModelResult/ModelResults/ModelResultTests.cs @@ -1,6 +1,5 @@ namespace Byndyusoft.ModelResult.ModelResult.ModelResults { - using System.Diagnostics.CodeAnalysis; using AutoFixture; using Byndyusoft.ModelResult.ModelResults; using NUnit.Framework; @@ -14,7 +13,7 @@ public void SetUp() _fixture = new Fixture(); } - [NotNull] private Fixture? _fixture; + private Fixture _fixture = default!; [Test] public void TestIsOk()