Skip to content

Commit 4392afc

Browse files
Merge pull request #121 from CodebreakerApp/118-backendmodelupdates
118 update backend models
2 parents 1627596 + a1aae20 commit 4392afc

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

.github/workflows/createnuget-withbuildnumber.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
steps:
4848
- name: Checkout to the branch
49-
uses: actions/checkout@v3
49+
uses: actions/checkout@v4
5050
with:
5151
ref: ${{ inputs.branch-name }}
5252

src/services/gameapi/Codebreaker.GameAPIs.Models/Codebreaker.GameAPIs.Models.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
See https://github.com/codebreakerapp for more information on the complete solution.
1414
</Description>
1515
<PackageReadmeFile>readme.md</PackageReadmeFile>
16-
<PackageIcon>codebreaker.jpeg</PackageIcon>
16+
<PackageIcon>codebreaker.jpeg</PackageIcon>
17+
<IsAotCompatible>true</IsAotCompatible>
1718
</PropertyGroup>
1819

1920
<ItemGroup>

src/services/gameapi/Codebreaker.GameAPIs.Models/Exceptions/CodebreakerException.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,19 @@ public static void ThrowIfNull([NotNull] Game? game)
2121
}
2222
}
2323

24-
public static void ThrowIfEnded(Game game)
24+
public static void ThrowIfUnexpectedGameType(Game game, string gameType)
2525
{
26-
if (game.Ended())
26+
if (game.GameType != gameType)
2727
{
28-
throw new CodebreakerException("Game is not active") { Code = CodebreakerExceptionCodes.GameNotActive };
28+
throw new CodebreakerException("Game type not expected") { Code = CodebreakerExceptionCodes.UnexpectedGameType };
2929
}
3030
}
3131

32-
[DoesNotReturn]
33-
public static void ThrowUpdateFailed(Game game)
32+
public static void ThrowIfEnded(Game game)
3433
{
35-
throw new CodebreakerException("Game update failed") { Code = CodebreakerExceptionCodes.GameUpdateFailed };
34+
if (game.Ended())
35+
{
36+
throw new CodebreakerException("Game is not active") { Code = CodebreakerExceptionCodes.GameNotActive };
37+
}
3638
}
3739
}

src/services/gameapi/Codebreaker.GameAPIs.Models/Exceptions/CodebreakerExceptionCodes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
public class CodebreakerExceptionCodes
44
{
55
public const string InvalidGameType = nameof(InvalidGameType);
6+
public const string UnexpectedGameType = nameof(UnexpectedGameType);
67
public const string GameNotFound = nameof(GameNotFound);
78
public const string GameNotActive = nameof(GameNotActive);
89
public const string GameUpdateFailed = nameof(GameUpdateFailed);

0 commit comments

Comments
 (0)